Tokens

Overview

Create private access tokens to allow your backend services to make authenticated RPC requests to an Endpoint. This allows you to make requests from any backend origin.

This token is private information and should never be exposed on a front-end.

On the load balancers, we support "user:password" style basic authentication if you need to use that form of auth. In those cases, the password is the token. The token_user is randomly generated, so every token has a unique user.

List Tokens

GET /api/v1/tokens

Returns all tokens that the current authentication token has access to.

Parameters

Name
Type
Description

account_uuid *

string

Will filter the results by account_uuid.

subscription_uuid *

string

Will limit the results by subscription_uuid.

per

string

page

string

* Either a subscription_uuid or account_uuid parameter is required

Request

Example requests with page filtering, number of tokens per page and filtering by account uuid and subscription uuid.

curl 'https://customers.triton.one/api/v1/tokens?account_uuid=c92a9cea-47cc-494b-b1b0-4230a2316ee5' -H "Authorization: secret-api-token" -H "Content-Type: application/json" -H "Accept:application/json" 
curl 'https://customers.triton.one/api/v1/tokens?subscription_uuid=74ea9d9a-4b2a-4f01-af47-1c175f8a2af6' -H "Authorization: secret-api-token" -H "Content-Type: application/json" -H "Accept:application/json" 
curl 'https://customers.triton.one/api/v1/tokens?per=10&page=2&subscription_uuid=74ea9d9a-4b2a-4f01-af47-1c175f8a2af6' -H "Authorization: secret-api-token" -H "Content-Type: application/json" -H "Accept:application/json" 

Response

Returns a hash with the tokens key containing an array of tokens objects and the meta containing pagination data.

{
   "tokens": [
      {
         "uuid": "fa2fec9c-c3e6-4625-b11f-7906dff5f37c",
         "name": "token-name",
         "value": "8d43f8dc-8aa3-4fa2-b09e-361f6af8d972",
         "rate_tier": "tier1",
         "auth_username": "tylerqt-tylerwi-db8c",
         "is_active": false,
         "deactivation_reasons": [      
         ]
      },
      { token_object_2 },
      { token_object_3 },
      ...
   ],
   "meta": {
      "current_page": 1,
      "next_page": null,
      "per_page": 10,
      "prev_page": null,
      "total_pages": 1,
      "total_count": 1
   }
}

Get Token

This API is not available.

Create Token

POST /api/v1/subscriptions/:subscription_uuid/tokens

Add a new token that can be used to access the Subscription's Endpoints

Parameters

Name
Type
Description

name *required

string

A human readable name to describe the token.

rate_tier *required

string

The name of the <link>Rate Tier for this token, which defines rate limits for it. Each token incurs costs based on the Rate Tier defined for it.

Request

Example requests with account_uuid and subscription_uuid filtering.

curl -X POST 'https://customers.triton.one/api/v1/subscriptions/74ea9d9a-4b2a-4f01-af47-1c175f8a2af6/tokens' -H "Authorization: secret-api-token" -H "Content-Type: application/json" -H "Accept:application/json" -d '
{
    "token": {
        "name": "Token 123",
        "rate_tier": "developer" 
    }
}' 

Response

All submitted keys, plus the following are returned:

Name
Type
Description

uuid

string

The generated primary key to reference this token.

auth_username

string

A randomly generated value that can be for basic authentication if needed.

value

string

The value used for authentication.

{
   "token":  {
      "uuid": "b51e9812-ece9-4cb0-81f1-0c4bbdc8a3b7",
      "name": "Token 123",
      "value": "b4274ebd-e2f5-46fd-8e99-8aff8f9f4a85",
      "rate_tier": "developer",
      "auth_username": "tylerqt-example-73d1",
      "is_active": false,
      "deactivation_reasons": []
   }
}

Activate Token

This API is only limited to account management API tokens created with the reseller and operator role.

PUT /api/v1/tokens/:token_uuid/activate

Activate a token so that it can be used.

Parameters

token_uuid is the only parameter that needs to be provided.

Request

curl -X PUT 'https://customers.triton.one/api/v1/tokens/74ea9d9a-4b2a-4f01-af47-1c175f8a2af6/activate' -H "Authorization: secret-api-token" -H "Content-Type: application/json" -H "Accept:application/json"

Response

204 No Content

Deactivate Token

This API is only limited to account management API tokens created with the reseller and operator role.

PUT /api/v1/tokens/:token_uuid/deactivate

Deactivate a token so that it cannot be used.

Parameters

All parameters are optional.

Name
Type
Description

deactivation_reason

string

A human readable description to describe the deactivation reason.

Request

Example request with deactivation_reason.

curl -X PUT 'https://customers.triton.one/api/v1/tokens/74ea9d9a-4b2a-4f01-af47-1c175f8a2af6/deactivate' -H "Authorization: secret-api-token" -H "Content-Type: application/json" -H "Accept:application/json" -d '
{
    "deactivation_reason": "Deactivation reason description"
}' 

Response

204 No Content

Last updated