canonical: https://jentic.com/apis/authgear.com/authgear

# Authgear Authentication Flow API

Jentic publishes the only available OpenAPI specification for Authgear Authentication Flow API, keeping it validated and agent-ready. Authgear is an authentication-as-a-service platform that lets developers build custom signup, login, account-recovery, and re-authentication flows on top of a single API. The Authentication Flow API drives multi-step flows where each state is exchanged for the next via `/states/input`, and a WebSocket endpoint streams progress for real-time UIs. Authgear also exposes standard OAuth 2.0 and OpenID Connect endpoints (`/oauth2/authorize`, `/oauth2/token`, `/oauth2/userinfo`) and admin endpoints for bulk user import and export.

## For AI agents

Drive a multi-step Authgear signup, login, or recovery flow by creating a flow, posting input at each state, and finishing with an OAuth token exchange. Also import and export users in bulk via the admin endpoints.

## Scope

Does not handle fine-grained authorization policies, per-resource permission checks, or audit log streaming - use for authentication flows, OAuth/OIDC, and user lifecycle only.

## Capabilities

- Create signup, login, account-recovery, or reauth flows with POST `/api/v1/authentication_flows`
- Drive a flow forward by posting credentials, OTPs, or selections to `/api/v1/authentication_flows/states/input`
- Inspect the current state of an in-progress flow with POST `/api/v1/authentication_flows/states`
- Run the OAuth 2.0 authorization code flow via `/oauth2/authorize` and `/oauth2/token`
- Retrieve OIDC user claims from `/oauth2/userinfo` and verify tokens against `/oauth2/jwks`
- Bulk-import or export users using `/_api/admin/users/import` and `/_api/admin/users/export`
- Revoke issued OAuth tokens with POST `/oauth2/revoke` when a session is terminated

## Use cases

### Custom login UI on top of Authgear

Build a fully branded login page in your own app while letting Authgear handle credential validation, OTP delivery, and policy enforcement. POST `/api/v1/authentication_flows` starts a flow, the UI displays the prompts returned in each state, and POST `/api/v1/authentication_flows/states/input` advances the flow until an authorization code is issued. The custom UI never touches password hashing or MFA secrets - Authgear does it server-side.

Example prompt: POST `/api/v1/authentication_flows` with type=login, then POST `/api/v1/authentication_flows/states/input` with the user's email, then again with the password to receive a finished flow result

### Standard OAuth 2.0 / OIDC integration

Add 'Sign in with Authgear' to a third-party application using the standard authorization code flow. The app redirects to `/oauth2/authorize`, exchanges the returned code at `/oauth2/token`, and then calls `/oauth2/userinfo` to fetch the user's profile. Token signatures can be verified against `/oauth2/jwks` so downstream services validate tokens without an extra round trip.

Example prompt: Redirect to `/oauth2/authorize` with response_type=code and openid scope, then POST to `/oauth2/token` to exchange the code for an ID token and access token

### Bulk user migration from a legacy system

Migrate users from a legacy IdP into Authgear without forcing password resets. POST `/_api/admin/users/import` accepts a batch of user records and returns a task_id; GET `/_api/admin/users/import/{task_id}` reports per-record success and failure. The complementary export endpoints let teams snapshot the directory before a major change.

Example prompt: POST `/_api/admin/users/import` with a JSON array of user records, then poll GET `/_api/admin/users/import/{task_id}` until status is completed

### Agent-managed account recovery

An AI support agent can drive an account-recovery flow on behalf of a user by creating a recovery flow with type=account_recovery, then posting the recovery code the user received by email or SMS to `/states/input.` Through Jentic the admin API key is held in the credential vault, so the agent only sees the per-flow state token and not the long-lived admin secret.

Example prompt: Create an account_recovery flow, then POST `/api/v1/authentication_flows/states/input` with the user's email and the recovery code to issue a new password

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/api/v1/authentication_flows` | Create a new authentication flow |
| POST | `/api/v1/authentication_flows/states/input` | Advance a flow with user input |
| GET | `/oauth2/authorize` | OAuth 2.0 authorization endpoint |
| POST | `/oauth2/token` | Exchange a code for tokens |
| GET | `/oauth2/userinfo` | Retrieve OIDC user claims |
| POST | `/_api/admin/users/import` | Initiate a bulk user import |
| POST | `/_api/admin/users/export` | Initiate a bulk user export |

## Key resources

- **Authentication Flow** — Multi-step signup, login, recovery, and reauth flows
- **OAuth 2.0 / OIDC** — Standard authorize, token, userinfo, JWKS, and revocation endpoints
- **User Import** — Bulk-import users from legacy systems
- **User Export** — Export the user directory for backup or migration

## Why Jentic

- **Setup:** Wiring the Authgear Authentication Flow API by hand means learning its bearer auth, resolving your per-project host (https://{project}.authgear.cloud), and threading the state token through each step of a multi-stage authentication flow yourself. Through Jentic you install once, import the Authgear Authentication Flow API from the API Directory, store the credential once, and your agent calls it.
- **Permission scoping:** Authgear drives flows through state tokens in the request body rather than resource ids in the URL path, so scope your agent to the operations it needs, such as starting an authentication flow or submitting flow input. Because you choose the allowed operations, admin ones like user import or user export are not included unless you add them.
- **Credential handling:** Your Authgear admin API key and OAuth client secret are stored once, encrypted, by your own Jentic One instance and injected at execution time. They never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'create a login flow' or 'import users', and Jentic returns the matching Authgear operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Auth0 Management API** — Auth0 covers a similar identity-as-a-service surface with broader enterprise SSO connectors
- **Clerk Backend API** — Clerk pairs an authentication API with React, Next.js, and Expo prebuilt components
- **Twilio API** — Twilio delivers the SMS and voice OTPs that an Authgear MFA step requires

## FAQ

### Why is there no official OpenAPI spec for Authgear Authentication Flow API?

Authgear does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call Authgear Authentication Flow API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Authgear Authentication Flow API use?

Authgear uses bearer tokens. End-user endpoints accept the OAuth access token issued at `/oauth2/token`, and admin endpoints under `/_api/admin` require an admin API key sent as a bearer token. Through Jentic both credential types are held in the vault and injected per call, so the agent never handles the raw admin key.

### How do I drive a multi-step login flow with the Authgear API?

POST `/api/v1/authentication_flows` with type=login to create the flow. The response includes a state_token and a list of expected inputs. Submit each input (email, password, OTP) to POST `/api/v1/authentication_flows/states/input`, passing the state_token, until the flow finishes and returns an authorization code.

### Can I bulk-import users into Authgear?

Yes. POST `/_api/admin/users/import` accepts a JSON array of user records and returns a task_id. Poll GET `/_api/admin/users/import/{task_id}` for per-record results. The matching `/_api/admin/users/export` endpoints return a similar task-based response for full directory exports.

### What are the rate limits for the Authgear Authentication Flow API?

Project-specific rate limits are configured per Authgear plan and are not encoded in the OpenAPI spec. Treat /authentication_flows and `/oauth2/token` as user-initiated and apply backoff on 429 responses; check the Authgear dashboard for the active limits on your project.

### How do I exchange an authorization code for tokens through Jentic?

Search Jentic for 'exchange OAuth code for token' and load the `/oauth2/token` operation. Execute it with grant_type=authorization_code, the code, and the redirect_uri to receive an access token, refresh token, and ID token. Get started with Jentic One, the self-hosted execution layer.

### Does Authgear support OpenID Connect discovery?

Yes. GET /.well-known/openid-configuration returns the OIDC discovery document, and GET `/oauth2/jwks` returns the JSON Web Key Set used to verify ID and access token signatures. Standard OIDC client libraries pick these up automatically.

### Can I limit what my agent is allowed to do with the Authgear Authentication Flow API?

Yes. Because you run Jentic One yourself, your own rules decide which Authgear operations and credentials your agent may use. You can scope the agent to just the flow operations it needs, such as creating an authentication flow with POST `/api/v1/authentication_flows` and advancing it via POST `/api/v1/authentication_flows/states/input`, since Authgear passes state through tokens in the request body rather than resource ids in the URL. Admin operations like user import and export under `/_api/admin` stay off limits unless you explicitly add them.
