Clerk Backend API

The Clerk Backend API is a REST API meant to be accessed by backend servers. It exposes resources for managing users, sessions, organizations, invitations, JWT templates, OAuth applications, SAML connections, M2M tokens, API keys, and billing — wrapped by every official Clerk backend SDK.

Documentation

Specifications

Other Resources

🔗
SpectralRuleset
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/rules/clerk-rules.yml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-actor-tokens.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-agent-tasks.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-allow-list-block-list.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-api-keys.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-beta-features.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-billing.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-clients.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-domains.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-email-addresses.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-email-sms-templates.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-enterprise-connections.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-instance-settings.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-invitations.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-jwks.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-jwt-templates.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-m2m-tokens.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-machines.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-miscellaneous.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-oauth-access-tokens.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-oauth-applications.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-organization-domains.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-organization-invitations.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-organization-memberships.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-organization-permissions.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-organization-roles.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-organizations.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-phone-numbers.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-proxy-checks.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-redirect-urls.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-role-sets.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-saml-connections.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-sessions.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-sign-in-tokens.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-sign-ups.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-testing-tokens.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-users.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-waitlist-entries.yaml
🔗
NaftikoCapability
https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/capabilities/clerk-backend-api-webhooks.yaml

OpenAPI Specification

clerk-backend-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Clerk Backend 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: [email protected]
    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
- name: Allow-list / Block-list
  description: 'Allow-lists and Block-lists allow you to control who can sign up or sign in

    to your application, by restricting access based on the user''s email

    address or phone number.'
  externalDocs:
    url: https://clerk.com/docs/authentication/allowlist
- name: Clients
  description: The Client object tracks sessions, as well as the state of any sign in and sign up attempts, for a given device.
  externalDocs:
    url: https://clerk.com/docs/references/javascript/client
- name: Billing
  description: Billing-related endpoints for managing statements and payment attempts.
  externalDocs:
    url: https://clerk.com/docs/billing/overview
- name: Domains
  description: Domains represent each instance's URLs and DNS setup.
- name: Email Addresses
  description: A user can be associated with one or more email addresses, which allows them to be contacted via email.
  externalDocs:
    url: https://clerk.com/docs/references/javascript/types/email-address
- name: Email & SMS Templates
  description: Email & SMS templates allow you to customize the theming and wording of emails & SMS messages that are sent by your instance.
  externalDocs:
    url: https://clerk.com/docs/authentication/email-sms-templates
- name: Instance Settings
  description: Modify the settings of your instance.
- name: Invitations
  description: Invitations allow you to invite someone to sign up to your application, via email.
  externalDocs:
    url: https://clerk.com/docs/authentication/invitations
- name: JWKS
  description: Retrieve the JSON Web Key Set which can be used to verify the token signatures of the instance.
- 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
- name: OAuth Applications
  description: OAuth applications contain data for clients using Clerk as an OAuth2 identity provider.
- name: OAuth Access Tokens
  description: Endpoints for managing OAuth Access Tokens, which are credentials to access protected resources on behalf of a user.
- name: Organizations
  description: Organizations are used to group members under a common entity and provide shared access to resources.
  externalDocs:
    url: https://clerk.com/docs/organizations/overview
- name: Organization Invitations
  description: Invite users to an organization.
  externalDocs:
    url: https://clerk.com/docs/organizations/invite-users
- name: Organization Memberships
  description: Manage member roles in an organization.
  externalDocs:
    url: https://clerk.com/docs/organizations/manage-member-roles
- name: Organization Permissions
  description: Manage organization permissions that define what members can do within an organization.
  externalDocs:
    url: https://clerk.com/docs/organizations/manage-member-roles
- name: Organization Roles
  description: Manage custom roles in an organization.
  externalDocs:
    url: https://clerk.com/docs/organizations/manage-member-roles
- name: Role Sets
  description: 'Role sets define collections of roles that can be assigned to organization members.

    Each organization uses one role set to determine the available roles for its members.

    Role sets support default roles for new members and creator roles for organization founders.'
  externalDocs:
    url: https://clerk.com/docs/organizations/manage-member-roles
- name: Phone Numbers
  description: A user can be associated with one or more phone numbers, which allows them to be contacted via SMS.
  externalDocs:
    url: https://clerk.com/docs/references/javascript/types/phone-number
- name: Redirect URLs
  description: 'Redirect URLs are whitelisted URLs that facilitate secure authentication flows in native applications (e.g. React Native, Expo).

    In these contexts, Clerk ensures that security-critical nonces are passed only to the whitelisted URLs.'
- name: SAML Connections
  description: 'A SAML Connection holds configuration data required for facilitating a SAML SSO flow between your

    Clerk Instance (SP) and a particular SAML IdP.'
- name: Enterprise Connections
  description: 'An Enterprise Connection holds configuration data required for facilitating an enterprise SSO flow between your

    Clerk instance and an identity provider.'
  externalDocs:
    url: https://clerk.com/docs/guides/configure/auth-strategies/enterprise-connections/overview
- name: Sessions
  description: 'The Session object is an abstraction over an HTTP session.

    It models the period of information exchange between a user and the server.

    Sessions are created when a user successfully goes through the sign in or sign up flows.'
  externalDocs:
    url: https://clerk.com/docs/references/javascript/session
- name: Machines
  description: A Machine represents a machine/server/service which can be used in machine-to-machine authentication.
- name: M2M Tokens
  description: Machine to Machine Tokens are used to manage authentication between Machines.
- name: API Keys
  description: Endpoints for managing API Keys
- name: Sign-in Tokens
  description: 'Sign-in tokens are JWTs that can be used to sign in to an application without specifying any credentials.

    A sign-in token can be used at most once and they can be consumed from the Frontend API using the `ticket` strategy.'
- name: Sign Ups
  description: Sign-up objects track the progress of a sign-up attempt and store any field collected from user input.
  externalDocs:
    url: https://clerk.com/docs/references/javascript/sign-up
- name: Testing Tokens
  description: Tokens meant for use by end-to-end test suites in requests to the Frontend API, so as to bypass bot detection measures.
  externalDocs:
    url: https://clerk.com/docs/testing/overview#testing-tokens
- name: Agent Tasks
  description: Tasks that allow creating user sessions for agent-based interactions.
- name: Users
  description: The user object represents a user that has successfully signed up to your application.
  externalDocs:
    url: https://clerk.com/docs/references/javascript/user
- name: Webhooks
  description: You can configure webhooks to be notified about various events that happen on your instance.
  externalDocs:
    url: https://clerk.com/docs/integration/webhooks
- name: Miscellaneous
  description: Various endpoints that do not belong in any particular category.
- name: Beta Features
  description: Modify instance settings that are currently in beta.
- name: Waitlist Entries
  description: Manage waitlist entries.
- name: Proxy Checks
  description: Check if a user is using a proxy.
- name: Organization Domains
  description: Manage organization domains.
- name: Accountless Applications
  description: Create and complete accountless applications. Note that this is an experimental feature and subject to change or be removed without notice.
externalDocs:
  url: https://clerk.com/docs
paths:
  /public/interstitial:
    get:
      operationId: GetPublicInterstitial
      x-speakeasy-group: miscellaneous
      x-speakeasy-name-override: getPublicInterstitial
      security: []
      summary: Returns the Markup for the Interstitial Page
      description: 'The Clerk interstitial endpoint serves an html page that loads clerk.js in order to check the user''s authentication state.

        It is used by Clerk SDKs when the user''s authentication state cannot be immediately determined.'
      tags:
      - Miscellaneous
      parameters:
      - name: frontendApi
        deprecated: true
        in: query
        required: false
        description: Please use `frontend_api` instead
        schema:
          type: string
      - name: frontend_api
        in: query
        required: false
        description: The Frontend API key of your instance
        schema:
          type: string
      - name: publishable_key
        in: query
        required: false
        description: The publishable key of your instance
        schema:
          type: string
      - name: proxy_url
        in: query
        required: false
        description: The proxy URL of your instance
        schema:
          type: string
      - name: domain
        in: query
        required: false
        description: The domain of your instance
        schema:
          type: string
      - name: sign_in_url
        in: query
        required: false
        description: The sign in URL of your instance
        schema:
          type: string
      - name: use_domain_for_script
        in: query
        required: false
        description: Whether to use the domain for the script URL
        schema:
          type: boolean
      responses:
        '200':
          description: The interstitial page markup
        '400':
          description: A required query parameter is missing
        '500':
          description: An infinite redirect loop was detected
  /jwks:
    get:
      operationId: GetJWKS
      x-speakeasy-group: jwks
      x-speakeasy-name-override: getJWKS
      summary: Retrieve the JSON Web Key Set of the Instance
      description: Retrieve the JSON Web Key Set of the instance
      tags:
      - JWKS
      responses:
        '200':
          $ref: '#/components/responses/WellKnown.JWKS'
  /aws_credentials: {}
  /aws_credentials/{id}: {}
  /clients:
    get:
      deprecated: true
      operationId: GetClientList
      x-speakeasy-group: clients
      x-speakeasy-name-override: list
      tags:
      - Clients
      summary: List All Clients
      description: 'Returns a list of all clients. The clients are returned sorted by creation date,

        with the newest clients appearing first.

        Warning: the endpoint is being deprecated and will be removed in future versions.'
      parameters:
      - $ref: '#/components/parameters/Paginated'
      - $ref: '#/components/parameters/LimitParameter'
      - $ref: '#/components/parameters/OffsetParameter'
      responses:
        '200':
          $ref: '#/components/responses/Client.List'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '410':
          $ref: '#/components/responses/DeprecatedEndpoint'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /clients/verify:
    post:
      operationId: VerifyClient
      x-speakeasy-group: clients
      x-speakeasy-name-override: verify
      tags:
      - Clients
      summary: Verify a Client
      description: Verifies the client in the provided token
      requestBody:
        description: Parameters.
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                token:
                  type: string
                  description: A JWT that represents the active client.
              required:
              - token
      responses:
        '200':
          $ref: '#/components/responses/Client'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
  /clients/{client_id}:
    get:
      operationId: GetClient
      x-speakeasy-group: clients
      x-speakeasy-name-override: get
      tags:
      - Clients
      summary: Get a Client
      description: Returns the details of a client.
      parameters:
      - name: client_id
        in: path
        description: Client ID.
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/Client'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
  /clients/handshake_payload: {}
  /email_addresses:
    post:
      operationId: CreateEmailAddress
      x-speakeasy-group: emailAddresses
      x-speakeasy-name-override: create
      tags:
      - Email Addresses
      summary: Create an Email Address
      description: Create a new email address
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user_id:
                  type: string
                  description: The ID representing the user
                email_address:
                  type: string
                  description: The new email address. Must adhere to the RFC 5322 specification for email address format.
                verified:
                  type: boolean
                  description: When created, the email address will be marked as verified.
                  nullable: true
                primary:
                  type: boolean
                  description: 'Create this email address as the primary email address for the user.

                    Default: false, unless it is the first email address.'
                  nullable: true
              required:
              - user_id
              - email_address
      responses:
        '200':
          $ref: '#/components/responses/EmailAddress'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /email_addresses/{email_address_id}:
    get:
      operationId: GetEmailAddress
      x-speakeasy-group: emailAddresses
      x-speakeasy-name-override: get
      x-speakeasy-usage-example: true
      tags:
      - Email Addresses
      summary: Retrieve an Email Address
      description: Returns the details of an email address.
      parameters:
      - name: email_address_id
        in: path
        description: The ID of the email address to retrieve
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/EmailAddress'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
    delete:
      operationId: DeleteEmailAddress
      x-speakeasy-group: emailAddresses
      x-speakeasy-name-override: delete
      tags:
      - Email Addresses
      summary: Delete an Email Address
      description: Delete the email address with the given ID
      parameters:
      - name: email_address_id
        in: path
        description: The ID of the email address to delete
        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'
        '409':
          $ref: '#/components/responses/Conflict'
    patch:
      operationId: UpdateEmailAddress
      x-speakeasy-group: emailAddresses
      x-speakeasy-name-override: update
      tags:
      - Email Addresses
      summary: Update an Email Address
      description: Updates an email address.
      parameters:
      - name: email_address_id
        in: path
        description: The ID of the email address to update
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                verified:
                  type: boolean
                  description: The email address will be marked as verified.
                  nullable: true
                primary:
                  type: boolean
                  description: Set this email address as the primary email address for the user.
                  nullable: true
      responses:
        '200':
          $ref: '#/components/responses/EmailAddress'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
        '409':
          $ref: '#/components/responses/Conflict'
  /phone_numbers:
    post:
      operationId: CreatePhoneNumber
      x-speakeasy-group: phoneNumbers
      x-speakeasy-name-override: create
      tags:
      - Phone Numbers
      summary: Create a Phone Number
      description: Create a new phone number
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user_id:
                  type: string
                  description: The ID representing the user
                phone_number:
                  type: string
                  description: The new phone number. Must adhere to the E.164 standard for phone number format.
                verified:
                  type: boolean
                  description: When created, the phone number will be marked as verified.
                  nullable: true
                primary:
                  type: boolean
                  description: 'Create this phone number as the primary phone number for the user. Default: false, unless it is the first phone number.'
                  nullable: true
                reserved_for_second_factor:
                  type: boolean
                  description: 'Create this phone number as reserved for multi-factor authentication. The phone number must also be verified.

                    If there are no other reserved second factors, the phone number will be set as the default second factor.'
                  nullable: true
              required:
              - user_id
              - phone_number
      responses:
        '200':
          $ref: '#/components/responses/PhoneNumber'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /phone_numbers/{phone_number_id}:
    get:
      operationId: GetPhoneNumber
      x-speakeasy-group: phoneNumbers
      x-speakeasy-name-override: get
      tags:
      - Phone Numbers
      summary: Retrieve a Phone Number
      description: Returns the details of a phone number
      parameters:
      - name: phone_number_id
        in: path
        description: The ID of the phone number to retrieve
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/PhoneNumber'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
    delete:
      operationId: DeletePhoneNumber
      x-speakeasy-group: phoneNumbers
      x-speakeasy-name-override: delete
      tags:
      - Phone Numbers
      summary: Delete a Phone Number
      description: Delete the phone number with the given ID
      parameters:
      - name: phone_number_id
        in: path
        description: The ID of the phone number to delete
        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'
    patch:
      operationId: UpdatePhoneNumber
      x-speakeasy-group: phoneNumbers
      x-speakeasy-name-override: update
      tags:
      - Phone Numbers
      summary: Update a Phone Number
      description: Updates a phone number
      parameters:
      - name: phone_number_id
        in: path
        description: The ID of the phone number to update
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                verified:
                  type: boolean
                  description: The phone number will be marked as verified.
                  nullable: true
                primary:
                  type: boolean
                  description: Set this phone number as the primary phone number for the user.
                  nullable: true
                reserved_for_second_factor:
                  type: boolean
                  description: 'Set this phone number as reserved for multi-factor authentication.

                    The phone number must also be verified.

                    If there are no other reserved second factors, the phone number will be set as the default second factor.'
                  nullable: true
      responses:
        '200':
          $ref: '#/components/responses/PhoneNumber'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '403':
          $ref: '#/components/responses/AuthorizationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
  /sessions:
    get:
      operationId: GetSessionList
      x-speakeasy-group: sessions
      x-speakeasy-name-override: list
      tags:
      - Sessions
      summary: List All Sessions
      description: 'Returns a list of sessions matching the provided criteria.

        The sessions are returned sorted by creation date, with the newest sessions appearing first.


        Note: This endpoint does not return all sessions that have ever existed. Old and inactive sessions are periodically cleaned up and will not be included in the results.


        **Deprecation Notice (2024-01-01):** All parameters were initially considered optional, however

        moving forward at least one of `client_id` or `user_id` parameters should be provided.'
      parameters:
      - name: client_id
        in: query
        required: false
        description: List sessions for the given client
        schema:
          type: string
      - name: user_id
        in: query
        required: false
        description: List sessions for the given user
        schema:
          type: string
      - name: status
        in: query
        required: false
        description: Filter sessions by the provided status
        schema:
          type: string
          enum:
          - abandoned
          - active
          - ended
          - expired
          - removed
          - replaced
          - revoked
      - $ref: '#/components/parameters/Paginated'
      - $ref: '#/components/parameters/LimitParameter'
      - $ref: '#/components/parameters/OffsetParameter'
      responses:
        '200':
          $ref: '#/components/responses/Session.List'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
    post:
      operationId: createSession
      x-speakeasy-group: sessions
      x-speakeasy-name-override: create
      tags:
      - Sessions
      summary: Create a New Active Session
      description: 'Create a new active session for the provided user ID.


        **This operation is intended only for use in testing, and is not available for production instances.** If you are looking to generate a user session from the backend,

        we recommend using the [Sign-in Tokens](https://clerk.com/docs/reference/backend-api/tag/Sign-in-Tokens#operation/CreateSignInToken) resource instead.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user_id:
                  type: string
                  description: The ID representing the user
                active_organization_id:
                  type: string
                  description: The ID of the organization to set as active for this session
              required:
              - user_id
      responses:
        '200':
          $ref: '#/components/responses/Session'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '404':
          $ref: '#/components/responses/ClerkErrors'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
  /sessions/{session_id}:
    get:
      operationId: GetSession
      x-speakeasy-group: sessions
      x-speakeasy-name-override: get
      tags:
      - Sessions
      summary: Retrieve a Session
      description: Retrieve the details of a session
      parameters:
      - name: session_id
        in: path
        description: The ID of the session
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/Session'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
  /sessions/{session_id}/refresh:
    post:
      operationId: RefreshSession
      x-speakeasy-group: sessions
      x-speakeasy-name-override: refresh
      tags:
      - Sessions
      summary: Refresh a Session
      description: 'Refreshes a session by creating a new session token. A 401 is returned when there

        are validation errors, which signals the SDKs to fall back to the handshake flow.'
      parameters:
      - name: session_id
        in: path
        description: The ID of the session
        required: true
        schema:
          type: string
      requestBody:
        description: Refresh session parameters
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                expired_token:
                  type: string
                  description: 'The JWT that is sent via the `__session` cookie from your frontend.

                    Note: this JWT must be associated with the supplied session ID.'
                refresh_token:
                  type: string
                  description: The refresh token from the `__refresh` cookie set via FAPI's handshake flow.
                request_origin:
                  type: string
                  description: The origin of the request.
                request_headers:
                  type: object
                  additionalProperties: true
                  description: The headers of the request.
                  nullable: true
                format:
                  type: string
                  description: The format of the response.
                  nullable: true
                  default: token
                  enum:
                  - token
                  - cookie
                request_originating_ip:
                  type: string
                  description: The IP address of the request.
                  nullable: true
              required:
              - expired_token
              - refresh_token
              - request_origin
      responses:
        '200':
          $ref: '#/components/responses/Session.Refresh'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
  /sessions/{session_id}/revoke:
    post:
      operationId: RevokeSession
      x-speakeasy-group: sessions
      x-speakeasy-name-override: revoke
      tags:
      - Sessions
      summary: Revoke a Session
      description: 'Sets the status of a session as "revoked", which is an unauthenticated state.

        In multi-session mode, a revoked session will still be returned along with its client object, however the user will need to sign in again.'
      parameters:
      - name: session_id
        in: path
        description: The ID of the session
        required: true
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/Session'
        '400':
          $ref: '#/components/responses/ClerkErrors'
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
  /sessions/{session_id}/tokens:
    post:
      operationId: CreateSessionToken
      x-speakeasy-group: sessions
      x-speakeasy-name-override: createToken
      tags:
      - Sessions
      summary: Create a Session Token
      description: Creates a session JSON Web Token (JWT) based on a session.
      parameters:
      - name: session_id
        in: path
        description: The ID of the session
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                expires_in_seconds:
                  type: integer
                  minimum: 30
                  maximum: 315360000
                  description: Use this parameter to override the default session token lifetime.
                  nullable: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  object:
                    type: string
                    enum:
                    - token
                  jwt:
                    type: string
        '401':
          $ref: '#/components/responses/AuthenticationInvalid'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
  /sessions/{session_id}/tokens/{template_name}:
    post:
      operationId: CreateSessionTokenFromTemplate
      x-speakeasy-group: sessions
      x-speakeasy-name-override: createTokenFromTemplate
      tags:
      - Sessions
      summary: Create a Session Token from a JWT Template
      description: Creates a JSON Web Token (JWT) based on a session and a JWT Template name defined for your instance
      parameters:
      - name: session_id
        in: path
        description: The ID of the session
        re

# --- truncated at 32 KB (584 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/clerk-com/refs/heads/main/openapi/clerk-backend-api-openapi.yml