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-Application header 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

AreaEndpointsScope
UsersList users, read one, look one up by ID, email or usernameusers:read
User metadataRead and write your own JSON document per usermetadata:read, metadata:write
Profile fieldsRead and write a user's organization profile: the fields your application reads, including its own sign-up answersprofile_fields:read, profile_fields:write
Profile activityRead what happened between a user and your applicationprofile_activity:read
ApplicationRead your application's registrationapplication:read
LimitsRead the plan values in force for your applicationentitlements:read
Usage and analyticsRead usage totals and analytics time seriesanalytics:read
ActivityRead your application's administrative activity logactivity: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

ActionEffectUse it when
RotateIssues a new key. The old key keeps working for a grace period, 24 hours by default, while you deploy the new one.Routine replacement
RevokeEnds the key immediatelyThe 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.

On this page