Skip to content

Exchange client credentials for a Bearer token

POST
/v1/auth/token
curl --request POST \
--url https://api.zwipe.co/v1/auth/token \
--header 'Content-Type: application/json' \
--data '{ "client_id": "zw_example_client_id", "client_secret": "EXAMPLE_ONLY_REPLACE_WITH_YOUR_SECRET" }'

Send the client_id and client_secret Zwipe gave you. The token is opaque, valid for expires_in seconds, and carries the scopes listed in scope. Request a new one when it expires; there is no refresh flow. Send JSON, not an OAuth form body: this endpoint does not accept grant_type or a requested scope. Permissions are assigned to your partner account. Keep both credentials and access tokens on your backend.

Media typeapplication/json
object
client_id
required
string
>= 1 characters <= 128 characters
client_secret
required
string
>= 1 characters <= 256 characters

Example

{
"client_id": "zw_example_client_id",
"client_secret": "EXAMPLE_ONLY_REPLACE_WITH_YOUR_SECRET"
}

Token issued

Media typeapplication/json
object
access_token
required
string
token_type
required
string
Allowed value: Bearer
expires_in
required

Seconds until the token expires.

integer
scope
required

Space-separated scopes granted, e.g. cards:issue cards:balance cardholders:verify venues:register cards:reveal.

string

Example

{
"access_token": "3b1f9c0e7d4a4b8c9f2e1d0c5a6b7e8f3b1f9c0e7d4a4b8c9f2e1d0c5a6b7e8f",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "cards:issue cards:balance cardholders:verify venues:register cards:reveal"
}

Request does not match this contract (missing field, wrong type, bad format)

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable code.

string
Allowed values: validation_error invalid_client unauthorized insufficient_scope not_found method_not_allowed unsupported_media_type external_ref_conflict card_exists card_not_active cardholder_email_conflict no_existing_card chain_only chain_account venue_claimed venue_not_registered venue_required provider_error provider_unavailable provider_timeout issuance_in_doubt restart_unavailable rate_limited internal_error
message
required
string
details

Present on validation_error. One entry per violated field.

Array<object>
object
pointer
required

JSON pointer into the request body, or the parameter name.

string
message
required
string

Example

{
"error": {
"code": "validation_error",
"message": "Request body invalid: value at `/email` does not match format: email",
"details": [
{
"pointer": "/email",
"message": "value at `/email` does not match format: email"
}
]
}
}

Unknown client_id, wrong secret, or suspended partner

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable code.

string
Allowed values: validation_error invalid_client unauthorized insufficient_scope not_found method_not_allowed unsupported_media_type external_ref_conflict card_exists card_not_active cardholder_email_conflict no_existing_card chain_only chain_account venue_claimed venue_not_registered venue_required provider_error provider_unavailable provider_timeout issuance_in_doubt restart_unavailable rate_limited internal_error
message
required
string
details

Present on validation_error. One entry per violated field.

Array<object>
object
pointer
required

JSON pointer into the request body, or the parameter name.

string
message
required
string

Example

{
"error": {
"code": "invalid_client",
"message": "Client credentials are invalid."
}
}

Over the request limit (see Rate limit above). Wait Retry-After seconds.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable code.

string
Allowed values: validation_error invalid_client unauthorized insufficient_scope not_found method_not_allowed unsupported_media_type external_ref_conflict card_exists card_not_active cardholder_email_conflict no_existing_card chain_only chain_account venue_claimed venue_not_registered venue_required provider_error provider_unavailable provider_timeout issuance_in_doubt restart_unavailable rate_limited internal_error
message
required
string
details

Present on validation_error. One entry per violated field.

Array<object>
object
pointer
required

JSON pointer into the request body, or the parameter name.

string
message
required
string

Example

{
"error": {
"code": "rate_limited",
"message": "Too many requests. Retry after 1 second."
}
}
Retry-After
integer
>= 1

Seconds to wait before the next request.