Direct API (S2S)

Authentication & Tokenization

Authenticate with your API key, and exchange it for an access token to tokenize cards.

All requests to the Tonder API must be authenticated. We use an API key to ensure that all communication comes from a trusted source. An unauthenticated request returns 401 Unauthorized.

Authentication methods

CredentialSandboxProduction
API keydashboard-stage.tonder.io → Developers → API Keysdashboard.tonder.io → Developers → API Keys

Required headers

HeaderDescription
AuthorizationYour API key, prefixed with Token.
Content-TypeMust be application/json for requests with a body.
Authorization: Token <YOUR_API_KEY>
Content-Type: application/json

The scheme is Token followed by a space and then your key — not Bearer. If the space is missing, you get 401 Unauthorized.

Also send X-Request-Id with a UUID v4 per request: it isn't an authentication header, it's the idempotency key that deduplicates retries. See Idempotency.

Complete request example

import requests

API_KEY = "your_api_key_from_dashboard"
BASE_URL = "https://stage.tonder.io/api/v1"  # use https://app.tonder.io in production

request_body = {
    "operation_type": "payment",
    "amount": 100.00,
    "currency": "MXN",
    "customer": {"name": "Test Customer", "email": "test@example.com"},
    "payment_method": {"type": "SPEI"},
    "client_reference": "ORD-001"
}
headers = {"Authorization": f"Token {API_KEY}", "Content-Type": "application/json"}

response = requests.post(f"{BASE_URL}/process/", headers=headers, json=request_body)
print(f"Status: {response.status_code}")
print(f"Response: {response.json()}")
curl -X POST https://stage.tonder.io/api/v1/process/ \
  -H "Authorization: Token <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "operation_type": "payment",
    "amount": 100.00,
    "currency": "MXN",
    "customer": { "name": "Test Customer", "email": "test@example.com" },
    "payment_method": { "type": "SPEI" },
    "client_reference": "ORD-001"
  }'

Card tokenization

To store or process cards with a smaller PCI scope, exchange your key for a short-lived access token: GET /api/v1/tokenization/auth/ (with your API key) returns an access_token (JWT). That token authorizes tokenizing the card data (X-Skyflow-Authorization header). See the full flow in Card payments.

Security best practices

  • Never expose your API key in client-side code, mobile apps, or version control.
  • Use environment variables to store credentials — don't leave them in the code.
  • Rotate keys immediately if you suspect they leaked.
  • Use separate keys for sandbox and production.
  • Restrict credential access on a need-to-know basis.

Authentication errors

CodeMessageCauseFix
401UnauthorizedInvalid or missing API keyCheck that your key is correct and includes the Token prefix (with a space).
403ForbiddenThe key isn't allowed on this endpointReview your account permissions or contact support.

Next steps

Was this page helpful?

On this page