Authentication
Authenticate Platform API requests with an X-API-Key header, and what each key may reach.
Send an API key in the X-API-Key header:
curl https://api.folkways.io/api/v1/segments/$SEGMENT_ID \
-H "X-API-Key: $FOLKWAYS_API_KEY"Keys look like fk_<id>_<secret>. The full key is shown once, when you create it in the Console; afterwards only
its prefix fk_<id>_ is visible. Folkways stores only a hash of the secret, so a lost key can't be recovered: create
a new one.
What a key reaches
A key belongs to one workspace and lists what it may read:
| Access | Reaches |
|---|---|
| The workspace | /organizations/{workspaceId} and everything under it: segments list, subscription, usage |
| A segment | /segments/{segmentId} and its usage |
The key is checked against the workspace or segment named in the path. A request for anything else is refused with
403.
API keys are read-only: GET only, whatever access level the key shows, and never for actions that need a
signed-in owner or admin.
Public endpoints
/packages, /plans and /rate-profiles need no credential. Don't send an API key to them: the key is checked
against the path, and a path that names no workspace or segment is refused with 400.
Failures
| Status | When |
|---|---|
401 | The key is missing, malformed, unknown, revoked, expired or paused |
403 | The key is valid but has no access to the workspace or segment in the path |
400 | The key was sent to a path that names no workspace or segment, such as /packages |
These three come with an empty body.
Keeping keys safe
- Keep keys on servers, in a secrets manager. Never in an app, a browser or a repository.
- Create one key per server or script, with only the access it needs.
- Set an expiry for keys used by temporary jobs, and revoke keys you no longer use.