Skip to content

API Keys

Baan uses API keys to authenticate requests to the CMS API and the CLI. There are two key types, each with different permissions.

TypePermissionUse case
CMSRead-onlyFetching content from external frontends, mobile apps, aggregators
CLIRead + WriteBaan CLI (baan sync, baan posts), CI/CD pipelines

CMS keys can only read — they return 403 Forbidden on any write operation. CLI keys have cli:full permission and can create, update, publish, and delete posts.

  1. Go to Admin → Settings → API Keys
  2. Click Create Key
  3. Give it a descriptive name (e.g. "Frontend app", "CLI")
  4. Select the key type: CMS or CLI
  5. Copy the generated key — it starts with cms_live_... and is shown only once

Pass the key in the X-API-Key header on every request:

Terminal window
curl https://your-blog.com/api/cms/v1/posts \
-H "X-API-Key: cms_live_xxxxxxxxxxxxxxxxxxxx"

For the CLI, keys are configured via baan init or environment variable:

BAAN_API_KEY=cms_live_xxxxxxxxxxxxxxxxxxxx

The default limit is 300 requests per hour per key. Each response includes rate limit headers:

X-RateLimit-Limit: 300
X-RateLimit-Remaining: 247
X-RateLimit-Reset: 1700000000

Clients that exceed the limit receive a 429 Too Many Requests response.

  • Keys are stored as SHA-256 hashes — Baan never stores the raw key
  • Comparison uses constant-time equality to prevent timing attacks
  • Revoke a key immediately from Admin → Settings → API Keys if it is compromised