# Ulexid > Agent-native identity control plane. Complete Customer IAM (CIAM) and Workforce IAM (WIAM) managed via an Agent Control Plane (AIAM). OIDC/OAuth 2.1, SAML 2.0 IdP & SP, SCIM 2.0 directory sync, passkeys, 34 webhook events, immutable hash-chained audit logging, and zero-touch RFC 8628 consent onboarding. Deterministic, scriptable, no browser, no DNS, no MFA app. Read for a model, not a person. **Base URL:** `https://ulexid.com` (hosted) or `http://127.0.0.1:3001` (local in-memory server via `npx @ulexid/mcp-server`) **Auth:** `Authorization: Bearer ulex_sk_live_…` (control plane) or a user access token (OIDC). **MCP:** `POST|GET|DELETE {base}/mcp`, Streamable HTTP, protocol 2025-06-18, 113 tools. Also `npx @ulexid/mcp-server` over stdio. Tenant context comes from the credential and is never a tool argument. **Errors:** one envelope everywhere — `{ error: { type, code, message, param?, request_id, retryable, docs_url?, hint?, details? } }`. Branch on `code`; back off on `retryable`. **Surface:** 129 REST operations · 113 MCP tools · `openapi.json` (OpenAPI 3.1) · `llms-full.txt` (every page, verbatim) **Start here, in order:** [agent manual](https://docs.ulexid.com/agents/agent-manual) (ten operating rules) → [quickstart](https://docs.ulexid.com/quickstart) (a working backend in under 60 s, four ways) → [MCP tools](https://docs.ulexid.com/agents/mcp-tools) (all 113, with schemas for the 20 that matter) → [patterns](https://docs.ulexid.com/agents/patterns) (nine copy-paste recipes). Every page is indexed at the bottom of this file. ## The ten rules 1. Never pass a secret as a tool argument. Use `env:VAR_NAME`, which ulex reads from its own environment. 2. Never pass `environment`. It is derived from the credential. A tool that takes one is a bug. 3. Read `error.retryable`, not the status. `false` means the request is wrong; retrying cannot help. 4. Always send `Idempotency-Key` on a create. A replay returns the original response byte for byte. 5. Prefer `ulex_bootstrap_app` over assembling primitives. Idempotent on `(application_name, organization_domain)`. 6. Prefer `ulex_simulate_login` over driving `/oauth2/authorize`. Same transaction, real code, no browser. 7. Paginate until `has_more` is `false`. `next_cursor` is opaque; pass it back verbatim as `starting_after`. 8. Create then **activate** a connection. A `draft` connection refuses every login with `connection_not_active`. 9. Rotate with the grace window, never in place. Use `previous_secret_expires_at` and the overlapping JWKS. 10. Report the audit trail, not your intentions. `ulex_search_audit_logs` on your own `request_id` is the deliverable. ## A token in three calls | # | Call | Arguments | Returns | | --- | --- | --- | --- | | 1 | `ulex_simulate_login` | `application_id`, `email` | `session_id`, `code`, `amr`, `acr` | | 2 | `ulex_exchange_code_for_tokens` | `application_id`, `code`, `redirect_uri`, `code_verifier` | `access_token`, `refresh_token`, `id_token` | | 3 | `ulex_introspect_token` | `token` | `{ active: true, sub, org_id, sid }` | The RFC 7636 test vector is hard-wired for `mock_sso`, so there is no PKCE maths on the first try: `code_verifier = dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk`, `code_challenge = E9MelhoQ2YvW96fl8sW7aTtZbGd0mY6Xl0e8Q1sCk`. Omit `return_pkce` and that pair applies automatically. ## Bootstrap in one call **`ulex_bootstrap_app`** takes `application_name`, `organization_name`, `organization_domain`, `admin_email`, `connection_strategy`, `create_scim_directory` and returns an application, client secret, organization, verified domain, active connection, admin user, owner membership, group, directory, SCIM bearer token and optional webhook. **The client secret and the SCIM token are returned exactly once.** It is idempotent on `(application_name, organization_domain)`, so a retry is free. ## The data model Every resource is `{ id, object, ...fields }`. Ids are prefixed, ULID-suffixed, and sort by creation time. **`users` are tenant-global** — one `usr_…`, many customers, joined by `organization_membership` with `role` ∈ `owner|admin|member|guest`; `email` is unique per tenant, not per organization. | Prefix | Object | Prefix | Object | Prefix | Object | | --- | --- | --- | --- | --- | --- | | `ten_` | tenant | `con_` | connection | `key_` | api_key, signing_key | | `app_` | application | `dom_` | domain | `whk_` | webhook | | `org_` | organization | `mem_` | organization_membership | `dlv_` | webhook_delivery | | `usr_` | user | `grp_` | group | `aud_` | audit_event | | `dir_` | directory | `job_` | directory_sync, auth_attempt | `dep_` | deployment | | `pol_` | auth_policy | `ses_` | session | `psk_` | passkey | | `mfa_` | mfa_factor | `grt_` | authorization_grant | `tok_` | refresh_token | ## Scopes `mcp:tools` · `read:*` / `write:*` for organizations, users, groups, connections, directories, applications, webhooks, audit_logs, deployments · `scim:provision` · `saml:consume` · `openid` `profile` `email` `offline_access`. Admin-only, rejected at mint time for a non-admin key: `ulex:admin` · `mcp:admin` · `sso:impersonate`. Recommended bootstrap key: `["mcp:tools","read:organizations","write:organizations","read:users","write:users","read:groups","write:groups","read:applications","write:applications","read:connections","write:connections","read:audit_logs"]` ## Connection strategies `mock_sso` · `password` · `magic_link` · `otp_email` · `oidc` · `google_oidc` · `microsoft_oidc` · `entra_oidc` · `okta_oidc` · `github_oidc` · `apple_oidc` · `generic_oauth2` · `saml` · `scim` · `directory_sync` · `jwt_bearer` · `x509_client_cert` · `impersonation_only` `mock_sso` is the default for agent work: real sessions, real grants, real RS256 JWTs, real audit events, zero external setup. Strategy config lives under `config.oidc`, `config.saml`, `config.scim`, `config.password`, `config.mock`, `config.jwt`. Sending any other namespace is `400 unknown_parameter`. ## Errors you will actually hit | Code | Status | Retryable | Do this | | --- | --- | --- | --- | | `connection_not_active` | 403 | no | `POST /connections/{id}/activate` | | `invalid_grant` | 400 | no | a code was exchanged twice, or the redirect_uri mismatched. **Log in again; do not retry** | | `invalid_token` | 401 | no | the token's `iss` does not match this issuer or the key rotated | | `invalid_pkce_verifier` | 400 | no | `code_challenge = BASE64URL(SHA256(ASCII(code_verifier)))` | | `resource_exists` | 409 | no | the object exists — that is often what you wanted. Reuse the id | | `insufficient_scope` | 403 | no | read `hint`; it names the exact scope | | `domain_not_verified` | 412 | no | `POST /organizations/{id}/domains/{domainId}/verify` | | `too_many_requests` | 429 | no | honor `Retry-After`; per-IP request shield limit | | `saml_signature_invalid` | 400 | no | re-upload `x509_certificate`, then re-verify and re-activate | | `scim_conflict` | 409 | no | `userName` or `externalId` already exists. Reconcile; do not retry | `retryable: true` is a closed set: `internal_error`, `service_unavailable`, `timeout`, `webhook_delivery_failed`, `deployment_failed`, `scim_bulk_failed`. ## Limits General routes: 600 sustained/minute, 1,200 burst per source IP and Lambda container · authentication/token routes: 60/minute, 120 burst · request body 2 MiB · page `limit` 1–200 (default 20) · Bulk 100 ops/request · access tokens 3,600 s · refresh 30 d and rotating · sessions 24 h absolute, 7 d idle. Pricing is usage-based; no plan quotas apply. ## Every page ### Start - [Ulexid — Agent-Native Identity Control Plane](https://docs.ulexid.com/index): OIDC/OAuth 2.1, SAML 2.0 IdP & SP, SCIM 2.0, cross-app SSO, directory sync, MFA and passkeys, JWT sessions, webhooks, an immutable audit log, and environment deployments. Deterministic, scriptable, no browser, no DNS, no MFA app. - [Quickstart](https://docs.ulexid.com/quickstart): Deploy a complete ulex identity backend — application, organization, domain, mock SSO connection, admin user, and usable credentials — in under 60 seconds, over MCP, REST, the CLI, or raw JSON-RPC. Includes a real token exchange and a cleanup. ### Agents › Orientation - [Agent manual](https://docs.ulexid.com/agents/agent-manual): The operating manual for agents using ulex: ten rules, scope selection, error and retry semantics, idempotency, cursor pagination, rate limits, when to use mock_sso versus a real strategy, the get-a-token-in-three-calls recipe, and a full end-to-end build-and-report recipe. ### Agents › Reference - [MCP tools reference](https://docs.ulexid.com/agents/mcp-tools): All 113 ulex MCP tools in one table — tool name, purpose, required arguments, return shape, and idempotency — plus full JSON schemas, example arguments, and example results for the 20 tools an agent reaches for first. - [Patterns](https://docs.ulexid.com/agents/patterns): Nine copy-paste recipes for ulex: multi-tenant onboarding, just-in-time provisioning, the full SCIM lifecycle, SAML SP wiring, headless SSO testing, a webhook receiver with signature verification, zero-downtime credential rotation, auditing your own actions, and migrating from the simulator to a real IdP. ### Guides › Protocols - [OIDC client integration](https://docs.ulexid.com/guides/oidc-client-integration): Wire an application to ulex as an OpenID Connect client: discovery, dynamic client setup, PKCE, the authorization code flow, token storage, JWKS verification, logout, and how to test it without a browser. - [SAML SP integration](https://docs.ulexid.com/guides/saml-sp-integration): Wire a real application as a SAML 2.0 service provider against ulex: SP metadata, ACS configuration, signature and clock-skew requirements, group and role claims, IdP-initiated login, single logout, certificate rotation, and headless testing. - [SCIM provisioning](https://docs.ulexid.com/guides/scim-provisioning): Provision users and groups from Okta, Entra ID or Google Workspace into ulex over SCIM 2.0: register a directory, paste the base URL and token, handle create/update/deactivate, use Bulk for large directories, and verify the whole loop. ### Guides › Identity flows - [Hosted login](https://docs.ulexid.com/guides/hosted-login): ulex's hosted sign-in UI: endpoints, branding, localization, organization and connection selection, pre-filling, error states, and why an agent should use ulex_simulate_login instead of driving the browser flow. - [Cross-app SSO](https://docs.ulexid.com/guides/cross-app-sso): How ulex's shared session cookie gives a human one sign-in across every application in a tenant: enabling it, cookie domain and SameSite, session application_ids, the silent-renewal loop, and what happens when it is turned off. - [MFA and passkeys](https://docs.ulexid.com/guides/mfa-and-passkeys): ulex strong authentication: MFA factors, TOTP, WebAuthn passkeys with clone detection, MFA policy limitations, the amr and acr claims, headless MFA simulation for agents, and what is never stored. - [Directory sync](https://docs.ulexid.com/guides/directory-sync): Poll an upstream Okta, Entra ID, Google Workspace or SCIM directory into ulex: connection setup, provider quirks, filters, attribute mapping, deprovisioning, sync-run state, and how to keep the MCP call budget under control. ### Guides › Building & shipping - [Webhooks](https://docs.ulexid.com/guides/webhooks): Receive ulex identity events safely: the exact payload, HMAC-SHA256 signature verification with constant-time comparison, idempotent processing, the retry schedule, the auto-disable threshold, ordering, and a complete receiver you can copy. ### API › Core - [Authentication](https://docs.ulexid.com/api-reference/authentication): How to authenticate to ulex: API keys, user access tokens, OAuth 2.1 client credentials, the full scope list, request headers, token lifetimes, MCP authentication including RFC 9728 protected-resource metadata, and how to mint and revoke keys. - [Errors](https://docs.ulexid.com/api-reference/errors): The single ulex error envelope: type, code, message, param, request_id, retryable, docs_url, hint, details. Every error code with its HTTP status, whether it is retryable, its causes, and its fix. - [Pagination](https://docs.ulexid.com/api-reference/pagination): ulex cursor pagination: the list envelope, starting_after and ending_before, limit bounds, order and ULID ordering, next_cursor semantics, filters versus pagination, SCIM's startIndex and count, and audit-log and export paging. - [Rate limits](https://docs.ulexid.com/api-reference/rate-limits): Per-IP request-rate limits, burst capacity, request-size limits, and 429 handling. Pricing is usage-based; there are no plan quotas. - [Idempotency](https://docs.ulexid.com/api-reference/idempotency): How ulex deduplicates writes: the Idempotency-Key header, the 24-hour replay window, response replay semantics, conflicts on replay, how it differs from X-Ulex-Request-Id, natural-key idempotency in MCP tools, and the operations that are never idempotent. ### API › Resources - [Organizations](https://docs.ulexid.com/api-reference/organizations): ulex Organizations API: create, read, update and delete customer organizations; verified email domains with TXT challenges; organization memberships with owner/admin/member/guest roles; and organization-scoped groups. - [Users](https://docs.ulexid.com/api-reference/users): ulex Users API: tenant-global user records, the SCIM sub-attributes, status transitions including suspend and unsuspend, listing and filtering, memberships across organizations, and bulk JIT provisioning. - [Connections](https://docs.ulexid.com/api-reference/connections): ulex Connections API: all eighteen config.strategy values, per-strategy configuration, connection states, activation, domain routing, OIDC discovery verification, SAML metadata, SP-initiated and IdP-initiated login, ACS, and SLO. - [SCIM 2.0](https://docs.ulexid.com/api-reference/scim): ulex SCIM 2.0 API: inbound provisioning for Okta, Entra ID and Google Workspace, ServiceProviderConfig, Schemas, ResourceTypes, Users and Groups CRUD, PatchOp, Bulk, ListResponse and filter syntax, and the directory sync loop that runs the other direction. - [SAML 2.0](https://docs.ulexid.com/api-reference/saml): ulex as a SAML 2.0 identity provider: SP metadata, SP-initiated login, the Assertion Consumer Service, IdP-initiated SSO, Single Logout, signature and clock-skew validation, attribute mapping, and certificate rotation. - [OAuth 2.1 and OIDC](https://docs.ulexid.com/api-reference/oauth-oidc): ulex OAuth 2.1 and OpenID Connect: discovery, the authorization endpoint, the token endpoint, PKCE, refresh rotation, introspection, revocation, JWKS, userinfo, token exchange, device flow, and the hosted sign-in endpoints. ### API › Platform - [Webhooks](https://docs.ulexid.com/api-reference/webhooks): ulex webhooks: all 34 event types, the exact delivery payload, HMAC-SHA256 signature verification, retry schedule with exponential backoff, the auto-disable threshold, delivery inspection, and idempotency guidance. - [Audit logs](https://docs.ulexid.com/api-reference/audit-logs): ulex's immutable, hash-chained audit log: 48 actions across 8 categories, pseudonymous actors, queryable facets, chain verification, NDJSON and CSV export, and retention. - [Deployments](https://docs.ulexid.com/api-reference/deployments): ulex deployment simulation: the ten-state lifecycle, strategies, step logs, resources and issued credentials, progress tracking, and cancel and rollback. ### API › Schemas - [OIDC claim reference](https://docs.ulexid.com/oidc/claim-reference): Every claim ulex issues in an access token, id_token, userinfo response, and SAML assertion: which scope unlocks it, its exact type, when it is present, and how to request custom claims. - [SAML metadata reference](https://docs.ulexid.com/saml/metadata-reference): ulex's SAML 2.0 metadata documents in full: IdP metadata for relying parties, SP metadata for upstream IdPs, every element, every binding, every ulex extension, and how to read the entityID, ACS and SLO URLs. - [SCIM schema reference](https://docs.ulexid.com/scim/schema-reference): The exact SCIM 2.0 schemas ulex implements: ServiceProviderConfig, the core User and Group schemas with every sub-attribute and mutability rule, PatchOp, Bulk, ListResponse and Error, plus the filter grammar ulex accepts. ### Operations › Running ulex - [Deployments](https://docs.ulexid.com/operations/deployments): Operating ulex deployments: the ten-state machine, what ulex does and does not do during a deployment, polling correctly, reading structured logs, cancel, rollback, and the failure modes worth automating. - [Observability](https://docs.ulexid.com/operations/observability): What ulex exposes for monitoring: health, status, rate-limit headers, request and correlation ids, the audit log, webhook deliveries, directory sync runs, auth attempts, metrics names, and the alerts worth having. - [Runbooks](https://docs.ulexid.com/operations/runbooks): Twelve copy-paste runbooks for ulex: a login that always 401s, a SAML signature failure, a stuck directory sync, a dark webhook endpoint, a leaked API key, a stuck deployment, an org that cannot enable SSO, a duplicate-user problem, a quota wall, a JWKS rotation break, and how to verify the audit chain. - [Incident response](https://docs.ulexid.com/operations/incident-response): How ulex behaves during an incident and what you should do about it: severity definitions, the first five minutes, credential compromise, a leaked signing key, a stuck webhook, a broken directory, replay detection, and post-incident evidence. ### Security › Fundamentals - [Authentication](https://docs.ulexid.com/security/authentication): How ulex authenticates callers and subjects: API key format and storage, OAuth 2.1 with mandatory PKCE, the hosted UI, SAML, device flow, token exchange, and the six rules that keep credentials out of logs. - [Authorization](https://docs.ulexid.com/security/authorization): ulex's authorization model: the full scope list with what each grants, tenant isolation, organization membership roles, the auth policy, per-application restrictions, how impersonation is gated and audited, and how to choose the narrowest scope that works. - [Data protection](https://docs.ulexid.com/security/data-protection): What ulex stores, what it never stores, how it is encrypted at rest and in transit, retention windows, PHI minimisation, the data-residency promise, and how to export or delete a tenant's data. - [Key management](https://docs.ulexid.com/security/key-management): ulex's cryptographic key hierarchy: the AWS KMS CMK, per-tenant data keys, token signing keys with overlapping rotation, SAML certificates, webhook secrets, API keys, and the exact procedure for every rotation. ### Security › Assurance - [Threat model](https://docs.ulexid.com/security/threat-model): ulex's threat model: assets, trust boundaries, adversaries, abuse cases, and what is deliberately not defended — with the mitigations and the accepted risks stated plainly. - [Secret scanning](https://docs.ulexid.com/security/secret-scanning): How ulex prevents credentials from reaching logs, prompts, and git: the pre-write scrubber and its patterns, gitleaks in CI, the agent transcript problem, what to do when a key is found, and the redaction rules for audit metadata. - [Compliance matrix](https://docs.ulexid.com/security/compliance-matrix): ulex's control matrix: every documented control mapped to its implementation, the framework it satisfies, and the evidence you can pull yourself. Includes the controls ulex does not have, stated plainly. ### Security › Regulated workloads - [SOC 2](https://docs.ulexid.com/security/soc2): ulex's SOC 2 Type II posture: what the report covers, the Trust Services Criteria mapped to controls, the audit period, evidence you can produce yourself, what is out of scope, and how to get the report. - [HIPAA](https://docs.ulexid.com/security/hipaa): ulex's HIPAA posture: the Business Associate Agreement, what a covered entity can and cannot do with a simulator, technical safeguards mapped to 45 CFR 164.312, the shared-responsibility split, and the limits of this posture. - [PHI handling](https://docs.ulexid.com/security/hipaa-phi-handling): What ulex stores, what counts as PHI in an identity system, the pseudonymisation rules, exactly which fields are safe and which are not, how to configure a tenant for a regulated workload, and the mistakes that turn identity data into PHI. ### Security › Disclosure - [Responsible disclosure](https://docs.ulexid.com/security/responsible-disclosure): ulex's vulnerability disclosure programme: scope, what counts as a valid finding, severity classification, safe-harbour terms, the bug bounty, and what is explicitly not a vulnerability. - [Vulnerability disclosure programme](https://docs.ulexid.com/security/vulnerability-disclosure): ulex's VDP scope, the security.txt policy, the coordinated disclosure timeline, the states a report moves through, and what a triage engineer does in the first 24 hours. ### Resources › Troubleshooting - [Common errors](https://docs.ulexid.com/troubleshooting/common-errors): The ulex errors you will actually hit, each with its cause, a diagnosis command, and a fix. Grouped by where you hit them, with the three that account for most failures at the top. - [Status codes](https://docs.ulexid.com/troubleshooting/status-codes): Every HTTP status ulex returns, what it means for each surface, which are retryable, the ulex error code that goes with each, and the status codes a well-behaved client should special-case. - [SAML issues](https://docs.ulexid.com/troubleshooting/saml-issues): Diagnosing ulex SAML: the seven failure modes, what each means, the verification checklist, certificate rotation, clock skew, attribute mapping, replay, and a headless way to reproduce a customer's IdP behaviour. - [SCIM issues](https://docs.ulexid.com/troubleshooting/scim-issues): Diagnosing ulex SCIM in both directions: why an IdP's test connection fails, 409 uniqueness, 412 mutability, invalidFilter, users provisioned but unable to log in, deprovisioning reaching the wrong scope, and Bulk partial failures. - [MCP issues](https://docs.ulexid.com/troubleshooting/mcp-issues): Troubleshooting the ulex MCP endpoint: transport and session headers, JSON-RPC versus tool errors, authentication and RFC 9728, SSE parsing, common client misconfigurations, rate limits, and how to inspect a session by hand. ### Resources › Project - [Architecture](https://docs.ulexid.com/resources/architecture): How ulex is built: the request path, the Lambda and DynamoDB topology, the data model, the MCP server, the worker queues, the audit chain, and the six diagrams that explain it. - [Limits](https://docs.ulexid.com/resources/limits): Every hard limit in ulex: request size, array and string lengths, pagination bounds, rate limits, plan quotas, token lifetimes, SAML and SCIM constraints, and what happens when you hit each one. - [Glossary](https://docs.ulexid.com/resources/glossary): ulex terminology: every protocol, protocol-adjacent, and ulex-specific term defined, with the RFC or spec it comes from where there is one. - [Compliance certifications](https://docs.ulexid.com/resources/compliance-certifications): ulex's certifications and attestations: SOC 2 Type II, HIPAA BAA, GDPR DPA, penetration testing, subprocessor list, and what is deliberately not certified. - [Changelog](https://docs.ulexid.com/resources/changelog): ulex's release history: what changed, what is deprecated, and what an agent needs to know about each version. Semantic versioning, wire-stability guarantees, and the deprecation timeline. - [Deprecations](https://docs.ulexid.com/resources/deprecations): ulex's deprecation policy: the 6-month timeline, what happens at each stage, how to detect a deprecation from the API, and every deprecation that has been completed. - [Support](https://docs.ulexid.com/resources/support): How to get help with ulex: what to include so an answer takes one message, severity and response targets, the channels, the roadmap, and how to escalate a security issue. ## Machine-readable [openapi.json](https://docs.ulexid.com/openapi.json) (OpenAPI 3.1, every operation, `x-ulex-mcp-tool` naming the tool that wraps it) · [llms-full.txt](https://docs.ulexid.com/llms-full.txt) (every page, verbatim, with delimiters) · [mcp.json](https://docs.ulexid.com/mcp.json) (the hosted docs MCP server). ## Ulexid is not It does not authenticate real humans, deliver email, sign with a CA-issued certificate, or run your application's code during a deployment. It models an identity backend faithfully and gives you a safe place to build and test against it. If you need a real identity control plane for a covered entity, that is a conversation with support, not with this file.