Skip to content
EntitlerDocs

POST/v1/customers/{external_id}/tokens

Create a customer token

Mints a token for a customer, scoped to entitlements:read unless scopes asks for more. Each requested scope must be one the caller holds, and lifetimeSeconds defaults to 3,600. Needs tokens:mint, and a plan that includes customer tokens.

curl -X POST 'https://api.entitler.co/v1/customers/ada/tokens' \
  -H "Authorization: Bearer $ENTITLER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lifetimeSeconds":1,"memberId":"memberId","scopes":["CUSTOMER_TOKEN_SCOPE_UNSPECIFIED"],"target":{"environmentId":"environmentId","projectId":"projectId","teamId":"teamId"}}'

Credentials

Send any one of these:

  • Bearer token

Path parameters

NameTypeDescription
external_idrequiredstring

Request body

object

  • lifetimeSecondsinteger (int64)

    at least 0; at most 4294967295

  • memberIdstring
  • scopesarray of CustomerTokenScope
  • targetProductTarget
    • environmentIdstring
    • projectIdstring
    • teamIdstring

Responses

200The CreateTokenResponse message.

CreateTokenResponse

  • customerIdstring
  • expiresAtintegerrequired

    at least 0; at most 18446744073709552000

  • memberIdstring
  • scopesarray of CustomerTokenScoperequired
  • tokenstringrequired
  • tokenIdstringrequired

ErrorA refusal, with the HTTP status of its gRPC code.

Error

  • errorobjectrequired
    • codestringrequired
    • parametersobjectrequired

      Each value: string

    • reasonstringor nullrequired