To access the platform, you must first have an access token. Through this URL, you can obtain one — but be careful! The access token expires after 1 hour. After this period, you will need to re-authenticate.
Auth
Get Access Token
Exchange your business client credentials for a short-lived Bearer access token used to authenticate every other API call.
POST
To access the platform, you must first have an access token. Through this URL, you can obtain one — but be careful! The access token expires after 1 hour. After this period, you will need to re-authenticate.
Overview
POST /auth/token exchanges your business credentials (client_id and client_key) for a short-lived Bearer access token. Every other Cartevo endpoint requires this token in the Authorization header. There is no refresh-token endpoint — when a token expires, call this endpoint again.
When to use it
- Once at the start of any worker, cron job, or HTTP request that needs to call Cartevo.
- Whenever a previous token is about to expire (recommended: refresh ~5 minutes before
expires_inruns out). - After a
401 Unauthorizedresponse from any other endpoint — refresh and retry once.
Prerequisites
- An active Cartevo company account.
- A
client_id/client_keypair, available from the dashboard at Settings → API Keys.
Request
Headers
No
Authorization header is required for this endpoint.
Body
Response
200 — Success
Note: This endpoint returns the raw response shown above — it is not wrapped in the standard { success, statusCode, message, data } envelope used elsewhere. See API Conventions → Response envelope.
Error responses
Token scope and lifetime
- Scope: Each token is bound to one company in one mode (preproduction or production). It cannot operate on another company’s data, and it cannot cross modes.
- Lifetime: Determined by the deployment configuration. Treat
expires_inas the only authoritative value. The current production default is short-lived (typically 1 hour); preproduction may differ. - Revocation: There is no per-token revocation endpoint. Rotating the underlying
client_keyimmediately invalidates all tokens minted from it.
Code examples
cURL
Node.js (axios)
Python (requests)
PHP (Guzzle)
Best practices
- Cache the token in your server for
expires_in - 300seconds and reuse it across requests — do not mint a new token per call. - Refresh preemptively. Schedule a refresh ~5 minutes before expiry so in-flight requests never hit a
401. - Never expose
client_keyor theaccess_tokento browsers, mobile apps, or any client-side code. Always proxy through your server. - Rotate
client_keyimmediately if you suspect compromise. Existing tokens minted from it remain valid until expiry — there is no per-token revocation. - Use separate credentials per environment (preproduction vs. production) so a leaked test key cannot touch live money.
Webhooks fired
None. This endpoint is purely synchronous.Related
Response
Authentication successful
JWT access token for API authentication
Example:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJlY2E1ZTk4Mi0wMGI1LTRhYTItYjcwOS03ZDVjZDY3M2U5NWMiLCJjb21wYW55SWQiOiJlY2E1ZTk4Mi0wMGI1LTRhYTItYjcwOS03ZDVjZDY3M2U5NWMiLCJjbGllbnRJZCI6ImNsaWVudF91dGtxNnV5MnB0IiwiaWF0IjoxNzYyMTY4MDIzLCJleHAiOjE3NjIxNzE2MjN9.hloSSSPJ2WFa31s41BL1nqhemuwHCJKC_wcwVupsBlU"
Type of token
Example:
"Bearer"
Token expiration time in seconds
Example:
3600