Keys and access
Secret key roles
An application works with its single Default secret key. You can also create several secret keys and give each one a role. The role is set when the key is created and decides the key's scopes. Whatever its role, a secret key reaches only its own application.
Roles
| Role | Dashboard label | Scopes | What it can do |
|---|---|---|---|
admin |
Full access | applications:read, applications:write, users:read, users:write, events:read |
Read and update the application, list, get and create users, read events, create and delete webhook endpoints, list the application's secret keys. |
editor |
Read and write users | applications:read, users:read, users:write, events:read |
Read the application and its webhook endpoints, list, get and create users, read events. |
viewer |
Read only | applications:read, users:read, events:read |
Read the application, its webhook endpoints, users and events. It changes nothing. |
No secret key has the keys:write scope, whatever its role. Applications are created in the dashboard or with an organization API key. Secret keys are created and revoked in the dashboard or with an organization API key that has keys:write.
Which role can call what
| Endpoint | admin |
editor |
viewer |
|---|---|---|---|
GET /applications |
✓ | ✓ | ✓ |
GET /applications/{app_id} |
✓ | ✓ | ✓ |
PATCH /applications/{app_id} |
✓ | — | — |
GET /applications/{app_id}/users |
✓ | ✓ | ✓ |
GET /applications/{app_id}/users/{user_id} |
✓ | ✓ | ✓ |
POST /applications/{app_id}/users |
✓ | ✓ | — |
GET /applications/{app_id}/events |
✓ | ✓ | ✓ |
GET /applications/{app_id}/webhooks |
✓ | ✓ | ✓ |
POST /applications/{app_id}/webhooks |
✓ | — | — |
DELETE /applications/{app_id}/webhooks/{endpoint_id} |
✓ | — | — |
GET /applications/{app_id}/secret_keys |
✓ | — | — |
POST /applications |
— | — | — |
POST /applications/{app_id}/secret_keys |
— | — | — |
DELETE /applications/{app_id}/secret_keys/{key_id} |
— | — | — |
/api_keys (all methods) |
— | — | — |
With a secret key, GET /applications returns only the key's own application. A role that lacks a scope gets 403 missing_scope. The last four rows answer 403 secret_key_not_allowed for every secret key.
One key per service
One secret key is enough while one server talks to Fox Login. Once several services do, give each its own key with the smallest role it needs:
| Service | Key name | Role |
|---|---|---|
| Web backend that creates accounts and reads profiles | Web backend | editor |
| Nightly job that exports sign-in statistics | Reports | viewer |
| Deploy script that sets up webhook endpoints | Deploy | admin |
If one service leaks its key, you revoke that key and the other services keep working. Each key also has its own Last used time, so you can see which service still calls Fox Login.
Create a secret key
In the dashboard:
- Open the application and choose API keys & webhooks in the sidebar, under Configure.
- Choose Create secret key.
- Enter a name of up to 60 characters and pick a role. The default role is
admin. - Copy the key from the panel that appears. The dashboard shows the full key only this once.
Organization owners and admins can create and revoke keys. Other members see the list without these buttons.
With the API, call POST /applications/{app_id}/secret_keys as a dashboard owner or admin, or with an organization API key that has keys:write. The caller also needs every scope of the role it grants: an editor key needs applications:read, users:read, users:write and events:read, and an admin key also needs applications:write. A caller without them gets 403 missing_scope, and a secret key gets 403 secret_key_not_allowed.
curl https://api.foxlogin.app/v1/applications/app_8f2c91a7/secret_keys \
-H "Authorization: Bearer $FOXLOGIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Billing worker", "role": "editor" }'{
"id": "key_3b7e10c2",
"name": "Billing worker",
"role": "editor",
"prefix": "sk_live_eu_Q9xT",
"key": "sk_live_eu_Q9xTa7Lm2Nb4Vc6Xz8Sd1Fg3Hj5Kl7Pq9Wr2Ey4Tu6I",
"created_at": "2026-12-02T10:20:00Z",
"created_by": null,
"last_used_at": null
}key appears only in this response. A missing or empty name becomes Secret key. A role other than admin, editor or viewer returns 400 invalid_role, and a name over 60 characters returns 400 invalid_name.
List the keys of an application
An admin secret key can list its own application's keys, which is useful for checking which keys are still in use. editor and viewer keys get 403 missing_scope.
curl https://api.foxlogin.app/v1/applications/app_8f2c91a7/secret_keys \
-H "Authorization: Bearer $FOXLOGIN_SECRET_KEY"const res = await fetch(
`https://api.foxlogin.app/v1/applications/${process.env.FOXLOGIN_APP_ID}/secret_keys`,
{ headers: { Authorization: `Bearer ${process.env.FOXLOGIN_SECRET_KEY}` } },
);
const { data } = await res.json();
for (const k of data) console.log(k.name, k.role, k.last_used_at, k.revoked_at);{
"data": [
{
"id": "key_3b7e10c2",
"name": "Billing worker",
"role": "editor",
"prefix": "sk_live_eu_Q9xT",
"created_at": "2026-12-02T10:20:00Z",
"created_by": null,
"last_used_at": "2026-12-02T11:02:13Z",
"revoked_at": null
},
{
"id": "key_5d1e9a20",
"name": "Default",
"role": "admin",
"prefix": "sk_live_eu_Ab3d",
"created_at": "2026-12-01T08:00:00Z",
"created_by": null,
"last_used_at": "2026-12-02T08:59:40Z",
"revoked_at": "2026-12-02T09:00:00Z"
}
]
}Keys come newest first, revoked ones included. created_by is the dashboard user who created the key, or null when the key came with the application or an organization API key created it. last_used_at is updated at most once a minute.
When a key is refused
| Response | Cause | Fix |
|---|---|---|
401 missing_api_key |
No Authorization header, or it does not start with Bearer. |
Send Authorization: Bearer sk_live_…. |
401 invalid_api_key |
The key is unknown, mistyped or revoked. | Check the environment variable on the server. If the key was revoked, create a new one. |
403 missing_scope |
The key's role lacks the scope the endpoint needs, for example a viewer key calling POST /applications/{app_id}/users. |
Use a key whose role has the scope, or create one. |
403 secret_key_not_allowed |
A secret key called POST /applications, an /api_keys endpoint, or an endpoint that creates or revokes secret keys. |
Use an organization API key or the dashboard. |
404 not_found |
The app_id in the path belongs to another application. To a secret key, other applications do not exist. |
Use that application's own secret key, or an organization API key. |