# UTA Trust API

UTA Trust API verifies AI-agent trust with real Ed25519 signature verification at the edge (Agent Trust Cards, ATC/1.0), sold as an x402 payable resource: 0.01 USDC per card verification on Base Mainnet (eip155:8453) and Base Sepolia (eip155:84532), settled via EIP-3009 through production facilitators (mainnet: PayAI facilitator, facilitator.payai.network; testnet: public x402.org facilitator). Any autonomous agent can discover, negotiate and pay for a verification without a human: the service answers HTTP 402 with machine-readable payment requirements (body + base64 Payment-Required header), accepts an X-PAYMENT header, and returns an on-chain settlement receipt in the X-PAYMENT-RESPONSE header. No settlement, no 200 — ever.

## Docs
- [Discovery (GET /v1)](https://uta-trust-api.eddyflores100.workers.dev/v1) — machine-readable service description: payTo, asset, facilitator, resources, pricing, usage
- [x402 well-known]( https://uta-trust-api.eddyflores100.workers.dev/.well-known/x402.json) — x402 discovery file: services, network, facilitator, payTo, extensions
- [OpenAPI spec](https://uta-trust-api.eddyflores100.workers.dev/openapi.json) — OpenAPI 3.0 definition of every endpoint
- [Health](https://uta-trust-api.eddyflores100.workers.dev/health) — liveness, pricing, version
- [MCP endpoint](https://uta-trust-api.eddyflores100.workers.dev/mcp) — JSON-RPC 2.0 (initialize, tools/list, tools/call)

## Paid endpoints
- [POST /v1/trust/verify](https://uta-trust-api.eddyflores100.workers.dev/v1/trust/verify) — verify one Agent Trust Card, 0.01 USDC via x402
- [POST /v1/trust/batch](https://uta-trust-api.eddyflores100.workers.dev/v1/trust/batch) — verify 1..10 cards in one settlement, 0.08 USDC via x402

## Code
- [GitHub: universal-trust-adapter](https://github.com/alicelabs-llc/universal-trust-adapter) — reference kit (Apache-2.0), 14/14 conformance vectors, x402-paywall-kit for express/fastapi
- [Invest / Treasury](https://uta-trust-api.eddyflores100.workers.dev/investors.json) — public treasuries (EVM / Solana / Bitcoin) and project metrics for agent investors

## Payment cycle (x402 v2, exact steps for an agent)

1. POST https://uta-trust-api.eddyflores100.workers.dev/v1/trust/verify with Content-Type: application/json and a body like {"card": { ...Agent Trust Card... }} WITHOUT the X-PAYMENT header.
   -> 402 with accepts[] (TWO entries) and the same challenge base64-encoded in the Payment-Required header. accepts[0] = BASE MAINNET (eip155:8453): chainId 8453, USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, amount "10000" (0.01 USDC), payTo 0x39Dddf5aEdb58A559CF195fB8bdF23F0604Bf5Ee, extra { name "USD Coin", version "2" } — REAL money, settled by the PayAI production facilitator. accepts[1] = BASE SEPOLIA (eip155:84532): chainId 84532, USDC 0x036CbD53842c5426634e7929541eC2318f3dCF7e, payTo 0xfD856E89Ac88757C339c67E9717528af0cD1d7Ee, extra { name "USDC", version "2" } — testnet. Choose the entry matching your wallet's network.
2. Build an EIP-3009 transferWithAuthorization for the quoted amount of the entry you chose (EIP-712 domain taken FROM that accept's extra: mainnet name "USD Coin", testnet name "USDC", both version 2; verifyingContract = that entry's asset; chainId = 8453 or 84532). Base64-encode the x402 v2 payload: { x402Version: 2, accepted: <the accept entry you chose, byte-for-byte>, payload: { signature: <65-byte r||s||v hex>, authorization: { from, to, value, validAfter: "0", validBefore: <unix seconds>, nonce: <32-byte hex> } } }. The accepted entry MUST match the offer exactly or the request is rejected.
3. Retry the POST with header X-PAYMENT: <base64 payload>.
   -> 200 with the verification result and X-PAYMENT-RESPONSE (base64 facilitator receipt: success, transaction hash, network <your chosen network>, payer).

## Verification semantics (ATC/1.0)

The edge verifies the card signature over its JCS-canonical signed subtree (card without signature), with the public key pinned to the published trust anchors; self-signed and trust-on-first-use keys are rejected. Validity window is two-sided: issued_at <= now < expires_at, plus status === "active". The 200 response reports per-stage outcomes: signature_verification, trust_anchor_key_selection, expiry_check, status_check, a sha256 digest of the signed subtree, and a coarse risk band (low | elevated | high | info).

## Errors

- 402: no X-PAYMENT header, invalid encoding, wrong x402Version, payment verification failure, or settlement failure (the error field says which). Nothing is charged unless the facilitator settles on-chain.
- 400: batch without 1..10 cards (the settlement receipt is still returned).
- GET en recurso pagado: 402 challenge (discovery). 405: otros métodos erróneos. 404: unknown path.

## Conformance

Reference scorer score-runner.mjs v1.5.0 semantics; 14/14 published ATC/1.0 vectors. Canonical repo: github.com/alicelabs-llc/universal-trust-adapter.
