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

# Exchange API token for JWT token

> Exchange your API token for a JWT token that can be used for authenticated requests. JWT tokens are valid for 24 hours.



## OpenAPI

````yaml api-reference/openapi.json post /token/exchange
openapi: 3.1.0
info:
  title: Flowent API Gateway
  description: >-
    The Flowent API Gateway enables external developers to register and manage
    custom actions that can be used within Flowent's conversational flows. This
    API provides secure, tenant-specific extensibility for the Flowent platform.


    ## Authentication


    1. Obtain an API token from the Flowent admin panel

    2. Exchange the API token for a JWT token using the `/token/exchange`
    endpoint

    3. Use the JWT token as a Bearer token in the Authorization header for all
    requests


    ## Security


    All webhook calls are secured with HMAC-SHA256 signatures using
    tenant-specific keys.
  version: 1.0.0
  contact:
    name: Flowent API Support
    url: https://flowent.chat/support
    email: contact@flowent.chat
servers:
  - url: https://api.flowent.chat/api/v1/gateway
    description: Production server
  - url: https://staging-api.flowent.chat/api/v1/gateway
    description: Staging server
  - url: http://localhost:8080/api/v1/gateway
    description: Local development server
security: []
tags:
  - name: Authentication
    description: Token exchange and authentication operations
  - name: Actions
    description: Action registration and management operations
paths:
  /token/exchange:
    post:
      tags:
        - Authentication
      summary: Exchange API token for JWT token
      description: >-
        Exchange your API token for a JWT token that can be used for
        authenticated requests. JWT tokens are valid for 24 hours.
      operationId: exchangeToken
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - api_token
              properties:
                api_token:
                  type: string
                  description: Your API token from the admin panel
                  example: api_1234567890abcdef1234567890abcdef12345678
      responses:
        '200':
          description: Token exchange successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  jwt_token:
                    type: string
                    description: JWT token for authentication
                    example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                  token_type:
                    type: string
                    enum:
                      - Bearer
                    example: Bearer
                  expires_in:
                    type: integer
                    description: Token expiration time in seconds
                    example: 86400
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
components:
  responses:
    BadRequestError:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Invalid request format
              details:
                type: string
                example: Field 'name' is required
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Invalid token

````