Skip to main content

API Tokens

Endpoints for managing API tokens for programmatic access.

GET /api/tokens

List API tokens with optional filtering.

Authentication: Required

Query Parameters:

ParameterTypeDescription
reportIdstringFilter by report ID
datasourceIdstringFilter by datasource ID
assistantIdstringFilter by assistant ID
visualIdstringFilter by visual ID
datasetIdstringFilter by dataset ID
queryIdstringFilter by query ID
usernamestringFilter by username

Response:

{
"_links": {
"self": { "href": "/api/tokens" }
},
"_embedded": {
"inf:token": [
{
"id": "abc123-token-id",
"username": "admin",
"type": "personal",
"notes": "API integration token",
"token": "i5t_abc123...",
"readOnly": false,
"restrict": "cidr",
"cidr": "192.168.1.0/24",
"reportId": null,
"datasourceId": null,
"assistantId": "assistant-123",
"createdAt": "2024-01-15T10:00:00Z",
"data": {
"customField": "value"
},
"_links": {
"self": { "href": "/api/tokens/abc123-token-id" }
}
}
]
},
"start": 0,
"count": 1,
"total": 1
}

POST /api/tokens

Create a new API token.

Authentication: Required

Permission: tokens:create

Request Body:

FieldTypeRequiredDescription
typestringYesToken type (e.g., personal, assistant)
notesstringNoToken description or notes
readOnlybooleanNoRestrict to read-only operations (default: false)
restrictstringNoRestriction type: host or cidr
hoststringNoAllowed hostname (if restrict: 'host')
cidrstringNoCIDR range (if restrict: 'cidr')
reportIdstringNoAssociated report ID
datasourceIdstringNoAssociated datasource ID
assistantIdstringNoAssociated assistant ID
visualIdstringNoAssociated visual ID
datasetIdstringNoAssociated dataset ID
queryIdstringNoAssociated query ID
dataobjectNoCustom metadata object

Example Request:

{
"type": "personal",
"notes": "Production API integration",
"readOnly": false,
"restrict": "cidr",
"cidr": "10.0.0.0/8",
"assistantId": "assistant-123"
}

Response:

{
"id": "new-token-id",
"username": "admin",
"type": "personal",
"notes": "Production API integration",
"token": "i5t_newly_generated_token_value",
"readOnly": false,
"restrict": "cidr",
"cidr": "10.0.0.0/8",
"assistantId": "assistant-123",
"createdAt": "2024-02-09T10:00:00Z",
"_links": {
"self": { "href": "/api/tokens/new-token-id" }
}
}

Status: 201 Created

Location Header: Set to the new token's URL

Token Security

The token value is only returned once upon creation. Store it securely - it cannot be retrieved later.


GET /api/tokens/{id}

Retrieve a specific API token.

Authentication: Required

Path Parameters:

ParameterTypeDescription
idstringToken UUID

Response:

{
"id": "abc123-token-id",
"username": "admin",
"type": "personal",
"notes": "API integration token",
"readOnly": false,
"restrict": "host",
"host": "api.example.com",
"createdAt": "2024-01-15T10:00:00Z",
"data": {},
"_links": {
"self": { "href": "/api/tokens/abc123-token-id" }
}
}
Token Value Not Included

The actual token value is NOT returned in GET requests. It is only provided upon creation.


PUT /api/tokens/{id}

Update an API token's metadata.

Authentication: Required

Path Parameters:

ParameterTypeDescription
idstringToken UUID (required)

Request Body:

FieldTypeDescription
notesstringUpdate token notes/description
dataobjectUpdate custom metadata
readOnlybooleanChange read-only status
restrictstringUpdate restriction type: host, cidr, or null
hoststringUpdate allowed hostname
cidrstringUpdate CIDR range

Example Request:

{
"notes": "Updated notes",
"readOnly": true,
"restrict": "host",
"host": "secure.example.com"
}

Response:

Returns the updated token object.


DELETE /api/tokens/{id}

Revoke an API token.

Authentication: Required

Path Parameters:

ParameterTypeDescription
idstringToken UUID

Response:

204 No Content

Permanent Revocation

Deleting a token immediately revokes access. This cannot be undone. Any requests using the token will fail with 401 Unauthorized.


GET /api/token-types

List available token types and their templates.

Authentication: Required

Response:

{
"_links": {
"self": { "href": "/api/token-types" }
},
"_embedded": {
"inf:token-type": [
{
"id": "personal",
"name": "Personal Access Token",
"description": "General purpose API token"
},
{
"id": "assistant",
"name": "Assistant Token",
"description": "Token for assistant API access"
}
]
},
"start": 0,
"count": 2,
"total": 2
}

GET /api/token-types/{id}

Get details for a specific token type.

Authentication: Required

Path Parameters:

ParameterTypeDescription
idstringToken type ID

Response:

{
"id": "personal",
"name": "Personal Access Token",
"description": "General purpose API token",
"fields": [
{
"name": "notes",
"type": "string",
"required": false
}
]
}

GET /api/token-templates

Get token templates for UI generation.

Authentication: Required

Response:

Array of token template objects with field definitions.