Skip to content

Adding Tokens on Demand

Topol lets you manage your plugin API tokens dynamically using an API. This means you can create new tokens, delete old ones, and update which domains are allowed to use each token — all without logging into the dashboard every time.

Why Would You Use This?

Imagine you run a CRM platform with many customers (tenants). When a new customer joins, you want to give them access to the editor—but only on their specific subdomain (like newcustomer.yourcrm.com). Using this API, you can add that subdomain to your existing token easily.

Or, if a customer leaves, you can remove their access by deleting their token.

How Does It Work?

1. Get an API Key

You need an API key to call these token management APIs. You can get it either from your account settings or from your existing Plugin API Token settings.

When using an API key from your account settings, you can set various permissions. Go to Settings, then navigate to API Tokens. From there, select "Create API Token" and specify the permissions you wish to grant to this token.

If you prefer to use the same existing Plugin API token that was used to initialize your Plugin, simply copy it from the Plugin Settings under "Show API key".

2. Set API Request Headers

When making requests, include these 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>

TypeHTTP (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

cURL
JavaScript
PHP
Python

Create a new API token

POST
/api-tokens

Create a new API token

Authorizations

BearerAuth

Use: Authorization: Bearer <api-key>

TypeHTTP (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

cURL
JavaScript
PHP
Python

Get an API token

GET
/api-tokens/{apiTokenId}

Get an existing API token

Authorizations

BearerAuth

Use: Authorization: Bearer <api-key>

TypeHTTP (bearer)

Parameters

Path Parameters

apiTokenId*

API token ID

Typestring
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

cURL
JavaScript
PHP
Python

Delete an API token

DELETE
/api-tokens/{apiTokenId}

Delete an existing API token

Authorizations

BearerAuth

Use: Authorization: Bearer <api-key>

TypeHTTP (bearer)

Parameters

Path Parameters

apiTokenId*

API token ID

Typestring
Required

Responses

API token deleted successfully

application/json
JSON
{
"success": true
}

Playground

Authorization
Variables
Key
Value

Samples

cURL
JavaScript
PHP
Python

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>

TypeHTTP (bearer)

Parameters

Path Parameters

apiTokenId*

API token ID

Typestring
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

cURL
JavaScript
PHP
Python

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>

TypeHTTP (bearer)

Parameters

Path Parameters

apiTokenId*

API token ID

Typestring
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

cURL
JavaScript
PHP
Python

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>

TypeHTTP (bearer)

Parameters

Path Parameters

apiTokenId*

API token ID

Typestring
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

cURL
JavaScript
PHP
Python

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>

TypeHTTP (bearer)

Parameters

Path Parameters

apiTokenId*

API token ID

Typestring
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

cURL
JavaScript
PHP
Python

Powered by VitePress OpenAPI