Clerk JWT Templates API

JWT Templates allow you to generate custom authentication tokens tied to authenticated sessions, enabling you to integrate with third-party services.

OpenAPI Specification

clerk-com-jwt-templates-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Clerk Backend Account Portal JWT Templates API
  x-logo:
    url: https://clerk.com/_next/image?url=%2Fimages%2Fclerk-logo.svg&w=96&q=75
    altText: Clerk docs
    href: https://clerk.com/docs
  contact:
    email: support@clerk.com
    name: Clerk Platform Team
    url: https://clerk.com/support
  description: 'The Clerk REST Backend API, meant to be accessed by backend servers.


    ### Versions


    When the API changes in a way that isn''t compatible with older versions, a new version is released.

    Each version is identified by its release date, e.g. `2025-04-10`. For more information, please see [Clerk API Versions](https://clerk.com/docs/versioning/available-versions).


    Please see https://clerk.com/docs for more information.'
  version: '2025-11-10'
  termsOfService: https://clerk.com/terms
  license:
    name: MIT
    url: https://github.com/clerk/openapi-specs/blob/main/LICENSE
servers:
- url: https://api.clerk.com/v1
security:
- bearerAuth: []
tags:
- name: JWT Templates
  description: 'JWT Templates allow you to generate custom authentication tokens

    tied to authenticated sessions, enabling you to integrate with third-party

    services.'
  externalDocs:
    url: https://clerk.com/docs/request-authentication/jwt-templates
paths:
  /jwt_templates:
    get:
      operationId: ListJWTTemplates
      x-speakeasy-group: jwtTemplates
      x-speakeasy-name-override: list
      summary: List All Templates
      parameters:
      - $ref: '#/components/parameters/Paginated'
      - $ref: '#/components/parameters/LimitParameter'
      - $ref: '#/components/parameters/OffsetParameter'
      tags:
      - JWT Templates
      responses:
        '200':
          $ref: '#/components/responses/JWTTemplate.List'
    post:
      operationId: CreateJWTTemplate
      x-speakeasy-group: jwtTemplates
      x-speakeasy-name-override: create
      summary: Create a JWT Template
      description: Create a new JWT template
      tags:
      - JWT Templates
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: JWT template name
                  nullable: false
                claims:
                  type: object
                  description: JWT template claims in JSON format
                  nullable: false
                lifetime:
                  type: integer
                  minimum: 30
                  maximum: 315360000
                  description: JWT lifetime
                  nullable: true
                allowed_clock_skew:
                  type: integer
                  minimum: 0
                  maximum: 300
                  description: JWT allowed clock skew
                  nullable: true
                custom_signing_key:
                  type: boolean
                  description: Whether a custom signing key/algorithm is also provided for this template
                signing_algorithm:
                  type: string
                  description: The custom signing algorithm to use when minting JWTs. Required if `custom_signing_key` is `true`.
                  nullable: true
                signing_key:
                  type: string
                  description: The custom signing private key to use when minting JWTs. Required if `custom_signing_key` is `true`.
                  nullable: true
              required:
              - name
              - claims
      responses:
        '200':
          $ref: '#/components/responses/JWTTemplate'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /jwt_templates/{template_id}:
    get:
      operationId: GetJWTTemplate
      x-speakeasy-group: jwtTemplates
      x-speakeasy-name-override: get
      summary: Retrieve a Template
      description: Retrieve the details of a given JWT template
      tags:
      - JWT Templates
      parameters:
      - name: template_id
        in: path
        description: JWT Template ID
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/JWTTemplate'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
    patch:
      operationId: UpdateJWTTemplate
      x-speakeasy-group: jwtTemplates
      x-speakeasy-name-override: update
      summary: Update a JWT Template
      description: Updates an existing JWT template
      tags:
      - JWT Templates
      parameters:
      - name: template_id
        in: path
        description: The ID of the JWT template to update
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: JWT template name
                  nullable: false
                claims:
                  type: object
                  description: JWT template claims in JSON format
                  nullable: false
                lifetime:
                  type: integer
                  minimum: 30
                  maximum: 315360000
                  description: JWT lifetime
                  nullable: true
                allowed_clock_skew:
                  type: integer
                  minimum: 0
                  maximum: 300
                  description: JWT allowed clock skew
                  nullable: true
                custom_signing_key:
                  type: boolean
                  description: Whether a custom signing key/algorithm is also provided for this template
                signing_algorithm:
                  type: string
                  description: The custom signing algorithm to use when minting JWTs. Required if `custom_signing_key` is `true`.
                  nullable: true
                signing_key:
                  type: string
                  description: The custom signing private key to use when minting JWTs. Required if `custom_signing_key` is `true`.
                  nullable: true
              required:
              - name
              - claims
      responses:
        '200':
          $ref: '#/components/responses/JWTTemplate'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
    delete:
      operationId: DeleteJWTTemplate
      x-speakeasy-group: jwtTemplates
      x-speakeasy-name-override: delete
      summary: Delete a Template
      description: ''
      tags:
      - JWT Templates
      parameters:
      - name: template_id
        in: path
        description: JWT Template ID
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/DeletedObject'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
  /platform/applications/{applicationID}/instances/{envOrInsID}/jwt_templates:
    get:
      operationId: PlatformListJWTTemplates
      x-speakeasy-group: platform
      x-speakeasy-name-override: listJWTTemplates
      tags:
      - JWT Templates
      summary: List JWT Templates
      description: 'List all JWT templates for an application instance.


        Requires the `jwt_templates:read` scope.

        '
      security:
      - platform_api_access_token: []
      parameters:
      - name: applicationID
        in: path
        description: Application ID.
        required: true
        schema:
          type: string
      - name: envOrInsID
        in: path
        description: 'Environment type (e.g., "development", "production") or instance ID.

          '
        required: true
        schema:
          type: string
      responses:
        '200':
          description: JWT templates retrieved successfully.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/JWTTemplate'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
    post:
      operationId: PlatformCreateJWTTemplate
      x-speakeasy-group: platform
      x-speakeasy-name-override: createJWTTemplate
      tags:
      - JWT Templates
      summary: Create a JWT Template
      description: 'Create a new JWT template for an application instance.


        Requires the `jwt_templates:manage` scope.

        '
      security:
      - platform_api_access_token: []
      parameters:
      - name: applicationID
        in: path
        description: Application ID.
        required: true
        schema:
          type: string
      - name: envOrInsID
        in: path
        description: 'Environment type (e.g., "development", "production") or instance ID.

          '
        required: true
        schema:
          type: string
      requestBody:
        description: JWT template data to create.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: JWT template name
                claims:
                  type: object
                  description: JWT template claims in JSON format
                lifetime:
                  type: integer
                  minimum: 30
                  maximum: 315360000
                  description: JWT token lifetime in seconds
                  nullable: true
                allowed_clock_skew:
                  type: integer
                  minimum: 0
                  maximum: 300
                  description: JWT allowed clock skew in seconds
                  nullable: true
                custom_signing_key:
                  type: boolean
                  description: Whether a custom signing key/algorithm is also provided for this template
                signing_algorithm:
                  type: string
                  description: The custom signing algorithm to use when minting JWTs. Required if `custom_signing_key` is `true`.
                  nullable: true
                signing_key:
                  type: string
                  description: The custom signing private key to use when minting JWTs. Required if `custom_signing_key` is `true`.
                  nullable: true
              required:
              - name
              - claims
      responses:
        '200':
          description: JWT template created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JWTTemplate'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /platform/applications/{applicationID}/instances/{envOrInsID}/jwt_templates/{templateID}:
    get:
      operationId: PlatformGetJWTTemplate
      x-speakeasy-group: platform
      x-speakeasy-name-override: getJWTTemplate
      tags:
      - JWT Templates
      summary: Get a JWT Template
      description: 'Retrieve a specific JWT template for an application instance.


        Requires the `jwt_templates:read` scope.

        '
      security:
      - platform_api_access_token: []
      parameters:
      - name: applicationID
        in: path
        description: Application ID.
        required: true
        schema:
          type: string
      - name: envOrInsID
        in: path
        description: 'Environment type (e.g., "development", "production") or instance ID.

          '
        required: true
        schema:
          type: string
      - name: templateID
        in: path
        description: JWT Template ID.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: JWT template retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JWTTemplate'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
    patch:
      operationId: PlatformUpdateJWTTemplate
      x-speakeasy-group: platform
      x-speakeasy-name-override: updateJWTTemplate
      tags:
      - JWT Templates
      summary: Update a JWT Template
      description: 'Update an existing JWT template for an application instance.


        Requires the `jwt_templates:manage` scope.

        '
      security:
      - platform_api_access_token: []
      parameters:
      - name: applicationID
        in: path
        description: Application ID.
        required: true
        schema:
          type: string
      - name: envOrInsID
        in: path
        description: 'Environment type (e.g., "development", "production") or instance ID.

          '
        required: true
        schema:
          type: string
      - name: templateID
        in: path
        description: JWT Template ID.
        required: true
        schema:
          type: string
      requestBody:
        description: JWT template data to update.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: JWT template name
                claims:
                  type: object
                  description: JWT template claims in JSON format
                lifetime:
                  type: integer
                  minimum: 30
                  maximum: 315360000
                  description: JWT token lifetime in seconds
                  nullable: true
                allowed_clock_skew:
                  type: integer
                  minimum: 0
                  maximum: 300
                  description: JWT allowed clock skew in seconds
                  nullable: true
                custom_signing_key:
                  type: boolean
                  description: Whether a custom signing key/algorithm is also provided for this template
                signing_algorithm:
                  type: string
                  description: The custom signing algorithm to use when minting JWTs. Required if `custom_signing_key` is `true`.
                  nullable: true
                signing_key:
                  type: string
                  description: The custom signing private key to use when minting JWTs. Required if `custom_signing_key` is `true`.
                  nullable: true
              required:
              - name
              - claims
      responses:
        '200':
          description: JWT template updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JWTTemplate'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
    delete:
      operationId: PlatformDeleteJWTTemplate
      x-speakeasy-group: platform
      x-speakeasy-name-override: deleteJWTTemplate
      tags:
      - JWT Templates
      summary: Delete a JWT Template
      description: 'Delete a JWT template from an application instance.


        Requires the `jwt_templates:manage` scope.

        '
      security:
      - platform_api_access_token: []
      parameters:
      - name: applicationID
        in: path
        description: Application ID.
        required: true
        schema:
          type: string
      - name: envOrInsID
        in: path
        description: 'Environment type (e.g., "development", "production") or instance ID.

          '
        required: true
        schema:
          type: string
      - name: templateID
        in: path
        description: JWT Template ID.
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/DeletedObject'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
components:
  responses:
    AuthorizationInvalid:
      description: Authorization invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClerkErrors'
    JWTTemplate.List:
      description: List of JWT templates
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/JWTTemplate'
    ClerkErrors:
      description: Request was not successful
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClerkErrors'
    JWTTemplate:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/JWTTemplate'
    AuthenticationInvalid:
      description: Authentication invalid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClerkErrors'
    ResourceNotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClerkErrors'
    DeletedObject:
      description: Deleted Object
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DeletedObject'
    UnprocessableEntity:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClerkErrors'
    PaymentRequired:
      description: Payment required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClerkErrors'
  schemas:
    ClerkError:
      type: object
      properties:
        message:
          type: string
        long_message:
          type: string
        code:
          type: string
        meta:
          type: object
      required:
      - message
      - long_message
      - code
    DeletedObject:
      type: object
      additionalProperties: false
      properties:
        object:
          type: string
        id:
          type: string
        slug:
          type: string
        deleted:
          type: boolean
        external_id:
          type: string
      required:
      - object
      - deleted
    ClerkErrors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ClerkError'
        meta:
          type: object
        clerk_trace_id:
          type: string
      required:
      - errors
    JWTTemplate:
      type: object
      additionalProperties: false
      properties:
        object:
          type: string
          enum:
          - jwt_template
        id:
          type: string
        name:
          type: string
        claims:
          type: object
        lifetime:
          type: integer
        allowed_clock_skew:
          type: integer
        custom_signing_key:
          type: boolean
        signing_algorithm:
          type: string
        created_at:
          type: integer
          format: int64
          description: 'Unix timestamp of creation.

            '
        updated_at:
          type: integer
          format: int64
          description: 'Unix timestamp of last update.

            '
      required:
      - object
      - id
      - name
      - claims
      - lifetime
      - allowed_clock_skew
      - custom_signing_key
      - signing_algorithm
      - created_at
      - updated_at
  parameters:
    OffsetParameter:
      name: offset
      in: query
      description: 'Skip the first `offset` results when paginating.

        Needs to be an integer greater or equal to zero.

        To be used in conjunction with `limit`.'
      required: false
      schema:
        type: integer
        default: 0
        minimum: 0
    LimitParameter:
      name: limit
      in: query
      description: 'Applies a limit to the number of results returned.

        Can be used for paginating the results together with `offset`.'
      required: false
      schema:
        type: integer
        default: 10
        minimum: 1
        maximum: 500
    Paginated:
      name: paginated
      in: query
      description: 'Whether to paginate the results.

        If true, the results will be paginated.

        If false, the results will not be paginated.'
      required: false
      schema:
        type: boolean
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Secret key, obtained under "API Keys" in the Clerk Dashboard.
      bearerFormat: sk_<environment>_<secret value>
externalDocs:
  url: https://clerk.com/docs
x-speakeasy-retries:
  strategy: backoff
  backoff:
    initialInterval: 500
    maxInterval: 60000
    maxElapsedTime: 3600000
    exponent: 1.5
  statusCodes:
  - 5XX
  retryConnectionErrors: true