Keys and access
Organization API keys
An organization API key (fk_live_…) acts for the whole organization. It reaches every application in it, including applications created later, and it can create applications. A secret key, by contrast, reaches one application.
Scopes
You choose an organization key's scopes when you create it:
| Scope | Allows |
|---|---|
applications:read |
List and read applications and their webhook endpoints, list an application's secret keys |
applications:write |
Create and update applications, create and delete webhook endpoints |
users:read |
List and read users |
users:write |
Create users |
events:read |
Read event logs |
keys:write |
Create and revoke secret keys, and create, list and revoke organization keys |
A key created without a scope list gets the first five scopes and not keys:write. Give keys:write only to the tool that manages keys. Dashboard owners and admins have all six scopes.
Two rules limit what a key can do with keys:write. A caller can never grant a scope it lacks, so a key with keys:write but without users:write cannot create a key that has users:write. Creating a secret key also needs every scope of the role it grants. The answer to both is 403 missing_scope.
When to use one
- A CI job or provisioning script that creates an application for each customer or environment.
- An internal admin panel or reporting tool that reads several applications.
- A migration script that imports users into more than one application.
- A key-management tool that creates and revokes secret keys, with
keys:write.
A server that works with one application should use that application's secret key. If that key leaks, only one application is exposed.
Create an organization key
- In the dashboard, open API access in the sidebar. Only organization owners and admins see it.
- Choose Create API key and enter a name of up to 60 characters.
- Copy the key. The dashboard shows the full key only this once and keeps the first 12 characters, such as
fk_live_8f2c, to tell keys apart.
With the API, POST /api_keys creates a key with the scopes in scopes. The caller needs keys:write and every scope it grants. Leave out scopes to get the five default scopes. An empty list or an unknown scope returns 400 invalid_scope.
curl https://api.foxlogin.app/v1/api_keys \
-H "Authorization: Bearer $FOXLOGIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Key manager",
"scopes": ["applications:read", "users:read", "users:write", "events:read", "keys:write"]
}'{
"id": "key_7c41d0e2",
"name": "Key manager",
"key": "fk_live_Rk8vT2qL5nW9xB3mZ7cH1jD4sF6gY0pA8eU2iO5tQ3w",
"scopes": ["applications:read", "users:read", "users:write", "events:read", "keys:write"]
}This key can create and revoke editor and viewer secret keys. It cannot create admin keys or applications, because it lacks applications:write.
Example: create an application
curl https://api.foxlogin.app/v1/applications \
-H "Authorization: Bearer $FOXLOGIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Anka Market Seller", "region": "TR", "sector": "ecommerce", "user_countries": ["TR"] }'import { FoxLoginAdmin } from "foxlogin/server";
const org = new FoxLoginAdmin({ apiKey: process.env.FOXLOGIN_API_KEY });
const app = await org.applications.create({
name: "Anka Market Seller",
region: "TR",
sector: "ecommerce",
userCountries: ["TR"],
});
console.log(app.id, app.publishable_key);{
"id": "app_8f2c91a7",
"name": "Anka Market Seller",
"region": "TR",
"multi_region": false,
"block": "west",
"sector": "ecommerce",
"user_countries": ["TR"],
"country_restriction": { "mode": "all", "countries": [] },
"publishable_key": "pk_live_tr_Xk2m9wQe4Rt7Yu1Io0Pa3Sd6Fg8Hj5Kl2Zx4Cv7Bn1M",
"created_at": "2026-12-02T09:00:00.123456Z",
"secret_key": {
"id": "key_5d1e9a20",
"name": "Default",
"role": "admin",
"prefix": "sk_live_tr_Ab3d",
"key": "sk_live_tr_Ab3dE5fG7hJ9kL1mN3pQ5rS7tU9vW1xY3zA5bC7dE9f",
"created_at": "2026-12-02T09:00:00Z",
"created_by": null,
"last_used_at": null
}
}name takes 1 to 100 characters and region is EU or TR; neither can be changed later. To accept users from listed countries only, add "country_restriction": { "mode": "only_listed", "countries": ["TR"] }. A secret key calling this endpoint gets 403 secret_key_not_allowed.
The organization key needs the five scopes of the admin role (applications:read, applications:write, users:read, users:write, events:read), because the response contains the application's admin secret key. A key that lacks one of them gets 403 missing_scope.
List and revoke organization keys
The API access page lists the organization's keys. Choose Revoke to stop a key at once; requests with it then get 401 invalid_api_key. In the API these are GET /api_keys, which also returns each key's scopes and last_used_at, and DELETE /api_keys/{key_id}. Both need keys:write. They list and revoke organization keys only; an application secret key's ID answers 404 not_found.