Skip to content

API Key Management

Manage API keys for authenticating your applications with TerraScale.


Click API Keys in the sidebar to open the API key management page.

Click the “Create API Key” button to open the creation dialog.

FieldDescriptionRequired
NameDescriptive identifier (e.g., “Production Backend”)Yes
ScopesPermissions the key will haveYes
ExpirationOptional expiration dateNo

Choose the permissions for your API key:

ScopeDescription
database:readRead data from databases
database:writeWrite and delete data
database:*Full database access (read + write)
repository:readRead from repositories
repository:writeWrite to repositories
repository:*Full repository access
*Full access to all operations
  1. Click “Create”
  2. Copy your API key immediately
  3. Store it securely

The full API key is only shown once. After closing the dialog, you can only see the key prefix.


The API Keys page displays all your keys with:

ColumnDescription
NameDescriptive name
Key PrefixFirst characters of the key (e.g., ts_live_abc...)
StatusActive, Revoked, or Expired
ScopesAssigned permissions
CreatedCreation date
Last UsedMost recent usage timestamp
ExpiresExpiration date (if set)
  • Search: Filter by key name
  • Status Filter: Show Active, Revoked, or Expired keys
  • Sort: Click column headers to sort

The key is valid and can be used for API requests.

  • Green status indicator
  • Can be revoked at any time
  • Shows last used timestamp

To revoke a key:

  1. Find the key in the API Keys list
  2. Click the menu icon (three dots) on the right
  3. Select “Revoke”
  4. Confirm the action

Revocation is immediate and permanent. Any application using the key will receive 401 Unauthorized errors.


Use descriptive names that identify the key’s purpose:

Good ExamplesBad Examples
Production Backend APIkey1
Mobile App - iOStest
CI/CD Pipelinemy key
Development Serverasdf

Follow the principle of least privilege:

// Good: Specific permissions
{ "scopes": ["database:read", "repository:read"] }
// Avoid: Overly broad permissions
{ "scopes": ["*"] }

Recommendations:

  • Read-only services: Use database:read only
  • Backend APIs: Use database:read and database:write
  • Management tools: Use specific scopes as needed
  • Never use * in production unless absolutely necessary

Rotate API keys regularly:

  1. Create a new key with the same scopes
  2. Update your application to use the new key
  3. Verify the new key works correctly
  4. Revoke the old key

Recommended rotation schedule:

  • Production keys: Every 90 days
  • Development keys: Every 180 days
  • CI/CD keys: Every 90 days

Set expiration dates for temporary keys:

Use CaseRecommended Expiration
Temporary access24 hours - 7 days
Contractor accessProject duration
Testing30 days
ProductionNo expiration (rotate manually)

  • Use different keys for different environments
  • Set expiration dates for temporary access
  • Monitor “Last Used” timestamps for suspicious activity
  • Revoke unused keys promptly
  • Store keys in environment variables or secret managers
  • Share keys between applications
  • Commit keys to source control
  • Use production keys in development
  • Grant more permissions than needed
  • Keep keys active after project completion

Track API key usage:

  1. Find the key in the list
  2. Check the Last Used column
  3. Click the key name for detailed usage metrics

Usage metrics include:

  • Total requests
  • Requests by operation type
  • Error rates
  • Geographic distribution

IssueSolution
401 UnauthorizedCheck key is Active, not Revoked or Expired
403 ForbiddenVerify key has required scopes
Key not recognizedEnsure correct prefix (ts_live_ or ts_test_)
Intermittent failuresCheck rate limits

If you’ve lost an API key:

  1. You cannot recover it - keys are only shown once
  2. Create a new key with the same scopes
  3. Update your application configuration
  4. Revoke the old key