Authentication
This page covers API keys — the right credential for a server integration against your own sajn account. Every request carries the key in theAuthorization header.
The API also accepts OAuth 2.0 bearer tokens, which is how integrations that connect to
many sajn customers’ accounts authenticate. If you are not sure which applies to you, read
Choosing an authentication method first — it takes a minute and
saves rebuilding later.
An API key is bound to a single workspace, chosen when you create it. You never send a
workspace id with your requests. Call
GET /api/v1/me
to confirm which workspace and organization a key points at.Getting Your API Key
- Log in to your sajn account at app.sajn.se
- Navigate to Organization Settings > API Keys
- Click Create API Key
- Copy your API key and store it securely
Making Authenticated Requests
Include your API key in theAuthorization header as a Bearer token:
Example with Different Languages
API Key Security Best Practices
Store securely
Store securely
Store API keys in environment variables or secure credential management systems, never in code.
Rotate regularly
Rotate regularly
Rotate your API keys periodically to minimize the impact of potential compromises.
Use separate keys
Use separate keys
Use different API keys for development, staging, and production environments.
Monitor usage
Monitor usage
Regularly review API key usage in your sajn dashboard to detect unauthorized access.
Error Responses
If authentication fails, you’ll receive a401 Unauthorized response:
Rate Limiting
API requests are rate limited per organization, with limits that scale with your plan. There is a per-minute burst limit and a rolling 24-hour volume limit; higher plans get higher limits. Read your current limits from the response headers rather than hard-coding them — they’re included on every response:429 Too Many Requests response with a Retry-After header. Clients should back off and retry after the indicated delay. If you consistently hit your limits, upgrade your plan for higher throughput.
