Tokens

Tokens

Tokens from a project.

GEThttps://cloud-api.calyptia.com/v1/projects/{projectID}/tokens
Authorization
Path parameters
projectID*string (uuid)
Query parameters
Response

OK

Body
id*string (uuid)
token*string
Example: "redacted"
name*string
Example: "my-token"
permissions*array of Permission (enum)
createdAt*string (date-time)
Request
const response = await fetch('https://cloud-api.calyptia.com/v1/projects/{projectID}/tokens', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
[
  {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "token": "redacted",
    "name": "my-token",
    "permissions": [
      "create:*"
    ],
    "createdAt": "2024-10-16T08:53:31.967Z"
  }
]

Create token

Create token within a project. These tokens are to authorize other applications to access the project. For example:

  • an agent might use it to register itself to the project.
  • you might create a new aggregator in the project using the aggregator CLI.
  • you might use it within the Calyptia CLI to grant access to your project.
POSThttps://cloud-api.calyptia.com/v1/projects/{projectID}/tokens
Authorization
Path parameters
projectID*string (uuid)
Body
name*string
Example: "new-token"
permissions*array of Permission (enum)
Response

Created

Body
id*string (uuid)
token*string
Example: "redacted"
name*string
Example: "my-token"
permissions*array of Permission (enum)
createdAt*string (date-time)
Request
const response = await fetch('https://cloud-api.calyptia.com/v1/projects/{projectID}/tokens', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "new-token",
      "permissions": [
        "create:*"
      ]
    }),
});
const data = await response.json();
Response
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "token": "redacted",
  "name": "my-token",
  "permissions": [
    "create:*"
  ],
  "createdAt": "2024-10-16T08:53:31.967Z"
}