---
title: "Auth0 - Generate token"
method: POST
path: "/hooks/v1/auth0/actions/token"
---

# Auth0 - Generate token

`POST /hooks/v1/auth0/actions/token`

## Request

- Base URL: ` https://identity.api.sandbox.cleeng.com` (relative, and the document’s source URL is not known)
- URL: ` https://identity.api.sandbox.cleeng.com/hooks/v1/auth0/actions/token`
- Auth: HTTP bearer

Receives user authentication events from Auth0 post-login/post-registration action. Creates a new customer or updates existing customer data (if changes detected). Generates Cleeng access token (JWT) with configurable expiration.<br /><br /><strong>Authorization</strong>: Requires Bearer token (JWT). The token value must match the <strong>secret</strong> in publisher configuration.<br /><br /><strong>Request body</strong><ul><li>Send one JSON object per request.</li><li>If the body contains characters after the JSON object, the endpoint returns 400 ID0001.</li></ul><strong>Stored values outside field limits</strong><ul><li>A stored customer value can exceed the limits in Body Params.</li><li>If the request sends that value unchanged, the endpoint returns 400 ID0001 on every login.</li><li>To resolve the error, correct the value in Auth0 or in Cleeng.</li></ul><strong>Response time</strong><ul><li>The endpoint responds within approximately 20 s.</li><li>If processing exceeds approximately 18 s, the endpoint returns 504 ID2112.</li></ul><strong>Retrying failed requests</strong><ul><li>502 ID2111: Safe to retry the request.</li><li>504 ID2112: Safe to retry the request.</li><li>409 ID2113: Safe to retry the request once.</li></ul>

## Request body

- object
  - `auth0Id` string, required: Auth0 user identifier (typically "auth0|{sub}" format from Auth0 user object). Example: auth0|1234567890
  - `email` string, required: User email address (must contain @). Example: user@example.com
  - `firstName` string: User first name. Max 50 characters. Must not contain `http://`, `https://`, `ftp://`, `mailto:`, `javascript:` or `www.`. Example: John
  - `lastName` string: User last name. Max 50 characters. Must not contain `http://`, `https://`, `ftp://`, `mailto:`, `javascript:` or `www.`. Example: Smith
  - `locale` string, required: User locale (language_COUNTRY format). Example: en_US
  - `country` string, required: ISO 3166-1 alpha-2 country code. Example: US
  - `currency` string, required: ISO 4217 currency code, exactly 3 uppercase letters. Example: USD
  - `userIpAddress` string, required: User IP address (validated as valid IPv4 or IPv6). Example: 192.168.1.1
  - `expiresAt` integer: Optional Unix timestamp (seconds since epoch) when the access token should expire. Must be in the future. If not provided, uses the publisher's default accessTokenExpiration configuration. Example: 1736870400
  - `externalId` string: Customer's external ID. Omitting it doesn't fail the request. It falls back to `auth0Id` as an identifier. Max 100 characters, ASCII only

## Response `200`

Successful response

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `409`: Conflict
- `422`: Unprocessable Entity
- `500`: Internal Server Error

---

[API](https://skmtc.dev/cleeng/apis/identity-service-api.md) - [All operations](https://skmtc.dev/cleeng/apis/identity-service-api/llms.txt) - [OpenAPI document](https://skmtc.dev/cleeng/apis/identity-service-api/revisions/bfa29cc8a820?raw)
