Create a personal access 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/my-account/personal-access-tokens

Create a personal access token for the signed-in user. A logto-verification-id in header and the personal-access-tokens scope are required. The token secret value is returned only in this response. The expiration time is required, must be in the future, and must be at most 365 days from now. A user can have at most 20 unexpired personal access tokens.

application/json

Body Required

  • name string Required

    The name of the token. It must be unique among the user's personal access tokens.

    Minimum length is 1, maximum length is 256.

  • expiresAt number Required

    The epoch time in milliseconds when the token expires. It must be in the future and at most 365 days from now.

Responses

  • 201 application/json

    The personal access token was created successfully. The response includes the token secret value, which cannot be retrieved again.

    Hide response attributes Show response attributes object
    • name string Required

      Minimum length is 1, maximum length is 256.

    • createdAt number Required
    • expiresAt number | null Required
    • value string Required

      Minimum length is 1, maximum length is 64.

  • 400

    The request body is invalid, the personal access token field is not editable in the account center, or the expiration time is not in the future or more than 365 days from now.

  • 401

    Permission denied, the verification record is invalid or the access token does not include the personal-access-tokens scope.

  • 403

    The request was made by a third-party application.

  • 422

    The token name already exists, or the user has reached the maximum number of unexpired personal access tokens.

POST /api/my-account/personal-access-tokens
curl \
 --request POST 'https://[tenant_id].logto.app/api/my-account/personal-access-tokens' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{
  "name": "string",
  "expiresAt": 42.0
}'
Request examples
{
  "name": "string",
  "expiresAt": 42.0
}
Response examples (201)
{
  "name": "string",
  "createdAt": 42.0,
  "expiresAt": 42.0,
  "value": "string"
}