Every Product API request must be authenticated with a short-lived bearer token.
Sandbox and Staging: every request, including the token exchange below, must also send the
CF-Access-Client-IdandCF-Access-Client-Secretheaders. See Cloudflare Access. Production does not use them.
For the whole flow with Python and JavaScript examples, see the Quickstart.
Send your JWT API key to the token endpoint:
curl --location 'https://api.sandbox.aiwyn.app/v1/auth/token' \
--header 'CF-Access-Client-Id: <cf-access-client-id>' \
--header 'CF-Access-Client-Secret: <cf-access-client-secret>' \
--header 'Content-Type: application/json' \
--data '{ "jwtApiKey": "<your-jwt-api-key>" }'The response is the bearer token alone: { "token": "eyJ..." }.
Authorization: Bearer <token>curl --request POST 'https://api.sandbox.aiwyn.app/gql/v1/clients' \
--header 'CF-Access-Client-Id: <cf-access-client-id>' \
--header 'CF-Access-Client-Secret: <cf-access-client-secret>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "pageSize": 5, "page": 0 }'- Tokens are short-lived and last up to an hour. The exchange can return a token it issued earlier, so a token you have just received may have only minutes left.
- Don't schedule refreshes by the clock: when a call answers
401, request a new token fromPOST /v1/auth/tokenand retry the call once. - A
401 Unauthorizedresponse means the token is missing, malformed, or expired.
The operations a token is allowed to perform are determined by the roles provisioned for your API key. See Authentication & authorization for the full list of roles and the endpoints each one grants, and Errors for the 401 / 403 response shapes.