Token API
The token API is only available for Golem Cloud.
The token API allows creating custom access tokens for the Golem Cloud REST API to be used by tools and services.
Get all tokens
| Path | Method | Protected | 
|---|---|---|
| /v2/accounts/{account_id}/tokens | GET | Yes | 
Gets all created tokens of an account. The format of each element is the same as the data object in the oauth2 endpoint's response.
Example Response JSON
[
  {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "accountId": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "expiresAt": "2019-08-24T14:15:22Z"
  }
]Create new token
| Path | Method | Protected | 
|---|---|---|
| /v2/accounts/{account_id}/tokens | POST | Yes | 
Creates a new token with a given expiration date. The response not only contains the token data but also the secret which can be passed as a bearer token to the Authorization header to the Golem Cloud REST API.
Example Request JSON
{
  "expiresAt": "2019-08-24T14:15:22Z"
}Example Response JSON
{
  "data": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "accountId": "string",
    "createdAt": "2019-08-24T14:15:22Z",
    "expiresAt": "2019-08-24T14:15:22Z"
  },
  "secret": {
    "value": "a860a344-d7b2-406e-828e-8d442f23f344"
  }
}Get a specific token
| Path | Method | Protected | 
|---|---|---|
| /v2/accounts/{account_id}/tokens/{token_id} | GET | Yes | 
Gets information about a token given by it's identifier. The JSON is the same as the data object in the oauth2 endpoint's response.
Example Response JSON
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "accountId": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "expiresAt": "2019-08-24T14:15:22Z"
}Delete a token
| Path | Method | Protected | 
|---|---|---|
| /v2/accounts/{account_id}/tokens/{token_id} | DELETE | Yes | 
Deletes a previously created token given by it's identifier.
Example Response JSON
{}Token API Errors
| Status Code | Description | Body | 
|---|---|---|
| 400 | Invalid request, returning with a list of issues detected in the request | {"errors":["string"]} | 
| 401 | Unauthorized | {"error":"string"} | 
| 404 | Token not found | {"error":"string"} | 
| 500 | Internal server error | {"error":"string"} |