Authentication
Authenticate API requests with API keys or JWT tokens.
Authentication
DokuBrain supports two authentication methods: API keys for server-to-server integrations, and JWT tokens for user-facing applications.
API keys
API keys are the recommended way to authenticate programmatic API access. Each key is scoped to an organization and inherits the permissions of the user who created it.
Creating an API key
- Log in to the DokuBrain dashboard
- Navigate to Settings → Integrations
- Click Create API Key
- Give it a descriptive name (e.g., "Production Backend")
- Copy the key — it won't be shown again
Using API keys
Include the API key in the Authorization header:
API keys use the dk_live_ prefix for production and dk_test_ for sandbox environments.
JWT tokens
For user-facing applications, authenticate users with email/password to obtain a JWT token pair (access token + refresh token).
Login
Using the access token
Include the access token in the Authorization header:
Access tokens expire after 15 minutes. Use the refresh token to obtain a new access token:
Base URL
All API requests should be made to:
| Environment | Base URL |
|---|---|
| Production | https://api.dokubrain.com/api/v1 |
| Local dev | http://localhost:8000/api/v1 |
Error responses
Authentication errors return a 401 Unauthorized status:
Rate limits
| Plan | Requests per minute |
|---|---|
| Free | 30 |
| Pro | 120 |
| Enterprise | Custom |
Rate-limited responses return 429 Too Many Requests with a Retry-After header.