{"openapi":"3.1.0","info":{"title":"WritersProof API","version":"1.0.0","description":"Certificate Authority and verification API for the Proof-of-Effort protocol. Certify, verify, and prove human authorship.","contact":{"name":"WritersLogic LLC","url":"https://writersproof.com"},"license":{"name":"SSPL-1.0","url":"https://www.mongodb.com/licensing/server-side-public-license"}},"servers":[{"url":"https://api.writersproof.com","description":"Production"},{"url":"https://api.writerslogic.com","description":"Legacy"}],"tags":[{"name":"Health","description":"Service health checks"},{"name":"Sessions","description":"Witnessing session lifecycle: create, submit events, checkpoint, stop, and query"},{"name":"Attestation","description":"Hardware-bound attestation: nonce generation, device enrollment, and evidence submission"},{"name":"Certificates","description":"Issue, retrieve, and revoke authorship certificates"},{"name":"Anchoring","description":"Transparency log anchoring with Merkle inclusion proofs"},{"name":"Verification","description":"Verify evidence packets, WAR blocks, and session evidence"},{"name":"Beacon","description":"Randomness beacon binding (drand + NIST)"},{"name":"Steganography","description":"Zero-width character watermark signing and verification"},{"name":"Declaration","description":"AI tool usage declarations (IPTC-aligned)"},{"name":"Publishing","description":"Register evidence for public verification, with optional notarization"},{"name":"Receipts","description":"Permanent public hosting of process-attestation receipts (CPoE evidence packets)"},{"name":"SaaS","description":"Marketplace subscription management"},{"name":"API Billing","description":"Verification credits and optional automatic purchases (JWT auth only)"},{"name":"API Keys","description":"API key generation and revocation (JWT auth only)"},{"name":"PKI","description":"Public key infrastructure: root CA certificate and CRL"}],"paths":{"/health":{"get":{"tags":["Health"],"operationId":"getHealth","summary":"Health check","description":"Returns service health status including Supabase and KV connectivity.","security":[],"responses":{"200":{"description":"Health status","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"service":{"type":"string","example":"writersproof-api"},"version":{"type":"string","example":"2.0.0"},"checks":{"type":"object","additionalProperties":{"type":"object","properties":{"status":{"type":"string"},"latencyMs":{"type":"number"}}}},"timestamp":{"type":"string","format":"date-time"}}}}}}}}},"/v1/trust-tasks":{"post":{"tags":["Verification"],"operationId":"trustTask","summary":"Answer a process-attestation Trust Task","description":"The HTTPS transport binding of the ToIP Trust Tasks framework (trusttasks.org). Send a `process-attestation/0.1#request` naming a document by digest with a fresh challenge; WritersProof answers as `did:web:api.writersproof.com` with a signed `#response` carrying the published evidence packet (`application/cpoe+cbor`) and the disclosure categories asked for, or `unavailable` where it holds no receipt for that digest. A refused request gets a signed `trust-task-error`. No authentication: the task's authority is possession of the receipt.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"A Trust Task document of type https://trusttasks.org/spec/process-attestation/0.1#request","required":["id","type","issuer","recipient","issuedAt","payload"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","example":"https://trusttasks.org/spec/process-attestation/0.1#request"},"issuer":{"type":"string","description":"The Verifier's DID"},"recipient":{"type":"string","example":"did:web:api.writersproof.com"},"issuedAt":{"type":"string","format":"date-time"},"payload":{"type":"object","required":["artifact","challenge"],"properties":{"artifact":{"type":"object","properties":{"digest":{"type":"string","description":"base64url, unpadded"},"algorithm":{"type":"string","enum":["sha-256","sha-384","sha-512","blake3"]}}},"challenge":{"type":"string","minLength":16,"maxLength":256},"disclosure":{"type":"array","items":{"type":"string","enum":["document","timeline","integrity","anchors"]}}}}}}}}},"responses":{"200":{"description":"A signed process-attestation/0.1#response (result attested or unavailable)","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"A signed trust-task-error (malformedRequest)"},"422":{"description":"A signed trust-task-error (unsupportedType, unsupportedVersion, wrongRecipient, expired, proofInvalid)"},"503":{"description":"A signed trust-task-error (unavailable, retryable)"}}}},"/v1/sessions":{"get":{"tags":["Sessions"],"operationId":"listSessions","summary":"List sessions","description":"List the authenticated user's witnessing sessions, optionally filtered by document ID.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"name":"documentId","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by document ID"}],"responses":{"200":{"description":"Session list","content":{"application/json":{"schema":{"type":"object","properties":{"sessions":{"type":"array","items":{"$ref":"#/components/schemas/SessionSummary"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}},"post":{"tags":["Sessions"],"operationId":"createSession","summary":"Create a witnessing session","description":"Start a new authorship witnessing session for a document.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSessionRequest"}}}},"responses":{"201":{"description":"Session created","content":{"application/json":{"schema":{"type":"object","properties":{"session_id":{"type":"string","format":"uuid"},"status":{"type":"string","example":"active"},"started_at":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/sessions/{id}":{"get":{"tags":["Sessions"],"operationId":"getSession","summary":"Get session details","description":"Retrieve full details of a session owned by the authenticated user.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"responses":{"200":{"description":"Session details","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"$ref":"#/components/schemas/Session"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/sessions/{id}/events":{"post":{"tags":["Sessions"],"operationId":"submitEvents","summary":"Submit event batch","description":"Submit a batch of behavioral events (keystrokes, mouse, focus, etc.) to an active session. Maximum 100 events per batch.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitEventsRequest"}}}},"responses":{"200":{"description":"Events accepted","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"integer"},"event_count":{"type":"integer"},"last_event_at":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Session is not active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sessions/{id}/checkpoint":{"post":{"tags":["Sessions"],"operationId":"createCheckpoint","summary":"Create checkpoint","description":"Create a content checkpoint in the session's hash chain. The checkpoint hash is computed as SHA-256(prev_hash || content_hash || timestamp).","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["content_hash"],"properties":{"content_hash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$","description":"SHA-256 hash of the document content"}}}}}},"responses":{"201":{"description":"Checkpoint created","content":{"application/json":{"schema":{"type":"object","properties":{"checkpoint_id":{"type":"string","format":"uuid"},"sequence":{"type":"integer"},"checkpoint_hash":{"type":"string"},"prev_checkpoint_hash":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Session is not active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sessions/{id}/stop":{"post":{"tags":["Sessions"],"operationId":"stopSession","summary":"Stop session","description":"Stop an active session, compute the evidence score, and return the final verdict.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"responses":{"200":{"description":"Session stopped","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StopSessionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Session is already stopped","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sessions/{id}/finalize":{"post":{"tags":["Sessions"],"operationId":"finalizeSession","summary":"Finalize session (alias for stop)","description":"Alias for POST /v1/sessions/{id}/stop, used by marketplace integrations.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"responses":{"200":{"description":"Session finalized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StopSessionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Session is already stopped","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sessions/{id}/verify":{"get":{"tags":["Sessions"],"operationId":"verifySession","summary":"Verify session evidence","description":"Verify the checkpoint chain integrity and compute the evidence verdict for a session.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionVerifyResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/sessions/{id}/evidence":{"get":{"tags":["Sessions"],"operationId":"getSessionEvidence","summary":"Get evidence summary","description":"Return the session metadata, metrics, and full checkpoint chain.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"responses":{"200":{"description":"Evidence summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvidenceSummaryResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/sessions/{id}/forensics":{"get":{"tags":["Sessions"],"operationId":"getSessionForensics","summary":"Get forensic analysis","description":"Compute behavioral forensic metrics for a completed session, including velocity consistency, cadence naturalness, and forgery cost estimate.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"responses":{"200":{"description":"Forensic analysis","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForensicsResponse"}}}},"400":{"description":"Session must be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/sessions/{id}/timeline":{"get":{"tags":["Sessions"],"operationId":"getSessionTimeline","summary":"Get session timeline","description":"Return a paginated, chronologically sorted interleaving of events and checkpoints.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Timeline","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/TimelineEntry"}},"total":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/sessions/{id}/compliance":{"get":{"tags":["Sessions"],"operationId":"getSessionCompliance","summary":"Get compliance report","description":"Generate a compliance report for a completed session against NIST AI RMF, ISO 42001, IPTC, and WGA/SAG-AFTRA/MBA frameworks.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"$ref":"#/components/parameters/SessionId"}],"responses":{"200":{"description":"Compliance report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Session must be completed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/nonce":{"post":{"tags":["Attestation"],"operationId":"requestNonce","summary":"Request attestation nonce","description":"Generate a cryptographic nonce for hardware-bound attestation. The nonce expires after 300 seconds.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hardwareKeyId"],"properties":{"hardwareKeyId":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"Nonce issued","content":{"application/json":{"schema":{"type":"object","properties":{"nonce":{"type":"string","description":"64-char hex nonce"},"expiresAt":{"type":"string","format":"date-time"},"nonceId":{"type":"string","format":"uuid"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Hardware key not found or not active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/enroll":{"post":{"tags":["Attestation"],"operationId":"enrollDevice","summary":"Enroll hardware key","description":"Register or re-enroll a device's hardware-bound signing key. The deviceId must equal SHA-256(publicKey). Assurance tier is determined by attestation type.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollRequest"}}}},"responses":{"200":{"description":"Device enrolled","content":{"application/json":{"schema":{"type":"object","properties":{"hardwareKeyId":{"type":"string","format":"uuid"},"assuranceTier":{"type":"string","enum":["T1","T2","T3"]},"enrolled":{"type":"boolean","example":true}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/identity":{"post":{"tags":["Attestation"],"operationId":"putIdentityEscrow","summary":"Escrow encrypted author-identity seed","description":"Upload (upsert) the current user's end-to-end-encrypted author-identity seed. The body's `ciphertext` is a JWE Compact string (RFC 7516; PBES2-HS512+A256KW / A256GCM) produced client-side under a user-supplied recovery passphrase. The server only ever stores ciphertext; it cannot recover the identity.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ciphertext"],"properties":{"ciphertext":{"type":"string","description":"JWE Compact Serialization (five base64url segments)."},"wrap_alg":{"type":"string","example":"PBES2-HS512+A256KW"},"kdf_params":{"type":"object","nullable":true},"public_key":{"type":"string","nullable":true},"key_version":{"type":"integer","example":1}}}}}},"responses":{"200":{"description":"Identity escrowed","content":{"application/json":{"schema":{"type":"object","properties":{"escrowed":{"type":"boolean","example":true},"updated":{"type":"boolean","example":false}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"}}},"get":{"tags":["Attestation"],"operationId":"getIdentityEscrow","summary":"Fetch encrypted author-identity seed","description":"Return the current user's escrowed JWE blob for client-side decryption. Returns 404 with header `X-WP-Identity: none` when the endpoint exists but the user has no escrow yet.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Escrowed identity blob","content":{"application/json":{"schema":{"type":"object","properties":{"ciphertext":{"type":"string"},"wrap_alg":{"type":"string"},"kdf_params":{"type":"object","nullable":true},"public_key":{"type":"string","nullable":true},"key_version":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No escrowed identity for this account"}}}},"/v1/certificates/issue":{"post":{"tags":["Certificates"],"operationId":"issueCertificate","summary":"Issue authorship certificate","description":"Issue an Ed25519-signed authorship certificate binding a document hash to forensic triad scores and optional blockchain anchor.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CertificateIssueRequest"}}}},"responses":{"201":{"description":"Certificate issued","content":{"application/json":{"schema":{"type":"object","properties":{"certificate":{"type":"object","description":"Full certificate object"},"badgeUrl":{"type":"string","format":"uri"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/certificates/{id}":{"get":{"tags":["Certificates"],"operationId":"getCertificate","summary":"Get certificate","description":"Retrieve a certificate by ID. This endpoint is public and does not require authentication.","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Certificate found","content":{"application/json":{"schema":{"type":"object","properties":{"certificate":{"type":"object"},"valid":{"type":"boolean"}}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/certificates/revoke":{"post":{"tags":["Certificates"],"operationId":"revokeCertificate","summary":"Revoke certificate","description":"Revoke an authorship certificate. Updates the CRL and invalidates the cert cache.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["certificateId","reason"],"properties":{"certificateId":{"type":"string","format":"uuid"},"reason":{"type":"string","minLength":1,"maxLength":500}}}}}},"responses":{"200":{"description":"Certificate revoked","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean","example":true},"revokedAt":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not authorized to revoke this certificate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Certificate already revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/anchor":{"post":{"tags":["Anchoring"],"operationId":"anchorEvidence","summary":"Anchor evidence hash","description":"Append an evidence hash to the Merkle transparency log. Returns a signed tree head and inclusion proof.","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnchorRequest"}}}},"responses":{"201":{"description":"Evidence anchored","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnchorResponse"}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Signature verification failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Transparency log busy, retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/anchor/sth":{"get":{"tags":["Anchoring"],"operationId":"getSignedTreeHead","summary":"Get latest signed tree head","description":"Return the latest signed tree head from the transparency log. Public endpoint.","security":[],"responses":{"200":{"description":"Signed tree head","content":{"application/json":{"schema":{"type":"object","properties":{"tree_size":{"type":"integer"},"root_hash":{"type":"string"},"signature":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"public_key":{"type":"string","description":"Hex-encoded Ed25519 public key"}}}}}}}}},"/v1/anchor/proof":{"get":{"tags":["Anchoring"],"operationId":"getInclusionProof","summary":"Get inclusion proof","description":"Compute a Merkle inclusion proof for a given log index. Public endpoint.","security":[],"parameters":[{"name":"log_index","in":"query","required":true,"schema":{"type":"integer","minimum":1},"description":"1-based log index"}],"responses":{"200":{"description":"Inclusion proof","content":{"application/json":{"schema":{"type":"object","properties":{"log_index":{"type":"integer"},"leaf_hash":{"type":"string"},"tree_size":{"type":"integer"},"root_hash":{"type":"string"},"inclusion_proof":{"type":"array","items":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"404":{"description":"Log index not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/anchor/verify":{"get":{"tags":["Anchoring"],"operationId":"verifyAnchor","summary":"Verify anchored evidence","description":"Verify that an evidence hash is anchored in the transparency log and return the inclusion proof. Also supports legacy blockchain verification via tx or contentHash query parameters.","security":[],"parameters":[{"name":"evidence_hash","in":"query","required":false,"schema":{"type":"string","pattern":"^[0-9a-f]{64}$"},"description":"SHA-256 evidence hash (64-char hex)"},{"name":"tx","in":"query","required":false,"schema":{"type":"string"},"description":"Legacy: blockchain transaction hash"},{"name":"contentHash","in":"query","required":false,"schema":{"type":"string"},"description":"Legacy: content hash"}],"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"type":"object","properties":{"verified":{"type":"boolean"},"type":{"type":"string","enum":["transparency_log","blockchain"]},"anchor":{"type":"object"},"message":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"}}}},"/v1/beacon":{"post":{"tags":["Beacon"],"operationId":"requestBeacon","summary":"Request randomness beacon","description":"Fetch randomness from drand and NIST beacons, bind it to the session and document hash, and store a beacon_attestation event.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sessionId","documentHash","timestamp"],"properties":{"sessionId":{"type":"string","format":"uuid"},"documentHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"timestamp":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"Beacon response","content":{"application/json":{"schema":{"type":"object","properties":{"drandRound":{"type":"integer"},"drandRandomness":{"type":"string"},"nistPulseIndex":{"type":"integer"},"nistOutputValue":{"type":"string"},"wpSignature":{"type":"string","description":"SHA-256 binding signature"},"timestamp":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/stego/sign":{"post":{"tags":["Steganography"],"operationId":"stegoSign","summary":"Generate watermark parameters","description":"Generate zero-width character (ZWC) watermark parameters for a completed session. Returns watermark bits, embedding seed, and HMAC tag.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sessionId","documentHash"],"properties":{"sessionId":{"type":"string","format":"uuid"},"documentHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}}}}},"responses":{"201":{"description":"Watermark parameters generated","content":{"application/json":{"schema":{"type":"object","properties":{"watermarkBits":{"type":"string","description":"16 hex chars (64 bits)"},"embeddingSeed":{"type":"string","description":"SHA-256 hex for position determination"},"zwcCount":{"type":"integer","example":32},"hmacTag":{"type":"string","description":"Full HMAC-SHA256 hex tag"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"Session must be completed before watermarking","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/stego/verify":{"post":{"tags":["Steganography"],"operationId":"stegoVerify","summary":"Verify watermark","description":"Verify an extracted ZWC watermark against stored watermark records using constant-time comparison.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["documentHash","extractedTag"],"properties":{"documentHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"extractedTag":{"type":"string","pattern":"^[0-9a-fA-F]+$"}}}}}},"responses":{"200":{"description":"Watermark verification result","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"},"zwcFound":{"type":"integer"},"zwcExpected":{"type":"integer","example":32},"documentHash":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/declaration":{"post":{"tags":["Declaration"],"operationId":"createDeclaration","summary":"Create AI declaration","description":"Submit an AI tool usage declaration for a document. Maps tool usage to IPTC digital source types and AI disclosure levels.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeclarationRequest"}}}},"responses":{"201":{"description":"Declaration created","content":{"application/json":{"schema":{"type":"object","properties":{"declarationId":{"type":"string","format":"uuid"},"aiDisclosureLevel":{"type":"string","enum":["none","assisted","ai_generated"]},"iptcDigitalSourceType":{"type":"string","enum":["humanCreated","compositeWithTrainedAlgorithmicMedia","trainedAlgorithmicMedia"]},"timestamp":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/publish":{"post":{"tags":["Publishing"],"operationId":"publishEvidence","summary":"Publish evidence for public verification","description":"Register an evidence hash so /verify can resolve it. On a paid tier, supplying `evidenceB64` also verifies the packet, stores it, and CA-counter-signs it. Idempotent per (user, evidenceHash): a repeat publish returns 200 with the existing record.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishRequest"}}}},"responses":{"200":{"description":"Already published — the existing record, unchanged","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishResponse"}}}},"201":{"description":"Evidence published","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishResponse"}}}},"400":{"description":"Request validation failed (no `code`), or the uploaded packet was rejected (`code` set — see PublishError).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The publish signature did not verify against the author's enrolled hardware key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Verification, storage, or insert failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishError"}}}},"503":{"description":"Notarization CA key not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/saas/subscription/current":{"get":{"tags":["SaaS"],"operationId":"getCurrentSubscription","summary":"Get current subscription","description":"Return the authenticated user's active subscription tier, limits, and usage.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"Subscription details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/saas/resolve":{"post":{"tags":["SaaS"],"operationId":"resolveMarketplaceToken","summary":"Resolve marketplace token","description":"Resolve a marketplace token to a subscription. Creates a default subscription if none exists.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["marketplaceToken"],"properties":{"marketplaceToken":{"type":"string","minLength":1}}}}}},"responses":{"200":{"description":"Subscription resolved","content":{"application/json":{"schema":{"type":"object","properties":{"subscriptionId":{"type":"string","format":"uuid"},"planId":{"type":"string"},"quantity":{"type":"integer"},"status":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/v1/saas/subscriptions/{id}/activate":{"post":{"tags":["SaaS"],"operationId":"activateSubscription","summary":"Activate subscription","description":"Activate a subscription with a specific plan and optional seat quantity.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Subscription ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["planId"],"properties":{"planId":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1}}}}}},"responses":{"200":{"description":"Subscription activated","content":{"application/json":{"schema":{"type":"object","properties":{"activated":{"type":"boolean","example":true},"subscriptionId":{"type":"string","format":"uuid"},"planId":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/ValidationError"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/v1/verify/{hash}":{"get":{"tags":["Verification"],"operationId":"lookupProvenance","summary":"Look up published provenance","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"description":"Checks notarizations, text attestations, and certificates. A revoked-only certificate returns HTTP 200 with verified=false. All keys on the account share the 60-lookups/minute limit. 100 free units per account per UTC month, then prepaid credits ($10 per 1,000). Completed negative lookups count; unavailable checks do not. Paid deductions begin 2026-10-10T00:00:00Z. Send Idempotency-Key for a 24-hour replay window. Responses are not publicly cacheable.","parameters":[{"name":"hash","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"}},{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,128}$"},"description":"Persist with your job; reuse only for identical input within 24 hours."}],"responses":{"200":{"description":"Provenance lookup; inspect verified and revoked","content":{"application/json":{"schema":{"type":"object","required":["hash","verified"],"properties":{"hash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"verified":{"type":"boolean","description":"A live provenance record exists; not an authorship-policy decision or proof-to-file binding check."},"revoked":{"type":"boolean"},"withdrawn":{"type":"boolean"},"withdrawnAt":{"type":"string","format":"date-time"},"reason":{"type":"string"},"verifyUrl":{"type":"string","format":"uri"},"notarization":{"type":["object","null"],"properties":{"id":{"type":"string"},"tier":{"type":"string"},"authorDid":{"type":"string"},"checkpointCount":{"type":"integer"},"countersigned":{"type":"boolean"},"countersignatureStatus":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"textAttestation":{"type":["object","null"],"properties":{"tier":{"type":"string"},"writersproofId":{"type":"string"},"attestedAt":{"type":"string","format":"date-time"},"publicKeyHex":{"type":"string"}}},"certificate":{"type":["object","null"],"properties":{"id":{"type":"string"},"score":{"type":"number"},"verdict":{"type":"string"},"revoked":{"type":"boolean"},"signedAt":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"402":{"description":"Free allowance and purchased credits exhausted","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"404":{"description":"No published provenance record","content":{"application/json":{"schema":{"type":"object","required":["hash","verified"],"properties":{"hash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"verified":{"type":"boolean","description":"A live provenance record exists; not an authorship-policy decision or proof-to-file binding check."},"revoked":{"type":"boolean"},"withdrawn":{"type":"boolean"},"withdrawnAt":{"type":"string","format":"date-time"},"reason":{"type":"string"},"verifyUrl":{"type":"string","format":"uri"},"notarization":{"type":["object","null"],"properties":{"id":{"type":"string"},"tier":{"type":"string"},"authorDid":{"type":"string"},"checkpointCount":{"type":"integer"},"countersigned":{"type":"boolean"},"countersignatureStatus":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"textAttestation":{"type":["object","null"],"properties":{"tier":{"type":"string"},"writersproofId":{"type":"string"},"attestedAt":{"type":"string","format":"date-time"},"publicKeyHex":{"type":"string"}}},"certificate":{"type":["object","null"],"properties":{"id":{"type":"string"},"score":{"type":"number"},"verdict":{"type":"string"},"revoked":{"type":"boolean"},"signedAt":{"type":"string","format":"date-time"}}}}}}}},"409":{"description":"IDEMPOTENCY_CONFLICT or REQUEST_IN_PROGRESS","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"410":{"description":"Evidence withdrawn by its author","content":{"application/json":{"schema":{"type":"object","required":["hash","verified"],"properties":{"hash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"verified":{"type":"boolean","description":"A live provenance record exists; not an authorship-policy decision or proof-to-file binding check."},"revoked":{"type":"boolean"},"withdrawn":{"type":"boolean"},"withdrawnAt":{"type":"string","format":"date-time"},"reason":{"type":"string"},"verifyUrl":{"type":"string","format":"uri"},"notarization":{"type":["object","null"],"properties":{"id":{"type":"string"},"tier":{"type":"string"},"authorDid":{"type":"string"},"checkpointCount":{"type":"integer"},"countersigned":{"type":"boolean"},"countersignatureStatus":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"textAttestation":{"type":["object","null"],"properties":{"tier":{"type":"string"},"writersproofId":{"type":"string"},"attestedAt":{"type":"string","format":"date-time"},"publicKeyHex":{"type":"string"}}},"certificate":{"type":["object","null"],"properties":{"id":{"type":"string"},"score":{"type":"number"},"verdict":{"type":"string"},"revoked":{"type":"boolean"},"signedAt":{"type":"string","format":"date-time"}}}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}}},"/v1/verify/batch":{"post":{"tags":["Verification"],"operationId":"batchLookupProvenance","summary":"Look up up to 20 proofs in one request","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"description":"Hashes must be unique ignoring case. Results preserve input order and include the HTTP status and body of each lookup. HTTP 200 means the batch completed, not that every proof verified. Retry only items with transient failures. Each hash consumes one lookup from the SAME per-account allowance as GET /v1/verify/{hash}; an over-budget batch is rejected before any lookup runs. Monthly usage counts hashes, not HTTP requests. Maximum body: 8 KiB. Four lookups run concurrently. Reusing an Idempotency-Key replays the completed batch for 24 hours without another credit deduction. Retry only failed items with a new operation identifier.","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,128}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["hashes"],"properties":{"hashes":{"type":"array","minItems":1,"maxItems":20,"uniqueItems":true,"items":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"}}}}}}},"responses":{"200":{"description":"Ordered individual results","content":{"application/json":{"schema":{"type":"object","required":["count","results"],"properties":{"count":{"type":"integer"},"requestId":{"type":"string"},"results":{"type":"array","items":{"type":"object","required":["hash","status","body"],"properties":{"hash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"status":{"type":"integer","enum":[200,404,410,500]},"body":{"anyOf":[{"type":"object","required":["hash","verified"],"properties":{"hash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"verified":{"type":"boolean","description":"A live provenance record exists; not an authorship-policy decision or proof-to-file binding check."},"revoked":{"type":"boolean"},"withdrawn":{"type":"boolean"},"withdrawnAt":{"type":"string","format":"date-time"},"reason":{"type":"string"},"verifyUrl":{"type":"string","format":"uri"},"notarization":{"type":["object","null"],"properties":{"id":{"type":"string"},"tier":{"type":"string"},"authorDid":{"type":"string"},"checkpointCount":{"type":"integer"},"countersigned":{"type":"boolean"},"countersignatureStatus":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"textAttestation":{"type":["object","null"],"properties":{"tier":{"type":"string"},"writersproofId":{"type":"string"},"attestedAt":{"type":"string","format":"date-time"},"publicKeyHex":{"type":"string"}}},"certificate":{"type":["object","null"],"properties":{"id":{"type":"string"},"score":{"type":"number"},"verdict":{"type":"string"},"revoked":{"type":"boolean"},"signedAt":{"type":"string","format":"date-time"}}}}},{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}]}}}}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"402":{"description":"Insufficient free and purchased capacity for the entire batch","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"409":{"description":"IDEMPOTENCY_CONFLICT or REQUEST_IN_PROGRESS; only the latter is retryable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"413":{"description":"Batch body exceeds 8 KiB","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}}},"/v1/verify/usage":{"get":{"tags":["Verification"],"operationId":"getVerificationUsage","summary":"Read account usage, limits, and retention","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"description":"Reads the transactional account ledger without consuming verification capacity. Includes exact completed monthly usage, free units remaining, purchased credits and auto-reload state. Account-wide across all keys and bearer tokens. Has its own 30/minute account rate limit. During the transition, paid credits are preserved until 2026-10-10T00:00:00Z.","responses":{"200":{"description":"Current account usage","content":{"application/json":{"schema":{"type":"object","required":["tier","usage","limits","retention","resetsAt"],"properties":{"tier":{"type":"string","enum":["free","compliance"]},"usage":{"type":"object","required":["period","count","approximate","overSoftLimit"],"properties":{"period":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"count":{"type":"integer","minimum":0},"approximate":{"type":"boolean","description":"false when transactional credit billing is enabled"},"overSoftLimit":{"type":"boolean"}}},"limits":{"type":"object","properties":{"perMinute":{"type":"integer"},"monthlyFree":{"const":100},"maxBatchSize":{"const":20}}},"retention":{"oneOf":[{"type":"object","required":["days"],"properties":{"days":{"type":"integer"}}},{"type":"object","required":["years"],"properties":{"years":{"type":"integer"}}}]},"billing":{"type":"object","required":["freeAllowance","freeUsed","freeRemaining","paidCredits","creditDebt","period","completedLookups","resetsAt","transitionUntil","pack","autoReload","orders"],"properties":{"freeAllowance":{"type":"integer","minimum":0,"const":100},"freeUsed":{"type":"integer","minimum":0},"freeRemaining":{"type":"integer","minimum":0},"paidCredits":{"type":"integer","minimum":0},"creditDebt":{"type":"integer","minimum":0},"completedLookups":{"type":"integer","minimum":0},"period":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"resetsAt":{"type":"string","format":"date-time"},"transitionUntil":{"type":["string","null"],"format":"date-time"},"pack":{"type":"object","properties":{"credits":{"const":1000},"amount":{"const":1000,"description":"USD cents"},"currency":{"const":"usd"},"priceId":{"type":"string"}}},"autoReload":{"type":"object","properties":{"enabled":{"type":"boolean"},"threshold":{"type":"integer","minimum":0},"packs":{"type":"integer","minimum":0},"monthlyCapCents":{"type":"integer","minimum":0},"committedThisMonthCents":{"type":"integer","minimum":0},"hasPaymentMethod":{"type":"boolean"},"lastError":{"type":["string","null"]}}},"orders":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["manual","auto"]},"packs":{"type":"integer","minimum":0},"state":{"type":"string","enum":["created","pending","paid","failed","review"]},"created":{"type":"integer","minimum":0,"description":"Unix milliseconds"},"reversed":{"type":"integer","minimum":0,"description":"Credits reversed by refunds or disputes"}}}}}},"resetsAt":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}}},"/v1/verify/records":{"get":{"tags":["Verification"],"operationId":"listVerificationRecords","summary":"List your account’s verification history","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"maximum":100000,"default":0}},{"name":"hash","in":"query","schema":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"}}],"responses":{"200":{"description":"Account-scoped records, newest first; writes may appear after a short delay","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","hash","verified","tier","summary","responseHash","verifiedAt","retainUntil"],"properties":{"id":{"type":"string","format":"uuid"},"hash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"verified":{"type":"boolean"},"tier":{"type":"string"},"summary":{"type":"object"},"responseHash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"verifiedAt":{"type":"string","format":"date-time"},"retainUntil":{"type":"string","format":"date-time"}}}},"pagination":{"type":"object","required":["limit","offset","hasMore"],"properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}}},"/v1/verify/records/{id}":{"get":{"tags":["Verification"],"operationId":"getVerificationRecord","summary":"Retrieve one of your verification records","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Account-scoped record","content":{"application/json":{"schema":{"type":"object","required":["id","hash","verified","tier","summary","responseHash","verifiedAt","retainUntil"],"properties":{"id":{"type":"string","format":"uuid"},"hash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"verified":{"type":"boolean"},"tier":{"type":"string"},"summary":{"type":"object"},"responseHash":{"type":"string","pattern":"^[a-fA-F0-9]{64}$"},"verifiedAt":{"type":"string","format":"date-time"},"retainUntil":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"404":{"description":"Record not found or owned by a different account","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}}},"/v1/apikeys":{"post":{"tags":["API Keys"],"operationId":"createApiKey","summary":"Create an optionally expiring API key","security":[{"bearerAuth":[]}],"description":"Self-service keys are always free. The plaintext is returned exactly once; only its SHA-256 digest is stored. Omit expiresInDays for a non-expiring key. Maximum 5 creations/minute/account. This operation is not idempotent: if the network loses the response, list and revoke the unusable key before issuing a replacement.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":128},"expiresInDays":{"type":"integer","minimum":1,"maximum":365}}}}}},"responses":{"201":{"description":"Secret shown once; Cache-Control: private, no-store","content":{"application/json":{"schema":{"type":"object","required":["id","name","key","key_prefix","tier","expires_at","created_at"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"key_prefix":{"type":"string"},"tier":{"type":"string","enum":["free","compliance"]},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"},"key":{"type":"string","pattern":"^wp_sk_[a-f0-9]{64}$"}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}},"get":{"tags":["API Keys"],"operationId":"listApiKeys","summary":"List non-revoked keys, including expired keys","security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"maximum":100000,"default":0}}],"responses":{"200":{"description":"Key metadata; secrets and hashes are never returned","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"type":"object","required":["id","name","key_prefix","tier","created_at","expires_at","last_used_at"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"key_prefix":{"type":"string"},"tier":{"type":"string","enum":["free","compliance"]},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"}}}},"pagination":{"type":"object","required":["limit","offset","hasMore"],"properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}}},"/v1/apikeys/{id}":{"patch":{"tags":["API Keys"],"operationId":"renameApiKey","summary":"Rename an active key without replacing its secret","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":128}}}}}},"responses":{"200":{"description":"Updated metadata","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"404":{"description":"Key not found or not owned by you","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"409":{"description":"Key is revoked","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}},"delete":{"tags":["API Keys"],"operationId":"revokeApiKey","summary":"Revoke a key; repeating the request is safe","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"An owned key that is already revoked returns 200 again. In-flight requests authenticated before revocation may complete.","responses":{"200":{"description":"Key revoked","content":{"application/json":{"schema":{"type":"object","required":["id","revoked"],"properties":{"id":{"type":"string","format":"uuid"},"revoked":{"const":true}}}}}},"400":{"description":"Invalid JSON or validation failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"401":{"description":"Missing, invalid, expired, or revoked credential","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"403":{"description":"Key belongs to another account","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"404":{"description":"Key does not exist","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"429":{"description":"Rate limit exceeded. Retry after the indicated delay.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}},"headers":{"Retry-After":{"schema":{"type":"integer","minimum":1}}}},"500":{"description":"Internal failure","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}},"503":{"description":"Service temporarily unavailable","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"code":{"type":"string","description":"Stable machine-readable code, where available"},"requestId":{"type":"string","format":"uuid"},"details":{"type":"object"}}}}}}}}},"/v1/api-billing":{"get":{"tags":["API Billing"],"security":[{"bearerAuth":[]}],"operationId":"getApiCreditBalance","summary":"Read credit balance and recent purchases","description":"Account-wide transactional ledger. 100 free lookups per UTC month, then $10 USD per 1,000 prepaid credits. Purchased credits carry forward. Requires a signed-in bearer token; verification keys cannot manage purchases. 30 management requests per minute.","responses":{"200":{"description":"Current account ledger","content":{"application/json":{"schema":{"type":"object","required":["freeAllowance","freeUsed","freeRemaining","paidCredits","creditDebt","period","completedLookups","resetsAt","transitionUntil","pack","autoReload","orders"],"properties":{"freeAllowance":{"type":"integer","minimum":0,"const":100},"freeUsed":{"type":"integer","minimum":0},"freeRemaining":{"type":"integer","minimum":0},"paidCredits":{"type":"integer","minimum":0},"creditDebt":{"type":"integer","minimum":0},"completedLookups":{"type":"integer","minimum":0},"period":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"resetsAt":{"type":"string","format":"date-time"},"transitionUntil":{"type":["string","null"],"format":"date-time"},"pack":{"type":"object","properties":{"credits":{"const":1000},"amount":{"const":1000,"description":"USD cents"},"currency":{"const":"usd"},"priceId":{"type":"string"}}},"autoReload":{"type":"object","properties":{"enabled":{"type":"boolean"},"threshold":{"type":"integer","minimum":0},"packs":{"type":"integer","minimum":0},"monthlyCapCents":{"type":"integer","minimum":0},"committedThisMonthCents":{"type":"integer","minimum":0},"hasPaymentMethod":{"type":"boolean"},"lastError":{"type":["string","null"]}}},"orders":{"type":"array","maxItems":20,"items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["manual","auto"]},"packs":{"type":"integer","minimum":0},"state":{"type":"string","enum":["created","pending","paid","failed","review"]},"created":{"type":"integer","minimum":0,"description":"Unix milliseconds"},"reversed":{"type":"integer","minimum":0,"description":"Credits reversed by refunds or disputes"}}}}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Signed-in bearer token required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Purchase conflict or saved payment method required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded; respect Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Billing unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/api-billing/checkout":{"post":{"tags":["API Billing"],"security":[{"bearerAuth":[]}],"operationId":"createApiCreditCheckout","summary":"Create a Stripe Checkout for verification credits","description":"A one-time purchase, not a subscription. SaveCard optionally authorizes saving the card for later off-session use; it does not enable auto-reload. Redirect the signed-in user to the returned Stripe URL. Never fulfill from the redirect alone; credits are granted after server-side payment verification. Maximum five checkout requests per minute.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","format":"uuid"},"description":"Persist one UUID per purchase attempt; retries must use identical packs and saveCard. Start a new attempt after checkout expiration."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["packs"],"properties":{"packs":{"type":"integer","minimum":1,"maximum":50},"saveCard":{"type":"boolean","default":false}}}}}},"responses":{"200":{"description":"Hosted Checkout URL","content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Signed-in bearer token required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Purchase conflict or saved payment method required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded; respect Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Billing unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/api-billing/confirm":{"post":{"tags":["API Billing"],"security":[{"bearerAuth":[]}],"operationId":"confirmApiCreditCheckout","summary":"Reconcile the returning customer’s Checkout","description":"Idempotently retrieves current payment state from Stripe and verifies ownership. Pending is not a payment failure. Stripe webhooks also reconcile purchases, so closing the browser does not lose paid credits.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["sessionId"],"properties":{"sessionId":{"type":"string","maxLength":256,"pattern":"^cs_(test_|live_)?[A-Za-z0-9]+$"}}}}}},"responses":{"200":{"description":"Payment reconciled or still processing","content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["ok"],"properties":{"ok":{"const":true}}},{"type":"object","required":["pending"],"properties":{"pending":{"const":true}}}]}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Signed-in bearer token required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Purchase conflict or saved payment method required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded; respect Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Billing unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/api-billing/auto-reload":{"put":{"tags":["API Billing"],"security":[{"bearerAuth":[]}],"operationId":"configureApiAutoReload","summary":"Authorize or disable automatic credit purchases","description":"Requires a saved payment method and explicit user consent to enable. Threshold considers free plus paid capacity. Monthly cap counts automatic orders initiated in the UTC month, including pending orders; manual purchases are separate. The cap must cover at least one reload. Disabling stops new reloads; already initiated payments can finish.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["enabled","threshold","packs","monthlyCapCents"],"properties":{"enabled":{"type":"boolean"},"threshold":{"type":"integer","minimum":20,"maximum":500},"packs":{"type":"integer","minimum":1,"maximum":10},"monthlyCapCents":{"type":"integer","minimum":1000,"maximum":100000,"multipleOf":1000}}}}}},"responses":{"200":{"description":"Settings saved","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}}}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Signed-in bearer token required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Purchase conflict or saved payment method required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded; respect Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Billing unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/receipts":{"put":{"tags":["Receipts"],"operationId":"putReceipt","summary":"Host a receipt at a permanent public URL","description":"Send the raw packet bytes with `Content-Type: application/cpoe+cbor` (at most 8 MiB). The packet is verified, then stored unmodified under its SHA-256, so `digestMultibase` over the served bytes equals a digest the caller can compute before uploading. Idempotent: the same bytes return 200 with the same URL. Uploading is the consent to serve the file publicly; it does not depend on the public profile setting. An account holds at most 500 receipts.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/cpoe+cbor":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"description":"Receipt hosted (first upload or repeat)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptHosted"}}}},"400":{"description":"Empty body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"The account already hosts 500 receipts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"413":{"description":"Body larger than the limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"415":{"description":"Content-Type is not application/cpoe+cbor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"422":{"description":"The bytes are not a valid CPoE packet; branch on `code`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"500":{"description":"The receipt store could not be reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}}}},"get":{"tags":["Receipts"],"operationId":"listOwnReceipts","summary":"List the caller's hosted receipts","description":"Newest first, at most 500. Unlike the public list this does not depend on the public profile setting, so an author can find (and remove) every receipt they have published.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"responses":{"200":{"description":"The caller’s receipts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptList"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"The receipt store could not be reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}}}}},"/v1/receipts/{sha256}":{"delete":{"tags":["Receipts"],"operationId":"deleteReceipt","summary":"Remove a hosted receipt","description":"Owner only: the object key is built from the caller’s own account, so another account’s receipt cannot be reached. Idempotent; removing an absent receipt is 204.","security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"parameters":[{"name":"sha256","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9a-f]{64}$"}}],"responses":{"204":{"description":"Receipt removed, or already absent"},"400":{"description":"Malformed hash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"The receipt store could not be reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}}}}},"/v1/profile/{userId}/receipts":{"get":{"tags":["Receipts"],"operationId":"listPublicReceipts","summary":"List the receipts on a public profile","description":"Newest first, at most 500. 404 unless the author has enabled their public profile; a receipt is still downloadable by URL either way.","security":[],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The author’s hosted receipts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptList"}}}},"400":{"description":"Malformed user id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"404":{"description":"Profile not found or not public","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"503":{"description":"The profile could not be checked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}}}}},"/v1/profile/{userId}/receipts/{file}":{"get":{"tags":["Receipts"],"operationId":"getReceipt","summary":"Download a hosted receipt","description":"The exact bytes that were uploaded, immutable and cacheable for a year. The file name is the lowercase hex SHA-256 of the bytes plus `.cpoe`; the ETag is the same digest.","security":[],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"file","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9a-f]{64}\\.cpoe$"}}],"responses":{"200":{"description":"The receipt","content":{"application/cpoe+cbor":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Malformed user id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"404":{"description":"No such receipt","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}},"500":{"description":"The receipt store could not be reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReceiptError"}}}}}}},"/v1/ca/root":{"get":{"tags":["PKI"],"operationId":"getRootCA","summary":"Get root CA certificate","description":"Return the WritersProof root CA public certificate.","security":[],"responses":{"200":{"description":"Root CA certificate","content":{"application/json":{"schema":{"type":"object","properties":{"certificate":{"type":"object","description":"Root CA certificate"}}}}}},"503":{"description":"Root CA certificate not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/crl":{"get":{"tags":["PKI"],"operationId":"getCRL","summary":"Get certificate revocation list","description":"Return the current CRL. Also served at crl.writersproof.com.","security":[],"responses":{"200":{"description":"Certificate revocation list","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer","example":1},"issuer":{"type":"string","example":"WritersProof Platform CA"},"thisUpdate":{"type":"string","format":"date-time"},"nextUpdate":{"type":"string","format":"date-time"},"revokedCertificates":{"type":"array","items":{"type":"object","properties":{"serialNumber":{"type":"string"},"revocationDate":{"type":"string","format":"date-time"},"reason":{"type":"string"}}}}}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Supabase JWT token"},"apiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key with wp_sk_ prefix"}},"parameters":{"SessionId":{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Session ID"}},"responses":{"Unauthorized":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ValidationError":{"description":"Request validation failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Validation failed"},"details":{"type":"array","items":{"type":"string"}}}}}}}},"schemas":{"ReceiptHosted":{"type":"object","properties":{"url":{"type":"string","format":"uri","description":"Permanent public URL serving exactly the uploaded bytes"},"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"bytes":{"type":"integer","minimum":1}},"required":["url","sha256","bytes"]},"ReceiptList":{"type":"object","properties":{"receipts":{"type":"array","maxItems":500,"items":{"type":"object","properties":{"sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"},"url":{"type":"string","format":"uri"},"bytes":{"type":"integer","minimum":0},"uploadedAt":{"type":"string","format":"date-time"}},"required":["sha256","url","bytes","uploadedAt"]}}},"required":["receipts"]},"ReceiptError":{"type":"object","description":"The `error` string is fixed guidance safe to show a user; verifier diagnostics never reach it. Branch on `code`.","properties":{"error":{"type":"string"},"requestId":{"type":"string"},"code":{"type":"string","enum":["unsupported_media_type","empty_body","payload_too_large","receipt_limit_reached","invalid_user_id","invalid_receipt_hash","receipt_not_found","profile_not_public","profile_lookup_failed","receipt_store_unavailable","invalid_evidence","malformed_evidence","unsigned_evidence","invalid_evidence_signature","invalid_checkpoint_count","invalid_checkpoint_chain","missing_recording_proof","invalid_checkpoint_timestamps","unsupported_evidence_profile"]}},"required":["error","code"]},"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"PublishRequest":{"type":"object","properties":{"evidenceHash":{"type":"string","pattern":"^[0-9a-f]{64}$","description":"SHA-256 of the document content, hex. Must equal the packet's own documentRef hash."},"authorDid":{"type":"string","maxLength":256},"signature":{"type":"string","pattern":"^[0-9a-f]{128}$","description":"Ed25519 over `b\"witnessd-publish-v1\" || content_hash` (32 raw bytes). Checked only when the author has an enrolled hardware key."},"attestation":{"type":"string"},"checkpointCount":{"type":"integer","minimum":0},"documentName":{"type":"string","maxLength":512},"aiDeclaration":{"type":"string"},"evidenceB64":{"type":"string","description":"The .cpoe packet, base64. Paid tiers only; supplying it upgrades the publish to a full notarization."}},"required":["evidenceHash","authorDid","signature"]},"PublishResponse":{"type":"object","properties":{"recordId":{"type":"string","format":"uuid"},"canonicalUrl":{"type":"string","format":"uri"},"publishedAt":{"type":"integer","description":"Unix seconds"}},"required":["recordId","canonicalUrl","publishedAt"]},"PublishError":{"type":"object","description":"The `error` string is fixed guidance safe to show a user; verifier diagnostics never reach it. Branch on `code`, which is absent on plain request-validation failures.","properties":{"error":{"type":"string"},"requestId":{"type":"string"},"code":{"type":"string","enum":["invalid_evidence_encoding","malformed_evidence","unsigned_evidence","invalid_evidence_signature","invalid_checkpoint_count","invalid_checkpoint_chain","missing_recording_proof","invalid_checkpoint_timestamps","unsupported_evidence_profile","invalid_evidence","invalid_document_hash","evidence_document_mismatch","evidence_verification_failed"]}},"required":["error"]},"SessionSummary":{"type":"object","properties":{"sessionId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","completed"]},"eventCount":{"type":"integer"},"score":{"type":["number","null"]},"verdict":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"documentId":{"type":"string"},"documentName":{"type":["string","null"]},"platform":{"type":"string"}}},"Session":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string"},"platform":{"type":"string"},"document_id":{"type":"string"},"document_name":{"type":["string","null"]},"document_hash":{"type":"string"},"status":{"type":"string","enum":["active","completed"]},"event_count":{"type":"integer"},"checkpoint_count":{"type":"integer"},"last_event_at":{"type":["string","null"],"format":"date-time"},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"evidence_score":{"type":["number","null"]}}},"CreateSessionRequest":{"type":"object","required":["platform","document_id","document_hash"],"properties":{"platform":{"type":"string","enum":["macos","windows","linux","web","hubspot","google","atlassian","salesforce","servicenow","microsoft","canvas","blackboard"]},"document_id":{"type":"string","minLength":1,"maxLength":256},"document_name":{"type":"string","maxLength":512},"document_hash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"external_context":{"type":"string","pattern":"^[A-Za-z0-9._:|~-]{1,256}$","description":"Opaque platform id of the course/context this session was launched in. Required for canvas and blackboard, where one API key serves every launch. Later reads must present it as X-WP-External-Context."},"external_subject":{"type":"string","pattern":"^[A-Za-z0-9._:|~-]{1,256}$","description":"Opaque platform id of the launching user. Requires external_context. Later reads must present it as X-WP-External-Subject, unless X-WP-External-Role is instructor."}}},"SubmitEventsRequest":{"type":"object","required":["events"],"properties":{"events":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["event_type","timestamp"],"properties":{"event_type":{"type":"string","enum":["keystroke","mouse_move","mouse_click","focus_change","paste","undo","redo","scroll","selection","title_modified","body_modified","blog_post_modified","landing_page_modified","email_template_modified","content_created","content_published","other"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","additionalProperties":true}}}}}},"StopSessionResponse":{"type":"object","properties":{"session_id":{"type":"string","format":"uuid"},"status":{"type":"string","example":"completed"},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":"string","format":"date-time"},"duration_seconds":{"type":"integer"},"event_count":{"type":"integer"},"checkpoint_count":{"type":"integer"},"evidence_score":{"type":"number"},"basic_score":{"type":"number"},"verdict":{"type":"string"},"confidence":{"type":"number"}}},"SessionVerifyResponse":{"type":"object","properties":{"sessionId":{"type":"string","format":"uuid"},"verdict":{"type":"string"},"legacyVerdict":{"type":"string"},"score":{"type":"number"},"details":{"type":"object","properties":{"status":{"type":"string"},"platform":{"type":"string"},"document_id":{"type":"string"},"event_count":{"type":"integer"},"checkpoint_count":{"type":"integer"},"duration_seconds":{"type":"integer"},"events_per_minute":{"type":"number"},"chain_valid":{"type":"boolean"},"chain_break_at":{"type":["integer","null"]},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"}}}}},"EvidenceSummaryResponse":{"type":"object","properties":{"session":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"platform":{"type":"string"},"document_id":{"type":"string"},"document_name":{"type":["string","null"]},"document_hash":{"type":"string"},"status":{"type":"string"},"started_at":{"type":"string","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"evidence_score":{"type":["number","null"]}}},"metrics":{"type":"object","properties":{"event_count":{"type":"integer"},"checkpoint_count":{"type":"integer"},"duration_seconds":{"type":"integer"},"events_per_minute":{"type":"number"}}},"checkpoints":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"sequence":{"type":"integer"},"content_hash":{"type":"string"},"checkpoint_hash":{"type":"string"},"prev_checkpoint_hash":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}}}}}},"ForensicsResponse":{"type":"object","properties":{"sessionId":{"type":"string","format":"uuid"},"processScore":{"type":"integer"},"enhancedScore":{"type":"number"},"verdict":{"type":"string"},"confidence":{"type":"number"},"securityLevel":{"type":"string","enum":["standard","enhanced","maximum"]},"metrics":{"type":"object","properties":{"velocityConsistency":{"type":"number"},"cadenceNaturalness":{"type":"number"},"idlePatternScore":{"type":"number"},"revisionDepth":{"type":"number"},"crossModalConsistency":{"type":"number"},"biologicalPlausibility":{"type":"number"}}},"summary":{"type":"object","properties":{"eventCount":{"type":"integer"},"checkpointCount":{"type":"integer"},"durationSeconds":{"type":"integer"},"eventsPerMinute":{"type":"number"}}},"forgeryCostEstimate":{"type":"number","description":"Estimated cost in USD to forge this session"}}},"TimelineEntry":{"type":"object","properties":{"type":{"type":"string","enum":["event","checkpoint"]},"timestamp":{"type":"string","format":"date-time"},"event_type":{"type":"string"},"data":{"type":"object","additionalProperties":true},"sequence":{"type":"integer"},"hash":{"type":"string"}}},"ComplianceResponse":{"type":"object","properties":{"nistRmf":{"type":"object","properties":{"govern":{"type":"integer"},"map":{"type":"integer"},"measure":{"type":"integer"},"manage":{"type":"integer"},"overall":{"type":"integer"}}},"iso42001":{"type":"object","properties":{"processDoc":{"type":"boolean"},"riskAssessment":{"type":"boolean"},"humanOversight":{"type":"boolean"},"transparency":{"type":"boolean"},"overall":{"type":"integer"}}},"aiDisclosure":{"type":"object","properties":{"level":{"type":"string","enum":["none","assisted","ai_generated"]},"iptcSourceType":{"type":"string"}}},"iptcSourceType":{"type":"string"},"wgaMbaCompliant":{"type":"boolean"},"overallScore":{"type":"integer"}}},"EnrollRequest":{"type":"object","required":["deviceId","publicKey","platform","attestationType","proofDeviceId"],"properties":{"deviceId":{"type":"string","pattern":"^[a-f0-9]{32}$","description":"SHA-256(publicKey), first 16 bytes, lowercase hex"},"publicKey":{"type":"string","pattern":"^[a-f0-9]{64}$|^[a-f0-9]{130}$"},"platform":{"type":"string","enum":["macos","windows","linux"]},"attestationType":{"type":"string","enum":["secure_enclave","tpm","software"]},"attestationCertificate":{"type":"string","maxLength":8192},"attestationData":{"type":"string","maxLength":8192},"proofDeviceId":{"type":"string","pattern":"^[a-f0-9]{128}$","description":"Ed25519 signature over DST(\"witnessd-enroll-v1\") || deviceId bytes, proving possession of the private key being enrolled"},"requestCertificate":{"type":"boolean"}}},"CertificateIssueRequest":{"type":"object","required":["documentHash","forensicTriad"],"properties":{"documentHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"documentName":{"type":"string","maxLength":255},"evidencePacketId":{"type":"string","format":"uuid"},"warBlockHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"blockchainAnchorTx":{"type":"string","maxLength":128},"forensicTriad":{"type":"object","required":["delta","epsilon","phi","overallScore","verdict"],"properties":{"delta":{"type":"number","minimum":0,"maximum":1},"epsilon":{"type":"number","minimum":0,"maximum":1},"phi":{"type":"number","minimum":0,"maximum":1},"overallScore":{"type":"number","minimum":0,"maximum":100},"verdict":{"type":"string","minLength":1,"maxLength":50}}},"requestedValidity":{"type":"integer","minimum":1,"maximum":3650,"description":"Certificate validity in days"}}},"AnchorRequest":{"type":"object","required":["evidenceHash","authorDid","signature"],"properties":{"evidenceHash":{"type":"string","pattern":"^[0-9a-f]{64}$","description":"SHA-256 hash of the evidence packet"},"authorDid":{"type":"string","maxLength":256},"signature":{"type":"string","pattern":"^[0-9a-f]{128}$","description":"128-char hex Ed25519 signature"},"metadata":{"type":"object","properties":{"documentName":{"type":"string"},"tier":{"type":"string"}}}}},"AnchorResponse":{"type":"object","properties":{"anchorId":{"type":"string","format":"uuid"},"timestamp":{"type":"string","format":"date-time"},"assuranceTier":{"type":"string","enum":["T1","T2"]},"logIndex":{"type":"integer"},"inclusionProof":{"type":"array","items":{"type":"string"}},"signedTreeHead":{"type":"object","properties":{"treeSize":{"type":"integer"},"rootHash":{"type":"string"},"signature":{"type":"string"}}}}},"DeclarationRequest":{"type":"object","required":["documentHash","titleHash","aiTools"],"properties":{"documentHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"titleHash":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"aiTools":{"type":"array","maxItems":20,"items":{"type":"object","required":["name","purpose","extent"],"properties":{"name":{"type":"string","minLength":1,"maxLength":200},"purpose":{"type":"string","enum":["grammar_check","style_suggestion","content_generation","translation","research","other"]},"extent":{"type":"string","enum":["none","minor_assistance","significant_assistance","primary_generation"]}}}},"inputModalities":{"type":"array","items":{"type":"string"}}}},"SubscriptionResponse":{"type":"object","properties":{"tier":{"type":"string","enum":["free","pro","enterprise"]},"planId":{"type":"string"},"status":{"type":"string"},"limits":{"type":"object","properties":{"maxSessionsPerMonth":{"type":"integer"},"maxEventsPerSession":{"type":"integer"},"checkpointsEnabled":{"type":"boolean"},"anchoringEnabled":{"type":"boolean"},"steganographyEnabled":{"type":"boolean"},"maxDocumentSizeMb":{"type":"integer"},"apiRateLimit":{"type":"integer"}}},"sessionsUsed":{"type":"integer"},"currentPeriodEnd":{"type":"string","format":"date-time"}}}}}}