WorkOS user-management.authentication API

User authentication endpoints.

OpenAPI Specification

workos-user-management-authentication-api-openapi.yml Raw ↑
openapi: 3.1.1
info:
  title: WorkOS admin-portal user-management.authentication API
  description: WorkOS REST API
  version: '1.0'
  contact:
    name: WorkOS
    url: https://workos.com
    email: support@workos.com
  license:
    name: MIT
    url: https://opensource.org/license/MIT
servers:
- url: https://api.workos.com
  description: Production
- url: https://api.workos-test.com
  description: Staging
security:
- bearer: []
tags:
- name: user-management.authentication
  description: User authentication endpoints.
  x-displayName: User Authentication
paths:
  /user_management/authenticate:
    post:
      description: Authenticate a user with a specified [authentication method](/reference/authkit/authentication).
      operationId: UserlandSessionsController_authenticate[0]
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
              - type: object
                properties:
                  client_id:
                    type: string
                    description: The client ID of the application.
                    example: client_01HXYZ123456789ABCDEFGHIJ
                  client_secret:
                    type: string
                    description: The client secret of the application.
                    example: sk_test_....
                  grant_type:
                    type: string
                    const: authorization_code
                  code:
                    type: string
                    description: The authorization code received from the redirect.
                    example: vBqZKaPpsnJlPfXiDqN7b6VTz
                  code_verifier:
                    type: string
                    description: The PKCE code verifier used to derive the code challenge passed to the authorization URL.
                    example: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
                  invitation_token:
                    type: string
                    description: An invitation token to accept during authentication.
                    example: inv_tok_01HXYZ123456789ABCDEFGHIJ
                  ip_address:
                    type: string
                    description: The IP address of the user's request.
                    example: 203.0.113.42
                  device_id:
                    type: string
                    description: A unique identifier for the device.
                    example: device_01HXYZ123456789ABCDEFGHIJ
                  user_agent:
                    type: string
                    description: The user agent string from the user's browser.
                    example: Mozilla/5.0
                required:
                - client_id
                - client_secret
                - grant_type
                - code
              - type: object
                properties:
                  client_id:
                    type: string
                    description: The client ID of the application.
                    example: client_01HXYZ123456789ABCDEFGHIJ
                  client_secret:
                    type: string
                    description: The client secret of the application.
                    example: sk_test_....
                  grant_type:
                    type: string
                    const: password
                  email:
                    type: string
                    description: The user's email address.
                    example: user@example.com
                  password:
                    type: string
                    description: The user's password.
                    example: strong_password_123!
                  invitation_token:
                    type: string
                    description: An invitation token to accept during authentication.
                    example: inv_tok_01HXYZ123456789ABCDEFGHIJ
                  ip_address:
                    type: string
                    description: The IP address of the user's request.
                    example: 203.0.113.42
                  device_id:
                    type: string
                    description: A unique identifier for the device.
                    example: device_01HXYZ123456789ABCDEFGHIJ
                  user_agent:
                    type: string
                    description: The user agent string from the user's browser.
                    example: Mozilla/5.0
                required:
                - client_id
                - client_secret
                - grant_type
                - email
                - password
              - type: object
                properties:
                  client_id:
                    type: string
                    description: The client ID of the application.
                    example: client_01HXYZ123456789ABCDEFGHIJ
                  client_secret:
                    type: string
                    description: The client secret of the application.
                    example: sk_test_....
                  grant_type:
                    type: string
                    const: refresh_token
                  refresh_token:
                    type: string
                    description: The refresh token to exchange for new tokens.
                    example: yAjhKk23hJMM3DaR...
                  organization_id:
                    type: string
                    description: The ID of the organization to scope the session to.
                    example: org_01EHQMYV6MBK39QC5PZXHY59C3
                  ip_address:
                    type: string
                    description: The IP address of the user's request.
                    example: 203.0.113.42
                  device_id:
                    type: string
                    description: A unique identifier for the device.
                    example: device_01HXYZ123456789ABCDEFGHIJ
                  user_agent:
                    type: string
                    description: The user agent string from the user's browser.
                    example: Mozilla/5.0
                required:
                - client_id
                - client_secret
                - grant_type
                - refresh_token
              - type: object
                properties:
                  client_id:
                    type: string
                    description: The client ID of the application.
                    example: client_01HXYZ123456789ABCDEFGHIJ
                  client_secret:
                    type: string
                    description: The client secret of the application.
                    example: sk_test_....
                  grant_type:
                    type: string
                    const: urn:workos:oauth:grant-type:magic-auth:code
                  code:
                    type: string
                    description: The one-time code for Magic Auth authentication.
                    example: '123456'
                  email:
                    type: string
                    description: The user's email address.
                    example: user@example.com
                  invitation_token:
                    type: string
                    description: An invitation token to accept during authentication.
                    example: inv_tok_01HXYZ123456789ABCDEFGHIJ
                  ip_address:
                    type: string
                    description: The IP address of the user's request.
                    example: 203.0.113.42
                  device_id:
                    type: string
                    description: A unique identifier for the device.
                    example: device_01HXYZ123456789ABCDEFGHIJ
                  user_agent:
                    type: string
                    description: The user agent string from the user's browser.
                    example: Mozilla/5.0
                required:
                - client_id
                - client_secret
                - grant_type
                - code
                - email
              - type: object
                properties:
                  client_id:
                    type: string
                    description: The client ID of the application.
                    example: client_01HXYZ123456789ABCDEFGHIJ
                  client_secret:
                    type: string
                    description: The client secret of the application.
                    example: sk_test_....
                  grant_type:
                    type: string
                    const: urn:workos:oauth:grant-type:email-verification:code
                  code:
                    type: string
                    description: The email verification code.
                    example: '123456'
                  pending_authentication_token:
                    type: string
                    description: The pending authentication token from a previous authentication attempt.
                    example: cTDQJTTkTkkVYxbn...
                  ip_address:
                    type: string
                    description: The IP address of the user's request.
                    example: 203.0.113.42
                  device_id:
                    type: string
                    description: A unique identifier for the device.
                    example: device_01HXYZ123456789ABCDEFGHIJ
                  user_agent:
                    type: string
                    description: The user agent string from the user's browser.
                    example: Mozilla/5.0
                required:
                - client_id
                - client_secret
                - grant_type
                - code
                - pending_authentication_token
              - type: object
                properties:
                  client_id:
                    type: string
                    description: The client ID of the application.
                    example: client_01HXYZ123456789ABCDEFGHIJ
                  client_secret:
                    type: string
                    description: The client secret of the application.
                    example: sk_test_....
                  grant_type:
                    type: string
                    const: urn:workos:oauth:grant-type:mfa-totp
                  code:
                    type: string
                    description: The TOTP code from the authenticator app.
                    example: '123456'
                  pending_authentication_token:
                    type: string
                    description: The pending authentication token from a previous authentication attempt.
                    example: cTDQJTTkTkkVYxbn...
                  authentication_challenge_id:
                    type: string
                    description: The ID of the MFA authentication challenge.
                    example: auth_challenge_01HXYZ123456789ABCDEFGHIJ
                  ip_address:
                    type: string
                    description: The IP address of the user's request.
                    example: 203.0.113.42
                  device_id:
                    type: string
                    description: A unique identifier for the device.
                    example: device_01HXYZ123456789ABCDEFGHIJ
                  user_agent:
                    type: string
                    description: The user agent string from the user's browser.
                    example: Mozilla/5.0
                required:
                - client_id
                - client_secret
                - grant_type
                - code
                - pending_authentication_token
                - authentication_challenge_id
              - type: object
                properties:
                  client_id:
                    type: string
                    description: The client ID of the application.
                    example: client_01HXYZ123456789ABCDEFGHIJ
                  client_secret:
                    type: string
                    description: The client secret of the application.
                    example: sk_test_....
                  grant_type:
                    type: string
                    const: urn:workos:oauth:grant-type:organization-selection
                  pending_authentication_token:
                    type: string
                    description: The pending authentication token from a previous authentication attempt.
                    example: cTDQJTTkTkkVYxbn...
                  organization_id:
                    type: string
                    description: The ID of the organization the user selected.
                    example: org_01EHQMYV6MBK39QC5PZXHY59C3
                  ip_address:
                    type: string
                    description: The IP address of the user's request.
                    example: 203.0.113.42
                  device_id:
                    type: string
                    description: A unique identifier for the device.
                    example: device_01HXYZ123456789ABCDEFGHIJ
                  user_agent:
                    type: string
                    description: The user agent string from the user's browser.
                    example: Mozilla/5.0
                required:
                - client_id
                - client_secret
                - grant_type
                - pending_authentication_token
                - organization_id
              - type: object
                properties:
                  client_id:
                    type: string
                    description: The client ID of the application.
                    example: client_01HXYZ123456789ABCDEFGHIJ
                  grant_type:
                    type: string
                    const: urn:ietf:params:oauth:grant-type:device_code
                  device_code:
                    type: string
                    description: The device verification code.
                    example: Ao4fMrDS...
                  ip_address:
                    type: string
                    description: The IP address of the user's request.
                    example: 203.0.113.42
                  device_id:
                    type: string
                    description: A unique identifier for the device.
                    example: device_01HXYZ123456789ABCDEFGHIJ
                  user_agent:
                    type: string
                    description: The user agent string from the user's browser.
                    example: Mozilla/5.0
                required:
                - client_id
                - grant_type
                - device_code
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserlandAuthenticateResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                oneOf:
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: invalid_organization_id
                      const: invalid_organization_id
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: code_challenge_not_found
                      const: code_challenge_not_found
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: invalid_credentials
                      const: invalid_credentials
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: invalid_one_time_code
                      const: invalid_one_time_code
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: one_time_code_previously_used
                      const: one_time_code_previously_used
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: one_time_code_expired
                      const: one_time_code_expired
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: one_time_code_too_many_attempts
                      const: one_time_code_too_many_attempts
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: invalid_pending_authentication_token
                      const: invalid_pending_authentication_token
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    code:
                      type: string
                      description: The error code identifying the type of error.
                      example: user_mismatch
                      const: user_mismatch
                    message:
                      type: string
                      description: A human-readable description of the error.
                      example: Request could not be processed.
                  required:
                  - code
                  - message
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: invalid_client
                      const: invalid_client
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: invalid_client.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: unauthorized_client
                      const: unauthorized_client
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: unauthorized_client.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: invalid_profile
                      const: invalid_profile
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: invalid_profile.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: invitation_invalid
                      const: invitation_invalid
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: invitation_invalid.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: invitation_cannot_be_used_for_email
                      const: invitation_cannot_be_used_for_email
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: invitation_cannot_be_used_for_email.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: authentication_method_not_allowed
                      const: authentication_method_not_allowed
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: authentication_method_not_allowed.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: invalid_connection
                      const: invalid_connection
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: invalid_connection.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: sign_up_not_allowed
                      const: sign_up_not_allowed
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: sign_up_not_allowed.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: organization_authentication_methods_required
                      const: organization_authentication_methods_required
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: organization_authentication_methods_required.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: invalid_link_authorization_code
                      const: invalid_link_authorization_code
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: invalid_link_authorization_code.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: extra_attributes_required
                      const: extra_attributes_required
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: extra_attributes_required.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: pkce_not_supported
                      const: pkce_not_supported
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: pkce_not_supported.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: expired_token
                      const: expired_token
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: expired_token.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: authorization_pending
                      const: authorization_pending
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: authorization_pending.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: access_denied
                      const: access_denied
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: access_denied.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    error:
                      type: string
                      description: The OAuth error code.
                      example: slow_down
                      const: slow_down
                    error_description:
                      type: string
                      description: A human-readable description of the error.
                      example: 'The request failed due to: slow_down.'
                  required:
                  - error
                  - error_description
                - type: object
                  properties:
                    message:
                      type: string
                      const: Must use SSO for selected organization
                  required:
                  - message
                - oneOf:
                  - type: object
                    properties:
                      error:
                        type: string
                        description: The OAuth error code.
                        example: invalid_grant
                        const: invalid_grant
                      error_description:
                        type: string
                        description: A human-readable description of the error.
                        example: 'The request failed due to: invalid_grant.'
                    required:
                    - error
                    - error_description
                  - type: object
                    properties:
                      error:
                        type: string
                        description: The OAuth error code.
                        example: invalid_request
                        const: invalid_request
                      error_description:
                        type: string
                        description: A human-readable description of the error.
                        example: 'The request failed due to: invalid_request.'
                    required:
                    - error
                    - error_description
                  - type: object
                    properties:
                      error:
                        type: string
                        description: The OAuth error code.
                        example: organization_not_found
                        const: organization_not_found
                      error_description:
                        type: string
                        description: A human-readable description of the error.
                        example: 'The request failed due to: organization_not_found.'
                    required:
                    - error
                    - error_description
                  - type: object
                    properties:
                      error:
                        type: string
                        description: The OAuth error code.
                        example: organization_membership_not_found
                        const: organization_membership_not_foun

# --- truncated at 32 KB (60 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/workos/refs/heads/main/openapi/workos-user-management-authentication-api-openapi.yml