openapi: 3.1.1 info: title: WorkOS admin-portal user-management.magic-auth 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.magic-auth description: Magic auth endpoints. x-displayName: Magic Auth paths: /user_management/magic_auth: post: description: Creates a one-time authentication code that can be sent to the user's email address. The code expires in 10 minutes. To verify the code, [authenticate the user with Magic Auth](/reference/authkit/authentication/magic-auth). operationId: UserlandMagicAuthController_sendMagicAuthCodeAndReturn parameters: [] requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateUserlandMagicCodeAndReturnDto' responses: '201': description: Created content: application/json: schema: $ref: '#/components/schemas/MagicAuth' '400': description: Bad Request content: application/json: schema: oneOf: - 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: 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: 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 '422': description: Unprocessable Entity content: application/json: schema: type: object properties: message: type: string description: A human-readable description of the error. example: 'Organization not found: ''org_01EHQMYV6MBK39QC5PZXHY59C3''.' required: - message '429': description: '' content: application/json: schema: type: object properties: code: type: string description: The error code identifying the type of error. example: daily_quota_exceeded const: daily_quota_exceeded message: type: string description: A human-readable description of the error. example: Request could not be processed. required: - code - message summary: Create a Magic Auth Code tags: - user-management.magic-auth x-sends-email: true /user_management/magic_auth/{id}: get: description: Get the details of an existing [Magic Auth](/reference/authkit/magic-auth) code that can be used to send an email to a user for authentication. operationId: UserlandMagicAuthController_get parameters: - name: id required: true in: path description: The unique ID of the Magic Auth code. schema: example: magic_auth_01HWZBQZY2M3AMQW166Q22K88F type: string responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/MagicAuth' '404': description: Not Found content: application/json: schema: type: object properties: message: type: string description: A human-readable description of the error. example: 'Organization not found: ''org_01EHQMYV6MBK39QC5PZXHY59C3''.' required: - message summary: Get Magic Auth Code Details tags: - user-management.magic-auth components: schemas: MagicAuth: type: object properties: object: type: string description: Distinguishes the Magic Auth object. const: magic_auth id: type: string description: The unique ID of the Magic Auth code. example: magic_auth_01HWZBQZY2M3AMQW166Q22K88F user_id: type: string description: The unique ID of the user. example: user_01E4ZCR3C56J083X43JQXF3JK5 email: type: string description: The email address of the user. example: marcelina.davis@example.com expires_at: format: date-time type: string description: The timestamp when the Magic Auth code expires. example: '2026-01-15T12:00:00.000Z' created_at: format: date-time type: string description: An ISO 8601 timestamp. example: '2026-01-15T12:00:00.000Z' updated_at: format: date-time type: string description: An ISO 8601 timestamp. example: '2026-01-15T12:00:00.000Z' code: type: string description: The code used to verify the Magic Auth code. example: '123456' required: - object - id - user_id - email - expires_at - created_at - updated_at - code CreateUserlandMagicCodeAndReturnDto: type: object properties: email: type: string format: email description: The email address to send the magic code to. example: marcelina.davis@example.com invitation_token: type: string description: The invitation token to associate with this magic code. example: Z1Y2X3W4V5U6T7S8R9Q0P1O2N3 required: - email securitySchemes: bearer: scheme: bearer bearerFormat: JWT type: http description: 'Your WorkOS API key prefixed with `sk_`. Pass it as a Bearer token: `Authorization: Bearer sk_example_123456789`.' access_token: scheme: bearer bearerFormat: JWT type: http description: An SSO access token returned from the Get a Profile and Token endpoint.