UniAuth.ID
RESTful + OIDC

API Reference

Complete reference for the UniAuth REST API. Standards-compliant OAuth 2.0, OpenID Connect, SCIM 2.0, and admin endpoints with consistent error handling and rate limiting across every route.

Quick Start

Up and running in three steps

From API key to first authenticated request in under five minutes.

1
Get your API key

Create an account and register an OAuth client in the developer console. You will receive a client_id and client_secret.

# Developer console
https://uniauth.id/account/developer

# Or via Admin API
POST /api/admin/oauth-clients
{
  "name": "My App",
  "redirect_uris": ["https://app.example/cb"]
}
2
Make your first request

Use the token endpoint to exchange an authorization code for an access token and ID token.

curl -X POST https://uniauth.id/api/oauth/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "code=AUTH_CODE" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "client_secret=YOUR_SECRET" \
  -d "redirect_uri=https://app.example/cb" \
  -d "code_verifier=PKCE_VERIFIER"
3
Handle the response

The token endpoint returns an access token, ID token, and refresh token. Use the access token to call protected endpoints.

{
  "access_token": "eyJhbGci...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "dGhpcyBpcyBh...",
  "id_token": "eyJhbGci...",
  "scope": "openid profile email"
}
Endpoints

API endpoints by category

24 endpoints organized into five groups. Every endpoint enforces rate limiting, validates Content-Type, and returns consistent error objects.

Authentication

6 endpoints
POST
/api/auth/login

Authenticate a user with email and password. Returns session token and triggers 2FA if enabled.

POST
/api/auth/register

Create a new user account with email, password, and optional profile fields.

POST
/api/auth/logout

Terminate the current session, revoke tokens, and trigger backchannel/frontchannel logout for OAuth clients.

POST
/api/auth/forgot-password

Send a password reset email with a SHA-256 hashed, time-limited token.

POST
/api/auth/reset-password

Reset password using the token from forgot-password. Enforces password history and strength checks.

POST
/api/auth/verify-email

Confirm email ownership using the verification token sent during registration.

OAuth 2.0 / OIDC

6 endpoints
GET
/api/oauth/authorize

Start the OAuth 2.0 authorization code flow with PKCE. Redirects to login then consent screen.

POST
/api/oauth/token

Exchange authorization code for tokens, refresh tokens, or handle device/client-credentials grants.

GET
/api/oauth/userinfo

Return OIDC claims for the authenticated user. Supports GET and POST per OIDC Core section 5.3.1.

POST
/api/oauth/revoke

Revoke an access token or refresh token. Supports token_type_hint parameter.

POST
/api/oauth/introspect

Inspect a token to determine its active status, scopes, and metadata (RFC 7662).

GET
/.well-known/openid-configuration

OIDC Discovery document with all endpoints, supported scopes, claims, and algorithms.

User Management

4 endpoints
GET
/api/user/profile

Retrieve the authenticated user's full profile including OIDC standard claims and preferences.

PUT
/api/user/profile

Update profile fields: display name, bio, locale, social links, address, and more.

GET
/api/user/sessions

List all active sessions for the authenticated user with device info and last activity.

DELETE
/api/user/sessions

Revoke a specific session by ID or all other sessions (password change invalidation).

SCIM 2.0 Provisioning

4 endpoints
GET
/api/scim/v2/Users

List or search users with SCIM filter syntax. Supports pagination and attribute projection.

POST
/api/scim/v2/Users

Provision a new user via SCIM. Maps SCIM user resource schema to the UniAuth users table.

GET
/api/scim/v2/Groups

List or search groups. Includes member references and supports filter queries.

POST
/api/scim/v2/Bulk

Execute multiple SCIM operations in a single request. Max 100 operations per batch.

Admin

4 endpoints
GET
/api/admin/users

List all users with pagination, search, role filter, and sort. Admin or moderator role required.

GET
/api/admin/analytics

Retrieve platform analytics: DAU/WAU/MAU, login trends, 2FA adoption, auth method breakdown.

GET
/api/admin/audit-events

Query the tamper-proof audit trail. Filter by category, actor, target, date range, and event type.

POST
/api/admin/webhooks

Register a webhook endpoint with event subscriptions and HMAC-SHA256 signing secret.

Authentication

API authentication methods

Four ways to authenticate API requests, depending on the endpoint and use case.

Bearer Token

Pass the access token in the Authorization header. Used for OAuth-protected endpoints like userinfo, token introspection, and client-to-client API calls.

GET /api/oauth/userinfo
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
Accept: application/json
Cookie-Based Session

First-party requests use an HttpOnly, Secure, SameSite=Lax cookie set after login. Used for user-facing pages and the account/admin APIs.

GET /api/user/profile
Cookie: auth_token=eyJhbGci...
# HttpOnly — not accessible via JS
# SameSite=Lax — CSRF protection
DPoP (Proof-of-Possession)

RFC 9449 DPoP binds tokens to a specific client key. Send the DPoP proof JWT alongside the access token. Prevents token theft and replay.

GET /api/oauth/userinfo
Authorization: DPoP eyJhbGci...
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIs...
# Proof JWT includes htm, htu, iat, jti
SCIM Bearer Token

SCIM provisioning endpoints authenticate via a dedicated SCIM token per OAuth client. The token is stored as a SHA-256 hash and scoped to an organization.

GET /api/scim/v2/Users
Authorization: Bearer scim_token_abc123...
Content-Type: application/scim+json
SDKs

Official client libraries

Typed SDKs for JavaScript and React with PKCE, token lifecycle, and logout built in.

JavaScript / TypeScript SDK

@uniauth/js

Vanilla JS client with PKCE, OIDC discovery, automatic token refresh, typed errors, and logout with revocation. Works in Node.js and the browser.

npm install @uniauth/js
SDK reference

React SDK

@uniauth/react

React provider, hooks, and pre-built components: UniAuthProvider, useUser, LoginButton, LogoutButton, ProtectedRoute, and UserProfile.

npm install @uniauth/react
SDK reference
Rate Limits

Per-endpoint rate limits

All endpoints are rate-limited to protect the platform. Limits reset on a 15-minute sliding window.

Sliding window (15 minutes)
POST /api/auth/login
10 requests
15 min
Per IP. Lockout after 5 failures.
POST /api/auth/register
5 requests
15 min
Per IP. Prevents bulk registration.
POST /api/auth/forgot-password
5 requests
15 min
Per IP. No account enumeration.
POST /api/auth/verify-*
10 requests
15 min
Per IP. Covers 2FA and email.
POST /api/scim/v2/Bulk
10 requests
15 min
Per SCIM token. Max 100 ops/batch.
All other endpoints
100 requests
15 min
Per IP or token. Dual-layer enforcement.

Rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining, Retry-After) are included in every response. When Redis is configured, limits are enforced across all server instances.

Start integrating today

Full API access from day one. No credit card required. Read the docs or create a free account to begin.