Authentication

Bluebricks API supports two authentication methods:

  • Long-lived API Tokens - For automated workflows and CI/CD pipelines

  • JWT Tokens - For personal authentication and testing

JWT Tokens

JWT tokens are obtained from the CLI or UI and are ideal for personal testing and development.

Extract JWT from CLI

After running bricks login, extract your JWT token:

token=$(awk '/^token:/ {sub(/token:[[:space:]]*/, ""); print; exit}' ~/.bricks/credentials.yaml)
curl -H "Authorization: ${token}" https://api.bluebricks.co/api/v1/environments

Long-lived API Tokens

Long-lived API tokens are essential for secure server-to-server communication, enabling seamless authentication without frequent renewals.

You can create and manage API tokens through:

Prerequisites

Managing long-lived API tokens requires Admin role

Create via UI

Navigate to Settings > Tokensarrow-up-right in the Bluebricks app to create and manage your API tokens.

API Tokens Settings
circle-exclamation

Create via API

Use the POST Auth Key API to create a long-lived API token:

For first-time creation, use your JWT token to authenticate the request.

circle-exclamation
circle-check

List via API

Use the GET Auth Keys API to list your long-lived API tokens:

Deactivate via API

Use the POST Auth Deactivate Key API to disable long-lived API tokens:

Activate via API

Use the POST Auth Activate Key API to enable long-lived API tokens:

Last updated

Was this helpful?