Management API
Use an API key to read your application's users, metadata, sign-up answers, analytics and activity from your server with the onefold management API.
The management API lets your server read about your application and its users without a user
being signed in. Your server authenticates with an API key and calls endpoints under
/api/v1/manage/.
Use it to look up a user by sub, keep your own notes on a user, read sign-up answers, or
pull usage and analytics into your own tools.
Authenticate with an API key
Create a key on the application's API keys tab and send it as a bearer token:
curl https://onefold.eitozx.com/api/v1/manage/users/ \
-H "Authorization: Bearer eitozx_YOUR_KEY"- A key acts as your application, not as a user. It is a different credential from an OAuth access token, and the two are not interchangeable.
- An organization key reaches every application of its organization and names the one it
acts on in the
Onefold-Applicationheader on every call. Create one on the organization's API keys tab. See Organization API keys. - A key is shown once. onefold stores a hash. Copy the key into your secret manager when you create it.
- A key belongs on a server. Never ship one in a browser, a mobile application or a public repository.
What it can do
| Area | Endpoints | Scope |
|---|---|---|
| Users | List users, read one, look one up by ID, email or username | users:read |
| User metadata | Read and write your own JSON document per user | metadata:read, metadata:write |
| Profile fields | Read and write a user's organization profile: the fields your application reads, including its own sign-up answers | profile_fields:read, profile_fields:write |
| Profile activity | Read what happened between a user and your application | profile_activity:read |
| Application | Read your application's registration | application:read |
| Limits | Read the plan values in force for your application | entitlements:read |
| Usage and analytics | Read usage totals and analytics time series | analytics:read |
| Activity | Read your application's administrative activity log | activity:read |
The API reference has each endpoint's parameters and responses: Users and Application.
What it cannot do
- It reaches only your users. A key sees the people who hold a grant with your application
now. A person who has not authorized your application, or who removed it, answers
404, exactly like a person who does not exist. - It returns only what each user granted. A user's claims are the same as userinfo would return for their scopes.
- It does not change accounts. The only write is your own metadata. You cannot create, edit, suspend or delete a user.
- It does not manage your application. Redirect URIs, webhooks, branding and keys are managed in the developer portal.
Scopes
Choose a key's scopes when you create it, and change them later from the key's Edit.
A key with no scopes can reach the whole management API
Scopes only narrow a key. A key created with none selected is not powerless; it has every scope. Give each key the scopes its job needs.
A call outside a key's scopes is refused with 403 and the code api_key_scope_missing.
Find a user
Use the ID you already store. It is the user's sub.
curl "https://onefold.eitozx.com/api/v1/manage/users/USER_ID/" \
-H "Authorization: Bearer eitozx_YOUR_KEY"To find a user by another identifier, use the lookup endpoint with exactly one of id,
email or username:
curl "https://onefold.eitozx.com/api/v1/manage/users/lookup/?email=mira%40example.com" \
-H "Authorization: Bearer eitozx_YOUR_KEY"A lookup matches only what the user disclosed to your application: email needs their grant
to include identity, and username needs identity or profile. Prefer id, because a
user can change the other two.
A lookup by an id you stored before the user
moved to another email address
answers with the user under their current id, if their old profile had authorized your
application. Compare the id in the answer with the one you asked by, and store the new one.
/api/v1/manage/users/USER_ID/ answers only for a current id.
There is no search and no way to list people who have not authorized your application.
Lists
GET /api/v1/manage/users/ returns 50 users per page. Use page_size to ask for up to 200,
and follow next until it is null. See API overview.
Rotate and revoke
| Action | Effect | Use it when |
|---|---|---|
| Rotate | Issues a new key. The old key keeps working for a grace period, 24 hours by default, while you deploy the new one. | Routine replacement |
| Revoke | Ends the key immediately | The key leaked |
Do not rotate a leaked key: it stays valid during the grace period. Revoke it.
A key's expiry is optional, and your organization can cap it. See Credential lifetime.
How many live keys an application can hold depends on its plan (max_api_keys), and how many
an organization can hold depends on the organization's plan. See
Plans and limits.
Rate limits
Management API calls count toward your application's per-minute request budget, shared with userinfo and token exchanges. A call with an organization key counts toward the budget of the application it names. See Rate limits.
Verify webhooks
Verify the HMAC-SHA256 signature on a onefold webhook delivery before you trust it, with examples in TypeScript and Python.
User metadata
Store a small JSON document about each user of your application in onefold, with PUT and PATCH semantics, limits and key rules, and where your own database fits.