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

# Mint a token

> Mint a signed JWT from an arbitrary claims payload. The token is
signed with the application's access-token signing keys, so it
verifies against the application's published JWKS exactly like a
real access token.

This endpoint is intended for local development and testing. It is
only available for applications in **dev** mode; it is rejected for
applications in **prod** mode.

The minted token's lifetime is capped at 24 hours: a supplied `exp`
claim may not be more than 24 hours in the future, and a missing
`exp` defaults to 24 hours from now. Missing `iat` and `jti` claims
are populated automatically.




## OpenAPI

````yaml post /v2/session/apps/{appID}/tokens
openapi: 3.1.1
info:
  title: Prelude Session Management API
  version: 0.0.1
  summary: The Prelude API for Session Management
  description: The Prelude API for Session Management.
  contact:
    email: support@prelude.so
    url: https://prelude.so
servers:
  - url: https://api.prelude.dev
    description: Production server
security:
  - Authorization: []
tags:
  - name: Mode
    description: Manage the mode (dev/prod) of your application.
  - name: Tokens
    description: Mint development tokens for your application.
  - name: Users
    description: Manage the users of your application.
  - name: Webhooks
    description: Manage the webhooks of your application.
  - name: Domains
    description: Manage the domains of your application.
  - name: Config - Scopes
    description: Manage the scope configuration of your application.
  - name: Config - Groups
    description: >-
      Manage the group configuration of your application. A group owns a set of
      scopes; users assigned to a group are granted the group's scopes.
  - name: Config - Claims
    description: Manage the claims mapping configuration of your application.
  - name: Config - Step-up
    description: Manage the step-up authentication configuration of your application.
  - name: Config - Migration
    description: Manage the user migration configuration of your application.
  - name: Config - Login OTP
    description: Manage the OTP login configuration of your application.
  - name: Config - Login OAuth
    description: Manage the OAuth login configuration of your application.
  - name: Config - Login SAML
    description: Manage the SAML 2.0 SSO connections of your application.
  - name: Config - Login Password
    description: Manage the password login configuration of your application.
  - name: Config - Passkey
    description: Manage the WebAuthn passkey configuration of your application.
paths:
  /v2/session/apps/{appID}/tokens:
    parameters:
      - $ref: '#/components/parameters/appIDParam'
    post:
      tags:
        - Tokens
      summary: Mint a token
      description: |
        Mint a signed JWT from an arbitrary claims payload. The token is
        signed with the application's access-token signing keys, so it
        verifies against the application's published JWKS exactly like a
        real access token.

        This endpoint is intended for local development and testing. It is
        only available for applications in **dev** mode; it is rejected for
        applications in **prod** mode.

        The minted token's lifetime is capped at 24 hours: a supplied `exp`
        claim may not be more than 24 hours in the future, and a missing
        `exp` defaults to 24 hours from now. Missing `iat` and `jti` claims
        are populated automatically.
      operationId: mintToken
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostMintTokenRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostMintTokenResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/InvalidRequestError'
                  - $ref: '#/components/schemas/TokenLifetimeTooLongError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MintNotAllowedInProdModeError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppNotFoundError'
components:
  parameters:
    appIDParam:
      in: path
      name: appID
      required: true
      description: The id of the app the request refers to.
      schema:
        $ref: '#/components/schemas/AppID'
  schemas:
    PostMintTokenRequest:
      type: object
      properties:
        claims:
          type: object
          description: |
            The JWT claims payload to sign. Any claims are accepted and are
            passed through as-is. The `exp` claim is capped at 24 hours in
            the future and defaults to 24 hours from now when omitted; `iat`
            and `jti` are populated automatically when omitted.
          additionalProperties: true
          examples:
            - sub: user-123
              scope: read write
      required:
        - claims
    PostMintTokenResponse:
      type: object
      properties:
        token:
          type: string
          description: The signed JWT.
          examples:
            - >-
              eyJhbGciOiJSUzI1NiIsImtpZCI6ImtleS0xIn0.eyJzdWIiOiJ1c2VyLTEyMyJ9.signature
        expires_at:
          type: string
          format: date-time
          description: The time at which the token expires.
          examples:
            - '2026-06-17T12:00:00Z'
      required:
        - token
        - expires_at
    InvalidRequestError:
      type: object
      properties:
        code:
          type: string
          enum:
            - invalid_request
          examples:
            - invalid_request
        status:
          type: string
          enum:
            - bad_request
          examples:
            - bad_request
        message:
          type: string
          examples:
            - The request body is invalid.
      required:
        - code
        - status
        - message
    TokenLifetimeTooLongError:
      type: object
      properties:
        code:
          type: string
          enum:
            - token_lifetime_too_long
          examples:
            - token_lifetime_too_long
        status:
          type: string
          enum:
            - bad_request
          examples:
            - bad_request
        message:
          type: string
          examples:
            - The minted token lifetime cannot exceed 24 hours.
      required:
        - code
        - status
        - message
    MintNotAllowedInProdModeError:
      type: object
      properties:
        code:
          type: string
          enum:
            - mint_not_allowed_in_prod_mode
          examples:
            - mint_not_allowed_in_prod_mode
        status:
          type: string
          enum:
            - forbidden
          examples:
            - forbidden
        message:
          type: string
          examples:
            - Minting tokens is only allowed for applications in dev mode.
      required:
        - code
        - status
        - message
    AppNotFoundError:
      type: object
      properties:
        code:
          type: string
          enum:
            - app_not_found
          examples:
            - app_not_found
        status:
          type: string
          enum:
            - not_found
          examples:
            - not_found
        message:
          type: string
          examples:
            - The application was not found.
      required:
        - code
        - status
        - message
    AppID:
      type: string
      description: An application's unique identifier.
      examples:
        - 54e9ujn
        - fvua38g
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer

````