Skip to main content

Manage API Tokens

If you're an Enterprise or Pro plan subscriber (or during your trial period), your account includes API access. You can reference the API guide and Terraform Logz.io Provider guide to help you build integrations with Logz.io.

API tokens are unique to each account. The only exception is a subset of account configuration operations that must be run with the API token of the main account.

From your account, go to the Manage Tokens > API tokens tab. of your Operations workspace It can be reached by selecting > Settings > Tools > Manage Tokens.

The token for each account is listed in the table along with the date it was created.

note

Community plans do not currently include API tokens. See the official pricing page for details.

Working with API tokens​

You have full control over your API tokens, to create and delete them at any time.

  • To create an API token, click + New API token. Type a brief token name and click Add.

  • To delete an API token, hover over it, and click delete to delete it.

    Deleting a token affects any integrations that use that token. Make sure you update integrations that use a token you deleted.

Manage API tokens with the API​

You can also list and delete the API tokens of an account with the Logz.io API, for example to rotate tokens from an automation.

Both calls need an API token with the Admin role. API tokens created before token roles were introduced have the same permissions as Admin.

In the code blocks below:

  • Replace <<API-TOKEN>> with an Admin API token of the account.
  • Replace <<API-URL>> with your region's base API URL. For more information on finding your account's region, see Account region.

List the API tokens of an account​

GET /v1/api-tokens
curl -X GET \
https://<<API-URL>>/v1/api-tokens \
-H 'Content-Type: application/json' \
-H 'X-API-TOKEN: <<API-TOKEN>>'

The response lists every API token of the account:

FieldDescription
idThe token ID. Use it to delete the token.
nameThe token name.
tokenThe token value.
createdAtWhen the token was created (timestamp).
lastUsedWhen the token was last used (timestamp), or null if it was never used.
roleThe token role: ADMIN, REGULAR (User), READ_ONLY, or CUSTOM.
[
{
"id": 2050070,
"name": "ci-pipeline",
"token": "<<TOKEN-VALUE>>",
"createdAt": "<<TIMESTAMP>>",
"lastUsed": null,
"role": "ADMIN"
}
]

Delete an API token​

DELETE /v1/api-tokens/{id}

Replace <<TOKEN-ID>> with the id of the token to delete.

curl -X DELETE \
https://<<API-URL>>/v1/api-tokens/<<TOKEN-ID>> \
-H 'Content-Type: application/json' \
-H 'X-API-TOKEN: <<API-TOKEN>>'

The response is the deleted token, in the same format as one item of the list above.

note

An API token can't delete itself. To delete the token you're calling with, use a different Admin API token.

StatusMeaning
200The token was deleted.
400The token in X-API-TOKEN tried to delete itself.
403The token in X-API-TOKEN doesn't have the Admin role.
404No API token with this ID exists in the account.

Deleting a token affects any integrations that use that token. Make sure you update integrations that use a token you deleted.

Each account has its own set of API tokens​

Account typeHow to get the API token
Log Management main accountLog into the Main Log Management account, select > Tools > Manage tokens in the top menu and select the API tokens tab.
Log Management sub accountLog into the Log Management sub account, select > Tools > Manage tokens in the top menu and select the API tokens tab.
Metrics accountMetrics accounts do not have their own API tokens. Instead, use the API tokens belonging to the Log Management main account associated with the Metrics account.
Security accountLog into the security account, select > Tools > Manage tokens in the top menu and select the API tokens tab.