Clerk Actor Tokens API

Allow your users to sign in on behalf of other users.

OpenAPI Specification

clerk-com-actor-tokens-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Clerk Backend Account Portal Actor Tokens 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: Actor Tokens
  description: Allow your users to sign in on behalf of other users.
  externalDocs:
    url: https://clerk.com/docs/authentication/user-impersonation#actor-tokens
paths:
  /actor_tokens:
    post:
      operationId: CreateActorToken
      x-speakeasy-group: actorTokens
      x-speakeasy-name-override: create
      summary: Create Actor Token
      description: 'Create an actor token that can be used to impersonate the given user.

        The `actor` parameter needs to include at least a "sub" key whose value is the ID of the actor (impersonating) user.'
      tags:
      - Actor Tokens
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                user_id:
                  type: string
                  description: The ID of the user being impersonated.
                actor:
                  type: object
                  additionalProperties: true
                  description: 'The actor payload. It needs to include a sub property which should contain the ID of the actor.

                    This whole payload will be also included in the JWT session token.'
                  properties:
                    sub:
                      type: string
                      description: The ID of the actor.
                  required:
                  - sub
                  example:
                    sub: user_2OEpKhcCN1Lat9NQ0G6puh7q5Rb
                expires_in_seconds:
                  type: integer
                  description: 'Optional parameter to specify the life duration of the actor token in seconds.

                    By default, the duration is 1 hour.'
                  default: 3600
                session_max_duration_in_seconds:
                  type: integer
                  description: 'The maximum duration that the session which will be created by the generated actor token should last.

                    By default, the duration of a session created via an actor token, lasts 30 minutes.'
                  default: 1800
              required:
              - user_id
              - actor
      responses:
        '200':
          $ref: '#/components/responses/ActorToken'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /actor_tokens/{actor_token_id}/revoke:
    post:
      x-speakeasy-group: actorTokens
      x-speakeasy-name-override: revoke
      summary: Revoke Actor Token
      description: Revokes a pending actor token.
      operationId: RevokeActorToken
      tags:
      - Actor Tokens
      parameters:
      - name: actor_token_id
        in: path
        description: The ID of the actor token to be revoked.
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/ActorToken'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
components:
  schemas:
    ClerkError:
      type: object
      properties:
        message:
          type: string
        long_message:
          type: string
        code:
          type: string
        meta:
          type: object
      required:
      - message
      - long_message
      - code
    ClerkErrors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ClerkError'
        meta:
          type: object
        clerk_trace_id:
          type: string
      required:
      - errors
    ActorToken:
      type: object
      additionalProperties: false
      properties:
        object:
          type: string
          enum:
          - actor_token
        id:
          type: string
        status:
          type: string
          enum:
          - pending
          - accepted
          - revoked
        user_id:
          type: string
        actor:
          type: object
        token:
          type: string
        url:
          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
      - user_id
      - actor
      - status
      - created_at
      - updated_at
  responses:
    ClerkErrors:
      description: Request was not successful
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClerkErrors'
    ActorToken:
      description: Success
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ActorToken'
    ResourceNotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClerkErrors'
    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'
  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