Create one-time token

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. This can be used to store arbitrary data that will be associated with the token.

    Additional properties are allowed.

    Hide context attribute Show context attribute object
  • The expiration time in seconds. If not provided, defaults to 2 days (172,800 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 21.

    • 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

      Additional properties are allowed.

      Hide context attribute Show context attribute object
    • status string Required

      Values are active, consumed, revoked, or expired.

    • createdAt number Required
    • expiresAt number Required
  • Bad Request

  • Unauthorized

  • 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"]},"expiresIn":42.0}'
Request examples
{
  "email": "string",
  "context": {
    "jitOrganizationIds": [
      "string"
    ]
  },
  "expiresIn": 42.0
}
Response examples (201)
{
  "tenantId": "string",
  "id": "string",
  "email": "string",
  "token": "string",
  "context": {
    "jitOrganizationIds": [
      "string"
    ]
  },
  "status": "active",
  "createdAt": 42.0,
  "expiresAt": 42.0
}