Management API
Management API
The dashboard and your backend use the same Management API to manage applications, users, event logs, webhook endpoints and keys.
- Base URL:
https://api.foxlogin.app/v1 - Authentication:
Authorization: Bearer sk_live_…(secret key) orAuthorization: Bearer fk_live_…(organization API key) - Format: JSON. Send
Content-Type: application/jsonwith every request that has a body. - Rate limit: 100 requests per second per key
curl https://api.foxlogin.app/v1/applications/app_8f2c91a7 \
-H "Authorization: Bearer $FOXLOGIN_SECRET_KEY"A secret key reaches its own application and the endpoints its role allows. An organization API key reaches every application. The publishable key does not work here.
Operations
This list covers the endpoints that work today. The API reference also describes planned ones. The scope column names the scope each endpoint needs.
Applications
| Method | Path | Scope | What it does |
|---|---|---|---|
GET |
/applications |
applications:read |
List applications, newest first, up to 100. A secret key gets only its own application. |
POST |
/applications |
applications:write |
Create an application. Organization keys only, and they need the five scopes of the admin role, because the response includes the application's first admin secret key. |
GET |
/applications/{app_id} |
applications:read |
Get one application. |
PATCH |
/applications/{app_id} |
applications:write |
Change the name, redirect URLs, country restriction or Google sign-in. With a secret key, the admin role only. |
Users
| Method | Path | Scope | What it does |
|---|---|---|---|
GET |
/applications/{app_id}/users |
users:read |
List users, newest first. Filter by exact email; page with limit and cursor. |
POST |
/applications/{app_id}/users |
users:write |
Create a user. country is required; leave out password for a passwordless account. |
GET |
/applications/{app_id}/users/{user_id} |
users:read |
Get one user. |
Events
| Method | Path | Scope | What it does |
|---|---|---|---|
GET |
/applications/{app_id}/events |
events:read |
List sign-up and sign-in events, newest first. Filter by user_id; page with limit and cursor. |
Webhooks
| Method | Path | Scope | What it does |
|---|---|---|---|
GET |
/applications/{app_id}/webhooks |
applications:read |
List endpoints, without their secrets, and the event types you can subscribe to. |
POST |
/applications/{app_id}/webhooks |
applications:write |
Create an endpoint. Returns its signing secret once. At most 10 per application. |
DELETE |
/applications/{app_id}/webhooks/{endpoint_id} |
applications:write |
Delete an endpoint. |
Secret keys
| Method | Path | Scope | What it does |
|---|---|---|---|
GET |
/applications/{app_id}/secret_keys |
applications:read |
List the application's secret keys, revoked ones included. A secret key needs the admin role. |
POST |
/applications/{app_id}/secret_keys |
keys:write |
Create a secret key with a name and a role. Returns the full key once. Not with a secret key. |
DELETE |
/applications/{app_id}/secret_keys/{key_id} |
keys:write |
Revoke a secret key. Not with a secret key. |
Organization API keys
| Method | Path | Scope | What it does |
|---|---|---|---|
GET |
/api_keys |
keys:write |
List organization keys, revoked ones included. Not with a secret key. |
POST |
/api_keys |
keys:write |
Create an organization key with the scopes you list. Returns the full key once. Not with a secret key. |
DELETE |
/api_keys/{key_id} |
keys:write |
Revoke an organization key. Not with a secret key. |
Dashboard owners and admins have keys:write. Secret keys never have it. Organization keys have it only when it was granted through scopes on POST /api_keys.
Update an application
PATCH /applications/{app_id} changes the settings the dashboard shows on the General and Google tabs of Login settings. Send only the fields you change; the others keep their value.
curl -X PATCH https://api.foxlogin.app/v1/applications/app_8f2c91a7 \
-H "Authorization: Bearer $FOXLOGIN_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "redirect_urls": ["https://anka.io/auth/callback", "http://localhost:3000/auth/callback"] }'| Field | What it sets |
|---|---|
name |
The application name, 1 to 100 characters. |
redirect_urls |
The exact URLs Google sign-in may send users back to. Replaces the whole list. |
country_restriction |
{ "mode": "all" }, or { "mode": "only_listed", "countries": ["TR"] } to accept only the listed countries. Replaces the stored value. |
providers.google.enabled |
true or false. Google sign-in is on unless you turn it off. |
region |
Cannot change. Sending the current region is fine; any other value returns 422 region_immutable. |
The response is the updated application, which includes redirect_urls and providers. Fox Login tells the application's region about the change before saving it. If the region does not answer, nothing changes and you get 503 region_unavailable.
Redirect URLs have to follow these rules, otherwise the call returns 400 invalid_redirect_url with the URL and the broken rule in the message:
https, orhttpforlocalhost,127.0.0.1and[::1]only.- A host, with no user name or password, no
#,*or spaces, and at most 500 characters. - At most 20 per application, otherwise
400 too_many_redirect_urls. Duplicates are dropped.
Google sign-in compares the redirect_uri of each start request with this list character for character, so https://anka.io/auth/callback and https://anka.io/auth/callback/ are different URLs.
SDK coverage
The admin client of every server SDK wraps five calls: create, list and get applications, and create and get users. Call the other endpoints over HTTP with the same key, as the users, events and webhooks pages show.
import { FoxLoginAdmin } from "foxlogin/server";
const admin = new FoxLoginAdmin({ secretKey: process.env.FOXLOGIN_SECRET_KEY });
const { data } = await admin.applications.list(); // with a secret key: its own applicationimport os
from foxlogin import FoxLoginAdmin
admin = FoxLoginAdmin(secret_key=os.environ["FOXLOGIN_SECRET_KEY"])
apps = admin.applications.list()["data"] # with a secret key: its own applicationadmin, err := foxlogin.NewAdminClient(foxlogin.AdminOptions{SecretKey: os.Getenv("FOXLOGIN_SECRET_KEY")})
if err != nil {
return err
}
apps, err := admin.Applications.List(ctx) // with a secret key: its own application
if err != nil {
return err
}
fmt.Println(len(apps))use FoxLogin\FoxLoginAdmin;
$admin = new FoxLoginAdmin(['secretKey' => getenv('FOXLOGIN_SECRET_KEY')]);
$apps = $admin->listApplications(); // with a secret key: its own applicationimport app.foxlogin.Application;
import app.foxlogin.FoxLoginAdmin;
import java.util.List;
FoxLoginAdmin admin = FoxLoginAdmin.builder(System.getenv("FOXLOGIN_SECRET_KEY")).build();
List<Application> apps = admin.applications().list(); // with a secret key: its own applicationusing FoxLogin;
var admin = new FoxLoginAdminClient(new FoxLoginAdminClientOptions
{
SecretKey = Environment.GetEnvironmentVariable("FOXLOGIN_SECRET_KEY"),
});
var apps = await admin.ListApplicationsAsync(); // with a secret key: its own applicationrequire "foxlogin"
admin = FoxLogin::Admin.new(secret_key: ENV.fetch("FOXLOGIN_SECRET_KEY"))
apps = admin.applications.list["data"] # with a secret key: its own applicationuse foxlogin::AdminClient;
let admin = AdminClient::new(std::env::var("FOXLOGIN_SECRET_KEY")?)?;
let apps = admin.list_applications().await?; // with a secret key: its own applicationPagination
The user and event lists take limit (1 to 100, default 50) and cursor. Each response has next_cursor. Pass it as cursor to get the next page; next_cursor: null marks the last page.
{
"data": [ … ],
"next_cursor": "eyJFVSI6ImV2dF85OCJ9",
"regions_unavailable": [],
"partial": false
}If the region does not answer, the list still returns 200, with empty data, partial: true and the region in regions_unavailable. Check partial before you treat an empty page as the end.
GET /applications returns up to 100 applications and has no cursor.
Errors and retries
Failed calls use the error envelope described in Errors. 429 rate_limited and 503 region_unavailable carry a Retry-After header; wait that many seconds and send the request again. The other 4xx errors will fail the same way until you change the request.