Skip to content
Open in

Adding tokens on demand ​

The token management API lets you create plugin API tokens, delete them, and change which domains each token is allowed to run on, without opening the dashboard.

This is aimed at multi-tenant setups. On a CRM platform where each customer runs on their own subdomain, a new customer's subdomain (newcustomer.yourcrm.com) can be added to an existing token as they sign up, and a departing customer's token can be deleted to revoke access.

How it works ​

1. Get an API key ​

These endpoints authenticate with an API key from your account settings. Open Settings, go to API Tokens, select "Create API Token", and grant the token the permissions it needs. A token carries any of four permissions, read, create, update, and delete, and each endpoint checks the matching one.

2. Set the request headers ​

Every request carries these two headers:

json
{
  "accept": "application/json",
  "Authorization": "Bearer <api-key>"
}

Servers​

https://app.topol.io/apiProduction server

Get a list of API tokens​

GET
/api-tokens

Retrieve a list of API tokens

Authorizations​

BearerAuth

Use: Authorization: Bearer <api-key>

Type
HTTP (bearer)

Responses​

API tokens fetched successfully

application/json
JSON
{
  
"success": true,
  
"data": [
  
  
{
  
  
  
"id": "0001f41e-a4b8-3e73-8d65-2b8500b54ff0",
  
  
  
"name": "New API Token",
  
  
  
"token": "4e5f6g7h8i9j0k1l2m3n",
  
  
  
"domains": "example.com,anotherdomain.com",
  
  
  
"created_at": "2024-01-15T12:34:56Z"
  
  
}
  
]
}

Playground​

Authorization

Samples​


Create a new API token​

POST
/api-tokens

Create a new API token

Authorizations​

BearerAuth

Use: Authorization: Bearer <api-key>

Type
HTTP (bearer)

Request Body​

application/json
JSON
{
  
"name": "New API Token",
  
"domains": "example.com,anotherdomain.com"
}

Responses​

API token created successfully

application/json
JSON
{
  
"data": {
  
  
"id": "0001f41e-a4b8-3e73-8d65-2b8500b54ff0",
  
  
"name": "New API Token",
  
  
"token": "4e5f6g7h8i9j0k1l2m3n",
  
  
"domains": "example.com,anotherdomain.com",
  
  
"created_at": "2024-01-15T12:34:56Z",
  
  
"settings": {
  
  
}
  
}
}

Playground​

Authorization
Body

Samples​


Get an API token​

GET
/api-tokens/{apiTokenId}

Get an existing API token

Authorizations​

BearerAuth

Use: Authorization: Bearer <api-key>

Type
HTTP (bearer)

Parameters​

Path Parameters

apiTokenId*

API token ID

Type
string
Required

Responses​

API token retrieved successfully

application/json
JSON
{
  
"data": {
  
  
"id": "0001f41e-a4b8-3e73-8d65-2b8500b54ff0",
  
  
"name": "New API Token",
  
  
"token": "4e5f6g7h8i9j0k1l2m3n",
  
  
"domains": "example.com,anotherdomain.com",
  
  
"created_at": "2024-01-15T12:34:56Z",
  
  
"settings": {
  
  
}
  
}
}

Playground​

Authorization
Variables
Key
Value

Samples​


Delete an API token​

DELETE
/api-tokens/{apiTokenId}

Delete an existing API token

Authorizations​

BearerAuth

Use: Authorization: Bearer <api-key>

Type
HTTP (bearer)

Parameters​

Path Parameters

apiTokenId*

API token ID

Type
string
Required

Responses​

API token deleted successfully

application/json
JSON
{
  
"success": true
}

Playground​

Authorization
Variables
Key
Value

Samples​


Add domains to an API token​

POST
/api-tokens/{apiTokenId}/add-domains

Add domains to an existing API token

Authorizations​

BearerAuth

Use: Authorization: Bearer <api-key>

Type
HTTP (bearer)

Parameters​

Path Parameters

apiTokenId*

API token ID

Type
string
Required

Request Body​

application/json
JSON
{
  
"domains": "newdomain.com, anothernewdomain.com"
}

Responses​

API token deleted successfully

application/json
JSON
{
  
"data": {
  
  
"id": "0001f41e-a4b8-3e73-8d65-2b8500b54ff0",
  
  
"name": "New API Token",
  
  
"token": "4e5f6g7h8i9j0k1l2m3n",
  
  
"domains": "example.com,anotherdomain.com",
  
  
"created_at": "2024-01-15T12:34:56Z",
  
  
"settings": {
  
  
}
  
}
}

Playground​

Authorization
Variables
Key
Value
Body

Samples​


Remove domains from an API token​

POST
/api-tokens/{apiTokenId}/delete-domains

Remove domains from an existing API token

Authorizations​

BearerAuth

Use: Authorization: Bearer <api-key>

Type
HTTP (bearer)

Parameters​

Path Parameters

apiTokenId*

API token ID

Type
string
Required

Request Body​

application/json
JSON
{
  
"domains": "newdomain.com, anothernewdomain.com"
}

Responses​

API token updated successfully

application/json
JSON
{
  
"data": {
  
  
"id": "0001f41e-a4b8-3e73-8d65-2b8500b54ff0",
  
  
"name": "New API Token",
  
  
"token": "4e5f6g7h8i9j0k1l2m3n",
  
  
"domains": "example.com,anotherdomain.com",
  
  
"created_at": "2024-01-15T12:34:56Z",
  
  
"settings": {
  
  
}
  
}
}

Playground​

Authorization
Variables
Key
Value
Body

Samples​


Update storage settings for an API token​

PUT
/api-tokens/{apiTokenId}/storage

Update storage settings for an existing API token

Authorizations​

BearerAuth

Use: Authorization: Bearer <api-key>

Type
HTTP (bearer)

Parameters​

Path Parameters

apiTokenId*

API token ID

Type
string
Required

Request Body​

application/json
JSON
{
  
"settings": {
  
  
"aws": true,
  
  
"access_key": "my-access-key",
  
  
"private_key": "my-private-key",
  
  
"name": "my-bucket",
  
  
"region": "us-east-1",
  
  
"url": "https://s3.custom-endpoint.com"
  
}
}

Responses​

API token storage updated successfully

application/json
JSON
{
  
"data": {
  
  
"id": "0001f41e-a4b8-3e73-8d65-2b8500b54ff0",
  
  
"name": "New API Token",
  
  
"token": "4e5f6g7h8i9j0k1l2m3n",
  
  
"domains": "example.com,anotherdomain.com",
  
  
"created_at": "2024-01-15T12:34:56Z",
  
  
"settings": {
  
  
}
  
}
}

Playground​

Authorization
Variables
Key
Value
Body

Samples​


Delete an API token storage settings​

DELETE
/api-tokens/{apiTokenId}/storage

Delete an existing API token storage settings

Authorizations​

BearerAuth

Use: Authorization: Bearer <api-key>

Type
HTTP (bearer)

Parameters​

Path Parameters

apiTokenId*

API token ID

Type
string
Required

Responses​

API token storage deleted successfully

application/json
JSON
{
  
"data": {
  
  
"id": "0001f41e-a4b8-3e73-8d65-2b8500b54ff0",
  
  
"name": "New API Token",
  
  
"token": "4e5f6g7h8i9j0k1l2m3n",
  
  
"domains": "example.com,anotherdomain.com",
  
  
"created_at": "2024-01-15T12:34:56Z",
  
  
"settings": {
  
  
}
  
}
}

Playground​

Authorization
Variables
Key
Value

Samples​


Powered by VitePress OpenAPI