Skip to main content
Every data route on api.kash.bot requires an API key. The only unauthenticated endpoints are the infra-meta routes: /v1/health, /v1/ready, /v1/openapi.json, /v1/docs.

The X-API-Key header

Pass your key on every request as the X-API-Key header:
Keys are issued via the webapp’s Settings → API Keys page or the admin CLI.
With @kashdao/sdk you don’t set the header yourself — construct the client with your key and it authenticates every request (and auto-routes to staging for a kash_test_* key, production for kash_live_*):

Key format

The 32-character random suffix gives roughly 190 bits of entropy. The prefix is informational — the server validates the full key against a stored HMAC under a server-side pepper. Never log or commit the plaintext.

Scopes

A scope is a coarse-grained permission. Every endpoint declares the scope(s) it requires. The requireScope middleware fails closed with 403 INSUFFICIENT_SCOPE when a key lacks one.
Default scopes by tier. Self-served free and developer keys default to markets:read, markets:quote, portfolio:read. Admin-issued enterprise and mm keys add trades:read, trades:write. You can override at issuance — request the scopes that match your use case, no more.

Tiers

Each key has a tier that governs default rate limits and spending caps. See Rate Limits for per-tier quotas. Reach out to partnerships@kash.bot for enterprise or mm keys.

IP allowlists

Optional per-key. When set, requests from any IP not in the list fail closed with 403 IP_NOT_ALLOWED before the route handler runs. Format: comma-separated IPv4/IPv6 addresses or CIDR ranges. Set in the webapp UI or via the admin CLI at issuance time.
We strongly recommend setting an allowlist for production keys. It collapses an entire class of “key was leaked from a logfile” incidents.

Key rotation

API keys do not expire automatically. Rotate them when:
  • A team member with access leaves
  • A key may have been logged or committed to a repo
  • You’re tightening security posture before a major release
To rotate:
  1. Issue a new key in the webapp.
  2. Roll it out to your services.
  3. Verify the new key is in use (check /v1/account/usage — request counts on the old key should be zero).
  4. Revoke the old key in the webapp.
There is no automated dual-validity overlap window for API keys; the rotation is sequential. (Webhook secrets do have a 7-day rotation overlap — see Secret Rotation.)

Body signing for trades:write (optional, hardened)

For write routes like POST /v1/trades, you can opt into HMAC-signed request bodies as a defence-in-depth layer against captured-request replay and in-flight tampering. Send the signature in X-Kash-Signature using the same Stripe-style header format as our webhook signatures:
  • Signing secret = your API key plaintext (the same value you send in X-API-Key). No separate signing secret is issued — this is not the key’s webhook_secret.
  • Canonical input is <unix-ms-timestamp>.<METHOD>.<path>.<raw-body> — the timestamp from t=, the HTTP method uppercased, the URL pathname without the query string (query params aren’t signed because intermediaries often re-order them), and the exact raw body bytes you send.
  • Algorithm: HMAC-SHA256, hex-encoded.
  • Timestamp tolerance: ±5 minutes. Older or newer timestamps are rejected.
If the header is present, the server MUST be able to verify it — a mismatch, a malformed header, or a stale timestamp is rejected with 401 REQUEST_SIGNATURE_INVALID. If absent, the route still works (the API key is the canonical authentication). Multiple comma-separated v1= values are accepted (for graceful scheme rotation later). Use body signing when your threat model includes a compromised TLS-terminating proxy or leaky request logs.

Auth failures

All auth failures return RFC 7807 application/problem+json and are written to the per-key audit log. Repeated failures from the same source trigger the per-IP brute-force lockout.

Inspecting auth state

The GET /v1/account/usage endpoint returns telemetry for the calling key — including 24h auth-failure and rate-limit-rejection counts. Useful for spotting key misuse early.

Next

Rate Limits

Per-tier quotas, the X-RateLimit-* headers, and 429 handling.

Errors

RFC 7807 error format and the full error code catalog.