# UseOneID — Comprehensive Platform Documentation for Humans & AI Agents

> Positioning: Global 1-Click Reusable Identity, Transaction Monitoring & AI Agent Authority Infrastructure (190+ countries & jurisdictions).
> Canonical URL: https://useoneid.com
> API Base URL: https://useoneid.com/api/v1
> OpenAPI 3.0 Spec: https://useoneid.com/openapi.json
> RS256 JWKS: https://useoneid.com/.well-known/jwks.json
> W3C DID Document: https://useoneid.com/.well-known/did.json (`did:web:useoneid.com`)
> Official React SDK: `npm install @useoneid/react`
> Official MCP Server: `npx -y @useoneid/mcp-server@latest`
> Support: support@useoneid.com

---

## 1. Authentication Rules (Read First)
- **Server-to-server endpoints** authenticate with your secret key: `Authorization: Bearer sk_sandbox_...` or `Authorization: Bearer sk_live_...`.
- A `pk_` key or `client_id` alone does **not** authorize server requests.
- `client_id` is used on the frontend (`<UseOneIDButton />`, `/oauth/authorize`, `<UseOneIDLookup />`).
- All identity JWTs are signed with RS256 and verified statelessly against `https://useoneid.com/.well-known/jwks.json` using standard `jose`.

---

## 2. Core Platform Pillars

### Pillar 1: 1-Click Reusable KYC (Humans)
- Users verify once with a Government ID (ICAO 9303 International Passport, National ID, Driver's License, or regional IDs) + zero-cost pre-flight Layer 1 binary/EXIF anti-tampering forensics (`422 DOCUMENT_TAMPERING_DETECTED` on Canva/Photoshop/iLovePDF fakes) + 3D Passive Face Biometrics across 190+ countries and reuse their verified identity across partner apps in under 5 seconds.
- Optional regional Tier-3 banking enrichment (e.g., consent-gated BVN in Nigeria, protected by mandatory live 3D face biometric verification): `POST /api/v1/consumer/bvn/link`.
- Multi-identifier <50ms account check: `POST /api/v1/verify/lookup-user` (email, phone, global passport, national ID; supports optional `accepted_poa_types` such as `["utility_bill"]` to trigger a 1-step incremental Proof of Address top-up during 1-Click Reuse without re-doing KYC).

### Pillar 2: Global Corporate KYB, 1-Click RKYB & Verified Business Trust Seal
- First-time corporate verification (Registration Number, Corporate Tax ID, UBO Directors, Proof of Business Address across global registries): `POST /api/v1/verify/kyb`.
- 1-Click Reusable KYB for already-verified businesses: `POST /api/v1/verify/rkyb`.
- Public cryptographic Business Trust Seal API: `GET /api/v1/trust-seal/{clientId}` and public verification page at `https://useoneid.com/verify/seal/{clientId}`.

### Pillar 3: Global KYT Transaction Monitoring & Network Trust Shield
- Real-time multi-currency transaction monitoring (USD, EUR, GBP, CAD, NGN, KES, ZAR, GHS, AED, USDT/USDC): `POST /api/v1/transactions/monitor`.
- Detects jurisdiction-aware CTR thresholds (US $10k, EU €10k, UK £10k, NG ₦5M/₦10M, KE, ZA, GH, FATF), structuring/smurfing, rapid pass-through, fan-in/fan-out, cross-platform account-farming velocity, and zero-PII hashed mule destination graphs.
- Returns `decision` (`allow` | `step_up` | `hold` | `block`), `risk_score`, `triggered_rules`, an RS256-signed `decision_token`, and (on `step_up`) a closed-loop 2-second 3D Biometric Step-Up URL.
- Query flagged alerts: `GET /api/v1/transactions/alerts`.
- Shared cross-network risk telemetry: `POST /api/v1/risk/events` and `GET /api/v1/risk/score`.
- Standalone Document Forensics & Tampering Detection (PDFs, bank statements, payslips, utility bills, invoices, corporate filings): `POST /api/v1/verify/document-forensics` (binary PDF `/Producer`/`/Creator`, incremental `xref` revisions, font injection, EXIF/XMP editor traces, cross-account SHA-256 recycled-document detection, and Production Vision AI financial balance reconciliation; returns RS256 `forensics_token`, `verdict`, `tamper_score`, and `indicators`; metered at `$0.45` in Production, free in Sandbox).

### Pillar 4: Proof of Personhood (Human-vs-AI) & Consumer Emergency Freeze
- Cryptographic Proof of Personhood (stops AI bots, Sybil farms, fake reviews, ticket scalping): `POST /api/v1/verify/human`.
- 1-Tap Consumer Emergency Identity Freeze (freezes reuse across all connected apps, revokes KYA™ AI agents, and broadcasts `identity.frozen` webhooks network-wide): `POST /api/v1/consumer/freeze`.

### Pillar 5: Digital Signatures & Non-Repudiation
- Legally binding SHA-256 + RSA-2048 sealed electronic agreements compliant with US ESIGN/UETA, EU eIDAS, UK ECA, and Evidence Act §84 (supports `"Pending"` consumer app signing/declining + `signature.completed` / `signature.declined` webhooks): `POST /api/v1/partner/signatures` and `GET /api/v1/partner/signatures`.

### Pillar 6: Autonomous AI Agent Authority (KYA™, W3C DID/VC 2.0 & MCP)
- Public W3C `did:web` identity root: `GET /.well-known/did.json` (`did:web:useoneid.com`) exposes UseOneID's RS256 verification key and live KYA control plane service endpoints.
- OAuth-style 1-click consumer consent flow: `GET /kya/authorize?client_id=...&agent_name=...&spending_limit=...&scopes=...&redirect_uri=...` lets end users approve an external AI agent with their Wallet PIN and issues an isolated per-user KYA passport, `agent_did`, and portable W3C Verifiable Credential 2.0 (`verifiable_credential`).
- Bind AI agents (LangChain, CrewAI, AutoGen, Claude, Cursor) to verified human or corporate principals with hard spending caps and allowed actions: `POST /api/v1/kya/bind` (returns both RS256 `kya_token` and portable W3C Verifiable Credential 2.0 with live `credentialStatus`).
- Verify delegated authority, live spending-cap ledger, and revocation status: `POST /api/v1/kya/verify` (metered at `$0.02` per live check in Production via `kya_live_authorization`, free in Sandbox).
- Instant kill-switch revocation: `POST /api/v1/kya/revoke` (optional `reason`, `cascade: false` to spare sub-agents; the record stores who revoked, when and why).
- `agent_id` must be globally unique (duplicates return `409 Conflict`, never overwrite). Names and scopes may repeat. Sub-agents (`parent_agent_id`, max depth 3) can never exceed the parent's spending cap or expiry. Consumers can lower caps or turn off granted scopes (never add) or revoke their own grant from their wallet; this never affects other users of the same agent.
- Model Context Protocol JSON-RPC gateway: `POST /api/v1/kya/mcp` (or `npx -y @useoneid/mcp-server@latest`).

---

## 3. Quickstart Code Examples

### Front-End (`@useoneid/react`)
```tsx
"use client";
import { UseOneIDButton } from "@useoneid/react";

export function VerifyButton() {
  return (
    <UseOneIDButton
      clientId={process.env.NEXT_PUBLIC_USEONEID_CLIENT_ID || "cid_sandbox_demo"}
      redirectUri={typeof window !== "undefined" ? window.location.origin : "https://yourapp.com"}
      onSuccess={async ({ token, user }) => {
        await fetch("/api/auth/useoneid", {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({ token }),
        });
      }}
    />
  );
}
```

### Back-End RS256 Verification (`jose`)
```typescript
import * as jose from "jose";

const JWKS = jose.createRemoteJWKSet(
  new URL("https://useoneid.com/.well-known/jwks.json")
);

export async function verifyUseOneIDToken(token: string) {
  const { payload } = await jose.jwtVerify(token, JWKS, {
    issuer: ["https://auth.useoneid.com", "https://useoneid.com"],
    audience: process.env.USEONEID_CLIENT_ID,
  });
  return payload; // { sub, email, name, kyc_tier, ... }
}
```

### Real-Time KYT Transaction Monitoring
```typescript
const res = await fetch("https://useoneid.com/api/v1/transactions/monitor", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.USEONEID_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    transaction_id: "tx_90218",
    user_id: "usr_abc123",
    amount: 9500,
    currency: "USD", // Supports USD, EUR, GBP, CAD, NGN, KES, ZAR, GHS, AED, USDT/USDC
    direction: "outbound",
    country: "US",   // ISO 3166-1 alpha-2 (190+ countries)
    counterparty_id: "acct_dest_90218",
    channel: "bank_transfer",
  }),
});
const { decision, risk_score, step_up_url, decision_token } = await res.json();
```

### Proof of Personhood (Human-vs-AI)
```typescript
const res = await fetch("https://useoneid.com/api/v1/verify/human", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.USEONEID_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    user_id: "usr_abc123",
    action_scope: "checkout_offer_claim",
    require_biometric: true,
  }),
});
const { is_human, proof_token, uniqueness_hash } = await res.json();
```

### Binding an AI Agent (KYA™)
```typescript
const res = await fetch("https://useoneid.com/api/v1/kya/bind", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.USEONEID_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    client_id: process.env.USEONEID_CLIENT_ID,
    human_sub: "usr_987654",
    agent_id: "agt_procure_v1",
    spending_limit: "1000_USD",
    allowed_actions: ["escrow:transact", "contracts:review"],
  }),
});
```

---

## 4. Webhooks (HMAC-SHA256 Signed)
All webhooks include `x-useoneid-signature: sha256=<hex>` verified via constant-time HMAC-SHA256 against your partner webhook secret.

Supported events:
- `identity.verified` — Consumer completed KYC or 1-Click Reuse
- `kyb.approved` — Corporate KYB or RKYB approved
- `identity.consent_revoked` — Consumer revoked app access in their wallet
- `identity.frozen` — Consumer triggered 1-tap Emergency Identity Freeze (block high-risk actions immediately)
- `identity.unfrozen` — Consumer lifted their Emergency Identity Freeze
- `identity.risk_escalated` — Cross-network fraud/risk threshold crossed for a connected user
- `transaction.flagged` — KYT engine flagged a transaction as `step_up`, `hold`, or `block`
- `kya.agent_bound` — Autonomous AI agent bound to a verified principal
- `document.expiring` — Verified primary government ID approaching expiry (90d, 30d, or 7d automated cron reminders)
- `document.expired` — Verified primary government ID has expired; 1-Click Reuse returns `422 DOCUMENT_EXPIRED` until renewed

---

## 5. Switching to UseOneID (Zero-Downtime Partner Migration)
Partners switching from SmileID, Prembly, Dojah, QoreID, Sumsub, or Persona migrate in 4 steps without disrupting existing users:
1. **Parallel Drop-In (Day 1):** Route new signups and high-risk step-ups through `<UseOneIDButton />` while keeping existing verified users untouched.
2. **Lazy / On-Demand Migration:** When existing users return for a sensitive action (large transfer, tier upgrade, KYC refresh), call `POST /api/v1/verify/lookup-user`. Users already in UseOneID link in 2 seconds via face biometrics; others enroll once in 30 seconds.
3. **Webhook & Claim Mapping:** Map UseOneID's RS256 JWT claims (`sub`, `kyc_tier`, `email`, `name`) and HMAC webhooks (`identity.verified`, `identity.frozen`) to your existing user status columns.
4. **Sunset Legacy Vendor:** Once 100% of new onboarding & step-up flows run on UseOneID, cancel legacy retainers and keep old records read-only for historical audits.
