> ## Documentation Index
> Fetch the complete documentation index at: https://doc.extole.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a consumer access token

> Issues a new access token for the identity supplied in the request. Pass an `email` to identify a consumer when the client identity key is `email`. Pass a `jwt` to assert a trusted identity via JWT verification. Omit both to issue an anonymous token. The optional `duration_seconds` field caps the token lifetime.



## OpenAPI

````yaml /api-reference/integration-consumer-to-extole.json post /api/v5/token
openapi: 3.0.1
info:
  description: >-
    Consumer-to-Extole integration endpoints: consumer event submission, zone
    rendering, profile management, and SDK-backing operations for browser and
    native app environments.
  title: Integration API - Consumer to Extole
  version: '1.0'
servers:
  - description: Production
    url: https://{brand}.extole.io
    variables:
      brand:
        default: yourcompany
        description: >-
          Your Extole client subdomain (e.g. 'mycompany' for
          mycompany.extole.io)
security:
  - HEADER: []
  - QUERY: []
  - COOKIE: []
tags:
  - name: Authentication
  - name: Content
  - name: Email
  - name: Events
  - name: Persons
  - name: Profile Assets
  - name: Profiles
paths:
  /api/v5/token:
    post:
      tags:
        - Authentication
      summary: Create a consumer access token
      description: >-
        Issues a new access token for the identity supplied in the request. Pass
        an `email` to identify a consumer when the client identity key is
        `email`. Pass a `jwt` to assert a trusted identity via JWT verification.
        Omit both to issue an anonymous token. The optional `duration_seconds`
        field caps the token lifetime.
      operationId: createConsumerToken
      requestBody:
        content:
          application/json:
            example:
              duration_seconds: 1
              email: email
              jwt: jwt
            schema:
              $ref: '#/components/schemas/CreateTokenRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/CreateTokenRequest'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenResponse'
          description: Created consumer access token.
        '400':
          content:
            application/json:
              examples:
                email_not_applicable:
                  $ref: '#/components/examples/email_not_applicable'
                invalid_access_token_duration:
                  $ref: '#/components/examples/invalid_access_token_duration'
              schema:
                $ref: '#/components/schemas/RestExceptionResponse'
          description: >-
            The token-creation request is invalid: `email` is not applicable for
            the client's identity key (`email_not_applicable`), or the requested
            token duration is outside the permitted range
            (`invalid_access_token_duration`).
        '401':
          content:
            application/json:
              examples:
                method_unauthorized:
                  $ref: '#/components/examples/method_unauthorized'
              schema:
                $ref: '#/components/schemas/RestExceptionResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              examples:
                email_mismatch:
                  $ref: '#/components/examples/email_mismatch'
                invalid_email:
                  $ref: '#/components/examples/invalid_email'
                jwt_error:
                  $ref: '#/components/examples/jwt_error'
                method_unauthorized:
                  $ref: '#/components/examples/method_unauthorized'
              schema:
                $ref: '#/components/schemas/RestExceptionResponse'
          description: Forbidden
        '415':
          content:
            application/json:
              examples:
                unsupported_media_type:
                  $ref: '#/components/examples/unsupported_media_type'
              schema:
                $ref: '#/components/schemas/RestExceptionResponse'
          description: Unsupported Media Type
        '429':
          content:
            application/json:
              examples:
                too_many_requests:
                  $ref: '#/components/examples/too_many_requests'
              schema:
                $ref: '#/components/schemas/RestExceptionResponse'
          description: Too Many Requests
components:
  schemas:
    CreateTokenRequest:
      properties:
        duration_seconds:
          description: >-
            Requested token lifetime in seconds. Defaults to the client
            configuration value when omitted.
          format: int64
          nullable: true
          type: integer
        email:
          description: >-
            Email address used to identify or create the consumer. Ignored when
            `jwt` is present.
          nullable: true
          type: string
        jwt:
          description: >-
            Signed JWT carrying consumer identity claims. When supplied,
            identity is derived from the token claims rather than from `email`.
          nullable: true
          type: string
      required:
        - duration_seconds
        - email
        - jwt
      type: object
    TokenResponse:
      properties:
        access_token:
          description: >-
            Opaque access token for the consumer session. Pass as a Bearer token
            or `access_token` query parameter on subsequent requests.
          type: string
        expires_in:
          description: Seconds until the token expires.
          format: int64
          type: integer
        scopes:
          description: Set of permission scopes granted to this token.
          items:
            description: Set of permission scopes granted to this token.
            enum:
              - UPDATE_PROFILE
              - VERIFIED_CONSUMER
            type: string
          type: array
          uniqueItems: true
      required:
        - access_token
        - expires_in
        - scopes
      type: object
    RestExceptionResponse:
      description: Represents the API error response
      properties:
        code:
          description: Specific error code for this error type, documented per endpoint
          type: string
        http_status_code:
          description: >-
            HTTP status code that was returned with this error, useful if client
            get response code
          format: int32
          type: integer
        message:
          description: User readable English description of the error
          type: string
        parameters:
          additionalProperties:
            description: >-
              Attributes related to the error, varies be error code, documented
              per endpoint
            type: object
          description: >-
            Attributes related to the error, varies be error code, documented
            per endpoint
          type: object
        unique_id:
          description: >-
            Unique id associated with this error, useful for discussions with
            Extole
          type: string
      required:
        - code
        - http_status_code
        - message
        - parameters
        - unique_id
      type: object
  examples:
    email_not_applicable:
      summary: email_not_applicable
      value:
        code: email_not_applicable
        http_status_code: 400
        message: Email attribute is not applicable for current identity key
        parameters: {}
        unique_id: 00000000-0000-0000-0000-000000000000
    invalid_access_token_duration:
      summary: invalid_access_token_duration
      value:
        code: invalid_access_token_duration
        http_status_code: 400
        message: The duration provided with this request is invalid.
        parameters: {}
        unique_id: 00000000-0000-0000-0000-000000000000
    method_unauthorized:
      summary: method_unauthorized
      value:
        code: method_unauthorized
        http_status_code: 401
        message: Unauthorized access to this endpoint
        parameters: {}
        unique_id: 00000000-0000-0000-0000-000000000000
    email_mismatch:
      summary: email_mismatch
      value:
        code: email_mismatch
        http_status_code: 403
        message: Mismatch in specified emails
        parameters: {}
        unique_id: 00000000-0000-0000-0000-000000000000
    invalid_email:
      summary: invalid_email
      value:
        code: invalid_email
        http_status_code: 400
        message: Invalid email
        parameters: {}
        unique_id: 00000000-0000-0000-0000-000000000000
    jwt_error:
      summary: jwt_error
      value:
        code: jwt_error
        http_status_code: 403
        message: The jwt authentication verification failed.
        parameters: {}
        unique_id: 00000000-0000-0000-0000-000000000000
    unsupported_media_type:
      summary: unsupported_media_type
      value:
        code: unsupported_media_type
        http_status_code: 415
        message: Request had an unsupported or no media type
        parameters: {}
        unique_id: 00000000-0000-0000-0000-000000000000
    too_many_requests:
      summary: too_many_requests
      value:
        code: too_many_requests
        http_status_code: 429
        message: >-
          The server is unable to process your request at the moment, please
          retry later.
        parameters: {}
        unique_id: 00000000-0000-0000-0000-000000000000
  securitySchemes:
    HEADER:
      in: header
      name: Authorization
      type: apiKey
      x-bearer-format: bearer
    QUERY:
      in: query
      name: access_token
      type: apiKey
    COOKIE:
      in: cookie
      name: extole_token
      type: apiKey

````