Skip to content

API Keys

Personal Access Tokens (PATs) are long-lived API keys for programmatic access. You can create them via the GEN dashboard or through these endpoints.

{
"id": 5,
"name": "CI Pipeline",
"token_type": "personal_access_token",
"created_at": "2026-03-01T12:00:00.000Z",
"expires_at": "2026-06-01T12:00:00.000Z",
"last_used_at": "2026-03-09T08:15:00.000Z",
"revoked_at": null,
"status": "active"
}

The status field is one of: active, expired, revoked.


Returns all PATs for the authenticated user.

GET /v1/persisted_tokens

None.

[
{
"id": 5,
"name": "CI Pipeline",
"token_type": "personal_access_token",
"created_at": "2026-03-01T12:00:00.000Z",
"expires_at": "2026-06-01T12:00:00.000Z",
"last_used_at": "2026-03-09T08:15:00.000Z",
"revoked_at": null,
"status": "active"
}
]
Terminal window
curl https://api.gen.pro/v1/persisted_tokens \
-H "X-API-Key: your-api-key"

Creates a new PAT. The response includes a token field with the plain-text key.

POST /v1/persisted_tokens
FieldTypeRequiredDescription
namestringNoA label for the key (e.g., "n8n production").
expires_instringNoDuration until expiry (e.g., "30d", "90d"). Omit for no expiration.
{
"id": 6,
"name": "n8n production",
"token": "gen_pat_abc123def456...",
"token_type": "personal_access_token",
"created_at": "2026-03-09T10:00:00.000Z",
"expires_at": "2026-06-07T10:00:00.000Z",
"last_used_at": null,
"revoked_at": null,
"status": "active"
}
Terminal window
curl -X POST https://api.gen.pro/v1/persisted_tokens \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"name": "n8n production", "expires_in": "90d"}'

Updates the name of an existing PAT.

PATCH /v1/persisted_tokens/{id}
ParameterTypeDescription
idintegerThe token ID.
{
"persisted_token": {
"name": "Updated name"
}
}

Returns the updated token object (without the plain-text token field).

Terminal window
curl -X PATCH https://api.gen.pro/v1/persisted_tokens/6 \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{"persisted_token": {"name": "Updated name"}}'
StatusError codeDescription
404not_foundToken not found or not owned by you.

Immediately invalidates a single PAT.

DELETE /v1/persisted_tokens/{id}/revoke
ParameterTypeDescription
idintegerThe token ID to revoke.

No content.

Terminal window
curl -X DELETE https://api.gen.pro/v1/persisted_tokens/6/revoke \
-H "X-API-Key: your-api-key"
StatusError codeDescription
404not_foundToken not found or not owned by you.

Immediately invalidates all PATs for the authenticated user.

DELETE /v1/persisted_tokens/revoke_all

No content.

Terminal window
curl -X DELETE https://api.gen.pro/v1/persisted_tokens/revoke_all \
-H "X-API-Key: your-api-key"