Opbox

Authentication

All API requests must be authenticated using an API key. Keys can be created and managed in Settings -> API Keys.

API Key Format

API keys are prefixed with sk_ followed by a unique identifier:

sk_a1b2c3d4e5f6...

Keys are stored securely. Once created, the full key cannot be retrieved - only a prefix is shown for identification.

Using Your API Key

Include your API key in the Authorization header as a Bearer token:

Authorization: Bearer sk_your_api_key_here

Example: cURL

curl -X GET https://your-domain.com/api/forms \
  -H "Authorization: Bearer sk_a1b2c3d4..." \
  -H "Content-Type: application/json"

Example: JavaScript (fetch)

const response = await fetch('https://your-domain.com/api/forms', {
  headers: {
    'Authorization': 'Bearer sk_a1b2c3d4...',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();

Authentication Errors

StatusMeaningResolution
401 UnauthorizedMissing or invalid API keyCheck that the key is included in the Authorization header
403 ForbiddenKey is valid but lacks permissionMake sure you have permission for this resource

Security Best Practices

  1. Never expose keys in client-side code. API keys should only be used in server-side code or secure environments.
  2. Use environment variables. Store keys in environment variables, not in source code or version control.
  3. Rotate keys regularly. Create new keys periodically and revoke old ones from Settings.
  4. Use descriptive names. Name keys after their purpose (e.g., "Production Server", "CI/CD Pipeline") for easier management.
  5. Revoke compromised keys immediately. If a key is exposed, revoke it in Settings and create a replacement.