Skip to content
LydieDevelopers
Menu

Create an API token

View as Markdown
POST/v1/workspaces/{workspaceId}/api-tokens

Creates a personal API token for one workspace. The secret is returned once; send it as Authorization: Bearer <secret> to /v1 operation routes or /mcp. It acts as you, limited to this workspace and the given scopes (default: read and write).

Request
curl -X POST "https://api.lydie.co/v1/workspaces/01JCQ3TZ0WJ8K4M2X7T9R6N1PA/api-tokens" \
  -H "Authorization: Bearer $LYDIE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Sync script",
    "scopes": [
      "docs:read"
    ]
  }'

Path parameters

Body

  • namestringrequired· 1–100 chars
  • scopesstring[]· ≥ 1 items

    Default ["docs:read","docs:write"]

  • expiresInDaysinteger· 1–3650

Response

200
{
  "token": {
    "id": "string",
    "workspaceId": "01JCQ3TZ0WJ8K4M2X7T9R6N1PA",
    "name": "Notes",
    "prefix": "string",
    "scopes": [
      "docs:read"
    ],
    "createdAt": "string",
    "lastUsedAt": null,
    "expiresAt": null
  },
  "secret": "string"
}

Errors use one envelope for every endpoint. See Errors and versions.