API And SDK Reference¶
Use this reference to choose the right SigID API surface, SDK package, example app, and follow-up guide for your integration. For first-task onboarding, start with SDKs And Examples.
What this page is for¶
Start here when you need to:
- choose between OAuth, hosted auth, tenant APIs, SCIM, webhooks, and agent integrations
- pick the right TypeScript, framework, mobile, desktop, or backend SDK
- find a working example app for your runtime
- understand request, retry, error, and logging rules that apply across APIs
For a first login flow, start with Add Login To Your App. For OAuth and OIDC behavior, read OAuth And OIDC.
On This Page¶
- Before you start
- Choose an integration path
- API surfaces
- OpenAPI reference
- TypeScript and framework SDKs
- Backend SDKs
- Example apps
- Request rules
- Security rules
Before you start¶
Get these values from the tenant owner, administrator, or platform team:
| Value | Used for |
|---|---|
SIGID_ISSUER_URL |
API base URL, discovery, OAuth endpoints, and hosted auth |
| Tenant ID or tenant slug | Tenant isolation, support, logs, and troubleshooting |
SIGID_CLIENT_ID |
OAuth requests and SDK configuration |
| Redirect URI | Browser, mobile, desktop, and framework callback handling |
| Access token | Calling tenant APIs, management APIs, or backend resources |
| Required scopes | API authorization and least-privilege access |
| API audience | Backend access-token validation |
| Token endpoint auth method | OAuth token exchange for public or confidential clients |
| Webhook signing secret | Receiver verification, if your integration consumes events |
Keep issuer, tenant, client ID, redirect URI, scopes, and audience from the same environment. Do not mix development, staging, and production values.
Choose an integration path¶
| I need to... | Start here | Then read |
|---|---|---|
| Add login | Add SigID Login | OAuth And OIDC |
| Protect a backend API | Verify Tokens | OAuth And OIDC |
| Use a frontend framework SDK | TypeScript and framework SDKs | Matching example app |
| Use a backend SDK | Backend SDKs | OpenAPI reference |
| Manage tenant users | Users And Login Methods | Request rules |
| Manage organizations, SSO, or SCIM | Organizations And SSO | Request rules |
| Receive signed events | Webhook Events | Security rules |
| Build agent or MCP integration | Agent And MCP Auth | OAuth And OIDC, Claims And Scopes |
API surfaces¶
| Surface | Base path | Use | Auth model |
|---|---|---|---|
| OAuth/OIDC | /oauth/*, /.well-known/*, /userinfo |
Login, token exchange, discovery, JWKS, UserInfo | OAuth client auth, bearer tokens, or public discovery |
| Hosted auth | /auth/* |
Hosted sign-in, session, recovery, and account flows | Browser session and OAuth flow state |
| Tenant APIs | /api/v1/* |
Tenant-scoped applications, users, organizations, policies, agents, billing, and audit workflows where enabled | Bearer token with tenant context and scopes |
| Control plane | /api/v1/control-plane/* |
Platform-level tenant and instance operations | Control-plane operator token |
| SCIM | /scim/v2/* |
Directory provisioning for enterprise tenants where enabled | SCIM bearer token |
| OpenAPI | /openapi.json |
Machine-readable API schema when enabled | Public only when the deployment exposes OpenAPI |
| Webhooks | Your receiver URL | Signed asynchronous events sent by SigID | HMAC-signed delivery from SigID |
Use the protocol-specific guides for integration order and safety rules. Use the OpenAPI schema for exact request and response shapes.
OpenAPI reference¶
SigID splits OpenAPI into two exposures:
| Exposure | Config | Safe in production? | Contents |
|---|---|---|---|
| public | openapi.enabled = true, openapi.exposure = "public" |
Yes | Integrator subset on the auth plane (same host as discovery): OAuth token/PAR/revoke/introspect/register/end-session, health, capabilities, agent auth, public commerce (/pay/{token}, public checkout/x402) |
| internal | openapi.enabled = true, openapi.exposure = "internal" (default when enabled in dev) |
No – rejected under security.production |
Full operator/control-plane/billing/identity surface |
When enabled:
Committed snapshots in the repository:
openapi-public.json– public integrator document (regenerate viaSIGID_WRITE_OPENAPI_PUBLIC=1 cargo test --no-fail-fast -p sigid-server --features openapi --lib routes::openapi::tests::public_document_excludes_control_plane_and_billing)openapi.json– historical full snapshot used for version lockstep; do not assume production serves it
Agents integrating third-party apps should use public OpenAPI + discovery, not the internal document. Commerce merchant admin routes are documented in Sell Access With SigID Commerce, not the public OpenAPI file.
TypeScript and framework SDKs¶
For agent identity, workspace bootstrap, and human delegation from Node.js/Bun,
see the JavaScript Agent SDK (@sigid/agent; initial
npm publication pending). It uses no native CLI executable.
Install the framework-agnostic client:
Create a hosted-login client:
import { createSigIdClient } from "@sigid/client";
export const sigid = createSigIdClient({
baseURL: "https://auth.example.com",
oauth: {
clientId: "public-client-id",
redirectUri: `${window.location.origin}/auth/callback`,
scopes: ["openid", "profile", "email"],
},
});
// Login button or "start login" action.
await sigid.login();
On the callback page or callback route:
On a logout button or explicit user action:
Use @sigid/next requireAccessToken() for protected API routes. The
Next.js quickstart completes its OAuth
callback in the browser; it does not require a catch-all auth proxy. Lower-level
OAuth helpers createAuthorizationUrl(), exchangeCode(), and oauthSignOut() remain
available for protocol-aware integrations.
For the complete TypeScript / Next.js reference path, see
examples/sdk-lab-next.
Public TypeScript packages (only these exist today):
| Package | Use |
|---|---|
@sigid/start |
Drop-in / CDN two-line login (cdn.sigid.org/v1/sigid.js) |
@sigid/client |
Framework-agnostic browser session + OAuth engine; access-token validation on the server |
@sigid/backend |
Confidential server login, ID-token verification, logout, and webhooks; see Backend SDK |
@sigid/react |
React hooks and session UI |
@sigid/next |
Next.js route handlers and server integration |
@sigid/svelte |
Svelte stores |
@sigid/sveltekit |
SvelteKit hooks and server load integration |
@sigid/cli |
npm wrapper for sigid |
For browser frameworks without a SigID adapter, use @sigid/start or
@sigid/client. There are no @sigid/vue, @sigid/solid, @sigid/solidstart,
@sigid/expo, or @sigid/electron packages. Native and desktop integrations
need an OAuth/OIDC library suited to their runtime; see
SDKs And Examples.
Internal frontend packages such as @sigid/frontend-api-types,
@sigid/frontend-config, and @sigid/frontend-ui support SigID apps in this
repository. They are not the main public SDK entry points.
Backend SDKs¶
Backend SDKs are for server-side OAuth helpers, PKCE, code exchange, client credentials, UserInfo, and tenant-aware API calls. Use OpenAPI for exact resource schemas.
| SDK | Directory | Install | Use |
|---|---|---|---|
| Go | sdks/go |
go get github.com/sigid/sigid/sdks/go |
Go services, CLIs, and infrastructure tooling |
| Rust | sdks/rust |
sigid-sdk = { git = "https://github.com/sigid/sigid", package = "sigid-sdk" } |
Rust services and security-sensitive integrations |
| Elixir | sdks/elixir |
{:sigid, git: "https://github.com/sigid/sigid", sparse: "sdks/elixir"} |
Phoenix, BEAM services, and server-side integrations |
For languages without an official SDK, use the OpenAPI schema to generate a client or call the HTTP APIs directly.
Backend responsibilities:
- store
state, PKCE verifiers, refresh tokens, and client secrets outside browser code - exchange authorization codes with the registered token endpoint auth method
- validate access tokens before serving protected resources
- check tenant context, audience, and scopes
- call tenant, management, or SCIM APIs with the right bearer token
- verify webhook signatures in event receivers
Example apps¶
Use the example closest to your runtime:
| Example | Demonstrates |
|---|---|
examples/next-app |
Next.js route handler, server-side session, and protected page |
examples/sveltekit |
SvelteKit hooks, server load, locals, and protected route |
examples/sigid-start |
Static browser drop-in with an inline callback |
examples/sdk-lab-next |
Browser session, protected API, and a local verification gate; see Run The Example App |
Minimal API request¶
Tenant-scoped API calls use bearer tokens:
Use idempotency keys for retryable writes:
curl -sS "$SIGID_ISSUER_URL/api/v1/webhooks" \
-X POST \
-H "authorization: Bearer $ACCESS_TOKEN" \
-H "content-type: application/json" \
-H "idempotency-key: webhook-create-001" \
-d '{
"url": "https://api.example.com/webhooks/sigid",
"event_types": ["auth.login.success", "tenant_user.suspended"]
}'
If you omit secret, SigID generates a webhook signing secret and returns it
only once. Store it immediately.
Request rules¶
Apply these rules across SigID API integrations:
- use bearer tokens for tenant APIs and management APIs
- use SCIM bearer tokens only for
/scim/v2/* - keep issuer, tenant, client, scope, and audience values from one environment
- send
idempotency-keyon retryable writes when the endpoint supports it - preserve or log
x-request-idvalues for support and incident triage - respect
Retry-Afteron429responses - avoid retrying non-idempotent writes unless you supplied an idempotency key
- log resource IDs, tenant IDs, request IDs, and idempotency keys, but not secrets
Error handling¶
SigID API errors use the RFC 9457 application/problem+json shape. OAuth
protocol endpoints return their protocol-defined error fields separately.
{
"type": "https://sigid.org/errors/bad-request",
"title": "Bad Request",
"status": 400,
"detail": "Bad request"
}
Handle these classes explicitly:
| Class | Developer response |
|---|---|
400 /errors/bad-request |
Fix request shape, missing fields, or unsupported input |
400 invalid_grant |
Restart the OAuth flow or refresh-token flow |
400 invalid_scope |
Request scopes allowed by the application and tenant policy |
401 /errors/unauthorized |
Re-authenticate or refresh token |
401 invalid_client |
Check client authentication method and secret handling |
403 /errors/forbidden |
Check tenant context, role, and policy |
403 insufficient_scope |
Request a token with the required scope |
404 /errors/not-found |
Check tenant context and resource ID |
409 /errors/conflict |
Retry idempotently or refresh local state |
429 /errors/rate-limited |
Respect Retry-After |
5xx /errors/server-error |
Retry safely only with idempotency |
Log request IDs, tenant IDs, resource IDs, and idempotency keys. Do not log access tokens, refresh tokens, client secrets, webhook secrets, MFA codes, or vault credentials.
Rate-limit response headers¶
See the SigID Public API policy for RateLimit, RateLimit-Policy, Retry-After, structured JSON errors, and cross-origin header visibility. Quota fields follow IETF draft-11 Structured Fields syntax; they are not a published RFC.
Versioning And Deprecation¶
The stable public HTTP contract is URL-versioned under /api/v1/*. OAuth 2.1
and OpenID Connect endpoints keep their protocol-standard paths and evolve
only within the compatibility rules of those protocols. Within a published API
major version, SigID adds fields and operations compatibly; it does not silently
change request shapes, response shapes, status codes, or error contracts.
When a stable operation or representation is deprecated, SigID documents the
replacement in the OpenAPI description and changelog, then returns the HTTP
Deprecation response header defined by RFC 9745. When a removal date is known,
the response also carries Sunset and a Link with rel="deprecation" pointing
to migration guidance. Removal of the old contract is reserved for the next
major API version. Clients should record these headers in integration telemetry
and schedule migration before the sunset date; they must not treat absence of a
header as permission to ignore the published compatibility policy.
SigID's product releases follow Semantic Versioning. A product release and an
API path version are related but not identical: compatible product releases may
continue to serve /api/v1, while an incompatible public contract requires a
new major API path and a product major release. The committed OpenAPI document
is the canonical operation and schema inventory for the deployed product
version.
Security rules¶
Before production:
- validate tokens before serving protected APIs
- check issuer, audience, signature, expiration, tenant context, and scopes
- store the validated
subclaim with tenant context as the durable user key - do not use email as a durable user ID
- never expose confidential client secrets in browser, mobile, or desktop code
- store client secrets, refresh tokens, webhook secrets, and SCIM tokens in a secret manager
- verify webhook signatures before parsing event business logic
- scope access tokens and management tokens to the smallest job that needs them
- treat agent and delegated access tokens as different from normal user sessions
Next steps¶
- Add SigID Login for the first local login flow
- OAuth And OIDC for OAuth/OIDC behavior and grant selection
- Verify Tokens for backend authorization requirements
- Webhook Events for signed event receivers
- Agent And MCP Auth for the agent integration overview
- OAuth And OIDC for delegated token-exchange patterns
- Agent And MCP Auth for MCP and tool authorization boundaries
- Users And Login Methods for user lifecycle and tenant membership
- Organizations And SSO for B2B organizations, SSO, and directory provisioning