Customer Portal
Mint a customer-portal access token
Returns a short-lived HS256 JWT for the customer portal. A customer not in the key's organisation is reported as `400` here (not `404`); an `organizationId` mismatch is `403`.
Authorization
apiKey AuthorizationBearer <token>
Per-organisation API key from Settings → API Keys, sent as Authorization: Bearer cnk_…. Missing, unknown or expired keys return 401.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/portal/token" \ -H "Content-Type: application/json" \ -d '{ "customerId": "cus_abc123", "organizationId": "org_2b9c4d", "ttlSeconds": 900, "memberEmail": "dana@acme.com" }'{ "statusCode": 200, "statusDetail": { "status": "SUCCESS", "message": "OK" }, "result": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjdXNfYWJjMTIzIiwib3JnIjoib3JnXzJiOWM0ZCJ9.4kTjZq8x1vXK9mYw2rL6nQ", "expiresAt": 1785499500, "expiresIn": 900 }}{ "statusCode": 400, "statusDetail": { "status": "ERROR", "message": "Request body must be valid JSON." }, "result": {}}{ "statusCode": 401, "statusDetail": { "status": "ERROR", "message": "Invalid API key." }, "result": {}}{ "statusCode": 403, "statusDetail": { "status": "ERROR", "message": "organizationId does not match this API key." }, "result": {}}{ "statusCode": 500, "statusDetail": { "status": "ERROR", "message": "Could not complete the request." }, "result": {}}