Skip to Content
APIAuthentication

Authentication

The Computer Agents API uses API keys to authenticate requests. All API requests must include your API key.

Getting an API Key

  1. Sign up at computer-agents.com 
  2. Navigate to SettingsAPI Keys
  3. Click Create API Key
  4. Copy and securely store your key

API keys grant full access to your account. Never share them or commit them to version control.

Using Your API Key

Include your API key in the Authorization header:

curl https://api.computer-agents.com/v1/threads \ -H "Authorization: Bearer tb_xxxxxxxxxxxx"

Authentication Methods

MethodHeaderExample
Bearer TokenAuthorizationAuthorization: Bearer tb_xxxxxxxxxxxx
X-API-KeyX-API-KeyX-API-Key: tb_xxxxxxxxxxxx

Bearer token is recommended. Both methods provide identical access.

API Key Types

TypePrefixDescription
Standardtb_Regular user keys with billing
Internaltb_internal_Service keys (unlimited rate)

Permissions (Scopes)

API keys have scoped permissions:

PermissionDescription
*Full access to all resources
threads:readRead threads and messages
threads:writeCreate, update, delete threads
agents:readRead agent configurations
agents:writeCreate, update, delete agents
environments:readRead environments
environments:writeCreate, update, delete environments
schedules:readRead schedules
schedules:writeCreate, update, delete schedules
billing:readRead billing and cost data
executeExecute tasks in threads

Public Endpoints

These endpoints don’t require authentication:

  • GET /health - Health check
  • GET /metrics - System metrics
  • GET /metrics/history - Execution history

Environment Variables

Store your API key in environment variables:

# .env.local COMPUTER_AGENTS_API_KEY=tb_xxxxxxxxxxxx

Never commit .env files to version control. Add them to .gitignore.

Authentication Errors

StatusErrorDescription
401UnauthorizedMissing or invalid API key
403ForbiddenAPI key lacks required permissions
402Payment RequiredInsufficient budget balance

Error Response

{ "error": "Unauthorized", "message": "API key required. Provide via Authorization header (Bearer token) or X-API-Key header." }

Security Best Practices

  1. Rotate keys regularly - Create new keys and revoke old ones periodically
  2. Use environment variables - Never hardcode keys in source code
  3. Set budget limits - Prevent unexpected costs with spending limits
  4. Monitor usage - Review API usage in your dashboard
  5. Separate environments - Use different keys for dev/staging/production
  6. Limit scopes - Only grant permissions the key needs

Next Steps

Last updated on