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

# Exchange access key for JWT token

The Aptly API uses JWT Bearer Tokens for Authentication.  To generate a JWT Bearer Token for use with the Aptly API you must first create a M2M Access Key for your user inside your Aptly admin panel.

Please visit the following links to create your Access Key

* [US Access Key Management](https://app.us.aptlydone.com/admin/advanced-settings/user-api-key-management)

* [EU Access Key Management](https://app.eu.aptlydone.com/admin/advanced-settings/user-api-key-management)

Once you have your Access Key pass it as the accessKey property to receive your JWT Bearer Token for use in all other Aptly API endpoints.


## OpenAPI

````yaml post /v1/tenants/access-key/exchange
openapi: 3.0.0
info:
  title: Auth APIs Specification
  description: Section for description
  version: '1.0'
  contact: {}
servers:
  - url: https://staging.api.us.aptlydone.com/auth
  - url: https://staging.api.eu.aptlydone.com/auth
  - url: https://api.us.aptlydone.com/auth
  - url: https://api.eu.aptlydone.com/auth
security: []
tags: []
paths:
  /v1/tenants/access-key/exchange:
    post:
      tags:
        - tenants
      summary: Exchange access key for JWT token
      operationId: TenantController_generateAccessKeyJwtToken_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/exchangeApiRequestDto'
      responses:
        '200':
          description: Returns JWT token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/exchangeApiResponseDtoResponse'
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/exchangeApiResponseDto'
components:
  schemas:
    exchangeApiRequestDto:
      type: object
      properties:
        accessKey:
          type: string
          example: asd55asdasd55asdasd55asdsad
          description: accessKey generated from the Aptly account
      required:
        - accessKey
    exchangeApiResponseDtoResponse:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP Status code
          example: 200
        timestamp:
          type: string
          description: Timestamp of the response
          example: '2026-01-12T09:10:12.337Z'
        message:
          type: string
          description: Response message
          example: Success
        data:
          description: Response data
          allOf:
            - $ref: '#/components/schemas/exchangeApiResponseDto'
      required:
        - statusCode
        - timestamp
        - message
        - data
    exchangeApiResponseDto:
      type: object
      properties:
        token:
          type: string
          example: 306cbe25-73ae-4a12-8b47-78af5c3bcac5
          description: Exchange Token
      required:
        - token

````