Auth & sessions
The auth layer of Codemeta OS offers two ways into the API: API keys for integrations and session cookies for applications in which a person signs in.
API keys
Create API keys in the web interface under Settings → API Console. The key is shown once and is sent with every request as a bearer token:
curl https://os.codemeta.de/api/v1/tickets?limit=10 \
-H "Authorization: Bearer $CODEMETA_API_KEY" \
-H "X-Tenant-Id: $TENANT"
A key belongs to the tenant it was created in and has at most the permissions of the person who created it. API keys have their own budgets; the numbers are listed under Limits.
Endpoint paths
All auth endpoints are tenant-free and live under /api/auth/...:
| Path | Operation |
|---|---|
POST /api/auth/sign-in/email |
Email + password |
POST /api/auth/two-factor/verify-totp |
Submit the second-factor code |
POST /api/auth/sign-out |
End session |
GET /api/auth/session |
Current session details |
The exact list of available sub-endpoints may change with each platform release.
Second factor
A session that calls the API with a cookie needs a second factor. If the account has none set
up, every call under /api/v1 answers 403 with the problem type …/errors/2fa-required. Set up
the second factor in your profile in the web interface.
With a second factor set up, sign-in takes two steps:
# 1. Email + password — response: { "twoFactorRedirect": true }, no session yet
curl -X POST https://os.codemeta.de/api/auth/sign-in/email \
-H "Content-Type: application/json" \
-c cookies.txt -b cookies.txt \
-d '{"email":"alice@example.com","password":"…"}'
# 2. Code from the authenticator app — only this response sets the session cookie
curl -X POST https://os.codemeta.de/api/auth/two-factor/verify-totp \
-H "Content-Type: application/json" \
-c cookies.txt -b cookies.txt \
-d '{"code":"123456"}'
This is impractical for automated jobs — that is what API keys are for.
Tenant selection after sign-in
The account can belong to multiple tenants. After a successful sign-in, fetch the selection:
curl https://os.codemeta.de/api/auth/tenants -b cookies.txt
# → [ { "tenantId": "…", "name": "…", "role": "…" }, … ]
Set the chosen tenantId in all subsequent /api/v1 calls as the
X-Tenant-Id header. There is no endpoint that “switches” the tenant context
on the server side — the header on each request decides.
Related
- Multi-tenancy — the
X-Tenant-Idheader - Limits — budgets for API keys and MCP
- Platform guarantees — all contracts