Exchange client credentials for a Bearer token
const url = 'https://api.zwipe.co/v1/auth/token';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"client_id":"zw_example_client_id","client_secret":"EXAMPLE_ONLY_REPLACE_WITH_YOUR_SECRET"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
{ "client_id": "zw_example_client_id", "client_secret": "EXAMPLE_ONLY_REPLACE_WITH_YOUR_SECRET"}Responses
Section titled “Responses”Token issued
object
Seconds until the token expires.
Space-separated scopes granted, e.g. cards:issue cards:balance cardholders:verify venues:register cards:reveal.
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)
object
object
Stable machine-readable code.
Present on validation_error. One entry per violated field.
object
JSON pointer into the request body, or the parameter name.
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
object
object
Stable machine-readable code.
Present on validation_error. One entry per violated field.
object
JSON pointer into the request body, or the parameter name.
Example
{ "error": { "code": "invalid_client", "message": "Client credentials are invalid." }}Over the request limit (see Rate limit above). Wait Retry-After seconds.
object
object
Stable machine-readable code.
Present on validation_error. One entry per violated field.
object
JSON pointer into the request body, or the parameter name.
Example
{ "error": { "code": "rate_limited", "message": "Too many requests. Retry after 1 second." }}Headers
Section titled “Headers”Seconds to wait before the next request.

