Aller au contenu principal

Developer Access Tokens

Developer Access Tokens (Personal Access Tokens) allow you to authenticate with the Lordbase API programmatically.

Difference from Database Credentials

Developer Access Tokens are personal tokens linked to your developer account. They grant access to the Management API to manage all your workspaces, databases, and configuration.

Database Credentials are per-database usernames/passwords used to connect directly to your database instances for running queries.

Overview

Use Developer Access Tokens to automate:

  • Workspace Management: Create and configure workspaces via API.
  • Database Provisioning: Programmatically create and manage databases.
  • Backup Management: Schedule and trigger backups.
  • CI/CD Integration: Automate deployment of database infrastructure.

Authentication

All requests to the Lordbase API must include the Authorization header:

curl -H "Authorization: Bearer lb_pat_..." https://api.lordbase.com/e/v1/developer/...

Managing Tokens

Create, view, and revoke tokens in Settings in the Lordbase Dashboard.

Creating a Token

curl -X POST https://api.lordbase.com/e/v1/developer/access-tokens/ \
-H "Authorization: Bearer lb_pat_existing_token" \
-H "Content-Type: application/json" \
-d '{
"name": "CI/CD Pipeline",
"scopes": ["api"],
"expires_in_days": 90
}'
attention

The token is shown only once! Copy it immediately after creation. If you lose it, you'll need to create a new one.

Available Scopes

ScopeDescription
apiFull API Access (Default)
read_workspacesView workspace details
write_workspacesCreate, update, or delete workspaces
read_databasesView database details and connections
write_databasesCreate, modify, or delete databases
read_backupsView backup history
write_backupsCreate, restore, or delete backups

Revoking a Token

curl -X POST https://api.lordbase.com/e/v1/developer/access-tokens/{token_id}/revoke/ \
-H "Authorization: Bearer lb_pat_your_token"

Deleting a Token

curl -X DELETE https://api.lordbase.com/e/v1/developer/access-tokens/{token_id}/ \
-H "Authorization: Bearer lb_pat_your_token"

Token Details

FieldDescription
nameHuman-readable name
token_prefix_displayFirst characters shown for identification
scopesGranted permissions
expires_atExpiration date (null = never)
last_used_atLast time the token was used
last_used_ipIP address of last use
is_activeWhether the token is active

Token Security

PracticeDescription
Never expose in frontendTokens are for server-side only
Use environment variablesDon't hardcode tokens
Set expirationUse expires_in_days for auto-expiry
Minimum scopesGrant only the permissions needed
One token per serviceEasier to revoke if compromised

Next Steps