Basilica
Introduction

Authentication

CLI Login

Enter the Basilica:

basilica login

Opens a browser. Sign in. You're in.

If Browser Callback Fails

If the browser callback doesn't work (common in remote environments or WSL), use the device code flow:

basilica login --device-code

This displays a code and URL. Open the URL in any browser, enter the code, and you're authenticated.

Programmatic Access

For SDK usage, CI/CD pipelines, or automation, create an API token.

Generate a Token

First, ensure you're logged in:

basilica login

Then create an API token:

basilica tokens create

Copy the token immediately. It won't be shown again.

Use the Token

With the SDK:

from basilica import BasilicaClient

client = BasilicaClient(api_key="your_token")

With an environment variable:

export BASILICA_API_TOKEN=your_token

The SDK and CLI automatically use BASILICA_API_TOKEN when set:

from basilica import BasilicaClient

# Automatically uses BASILICA_API_TOKEN
client = BasilicaClient()

Authentication Priority

When multiple auth methods are configured, Basilica uses this order:

  1. api_key parameter passed to BasilicaClient()
  2. BASILICA_API_TOKEN environment variable
  3. Stored credentials from basilica login

Revoke a Token

basilica tokens revoke <token-name>

Takes effect immediately. No grace period.

Next Steps

On this page