Create one-time token

Add MCP server to your AI tool

Allow AI tools and LLMs to interact with the API documentation portal through MCP.

MCP server URL

https://openapi.logto.io/mcp

Standard setup for AI tools providing an mcp.json file

mcp.json
{
  "Logto API references MCP server": {
    "url": "https://openapi.logto.io/mcp"
  }
}

Close
POST /api/one-time-tokens

Create a new one-time token associated with an email address. The token can be used for verification purposes and has an expiration time.

application/json

Body Required

  • email string Required

    The email address to associate with the one-time token.

    Minimum length is 1, maximum length is 128.

  • context object

    Additional context to store with the one-time token. Set interactionEvent to scope the token to a specific flow, such as ForgotPassword for reset-password magic links.

    Hide context attributes Show context attributes object
    • jitOrganizationIds array[string]

      Organizations to add the user to when the token is used. All IDs must exist when creating the token; otherwise, the request returns 400 request.invalid_input. Organizations deleted before the token is used are skipped.

    • jitOrganizationRoles array[object]

      The organization roles to assign to the user when the token is used, instead of the default JIT roles of the given organizations. Each organization must be in jitOrganizationIds and appear only once, and an empty organizationRoleIds assigns no roles. Organizations in jitOrganizationIds without an entry keep their default JIT roles. Only organization roles for users are accepted, and roles deleted before the token is used are skipped. Existing members keep their current roles; the given roles are added.

      Hide jitOrganizationRoles attributes Show jitOrganizationRoles attributes object
      • organizationId string Required
      • organizationRoleIds array[string] Required
    • interactionEvent string

      Values are SignIn, Register, or ForgotPassword.

  • expiresIn number

    The expiration time in seconds. If not provided, defaults to 10 mins (600 seconds).

Responses

  • 201 application/json

    The one-time token was created successfully.

    Hide response attributes Show response attributes object
    • tenantId string Required

      Maximum length is 64.

    • id string Required

      Minimum length is 1, maximum length is 21.

    • email string Required

      Minimum length is 1, maximum length is 128.

    • token string Required

      Minimum length is 1, maximum length is 256.

    • context object Required
      Hide context attributes Show context attributes object
      • jitOrganizationIds array[string]
      • jitOrganizationRoles array[object]

        The organization roles to assign to the user when the token is used, instead of the default JIT roles of the given organizations.

        Hide jitOrganizationRoles attributes Show jitOrganizationRoles attributes object
        • organizationId string Required
        • organizationRoleIds array[string] Required
      • interactionEvent string

        Values are SignIn, Register, or ForgotPassword.

    • status string Required

      Values are active, consumed, revoked, or expired.

    • createdAt number Required
    • expiresAt number Required
  • 400

    Bad Request

  • 401

    Unauthorized

  • 403

    Forbidden

POST /api/one-time-tokens
curl \
 --request POST 'https://[tenant_id].logto.app/api/one-time-tokens' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "email": "string",
  "context": {
    "jitOrganizationIds": [
      "string"
    ],
    "jitOrganizationRoles": [
      {
        "organizationId": "string",
        "organizationRoleIds": [
          "string"
        ]
      }
    ],
    "interactionEvent": "SignIn"
  },
  "expiresIn": 42.0
}'
Request examples
{
  "email": "string",
  "context": {
    "jitOrganizationIds": [
      "string"
    ],
    "jitOrganizationRoles": [
      {
        "organizationId": "string",
        "organizationRoleIds": [
          "string"
        ]
      }
    ],
    "interactionEvent": "SignIn"
  },
  "expiresIn": 42.0
}
Response examples (201)
{
  "tenantId": "string",
  "id": "string",
  "email": "string",
  "token": "string",
  "context": {
    "jitOrganizationIds": [
      "string"
    ],
    "jitOrganizationRoles": [
      {
        "organizationId": "string",
        "organizationRoleIds": [
          "string"
        ]
      }
    ],
    "interactionEvent": "SignIn"
  },
  "status": "active",
  "createdAt": 42.0,
  "expiresAt": 42.0
}