API Reference
The VerifiedState API is a REST API served over HTTPS. All requests and responses use JSON. Base URL: https://api.verifiedstate.ai
Authentication
Every request must include a Bearer token in the Authorization header. Get your key at verifiedstate.ai/keys.
curl https://api.verifiedstate.ai/health/YOUR_NAMESPACE_ID -H "Authorization: Bearer vs_live_YOUR_KEY"
Never expose your API key client-side. All requests must originate from your server or agent backend.
Quickstart — first verified memory in 5 minutes
1
Your key looks like vs_live_abc123…. Keep it secret.
2
Ingest content → get an artifact_id
curl -X POST https://api.verifiedstate.ai/ingest -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{"namespace_id":"YOUR_NS","content":"Alice prefers dark mode.","source_type":"user_input"}'
# → {"artifact_id":"…","span_count":1,"r2_stored":false}
3
Extract assertions from the artifact
curl -X POST https://api.verifiedstate.ai/extract -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{"namespace_id":"YOUR_NS","artifact_id":"ARTIFACT_ID"}'
# → {"assertions_created":2,"assertion_ids":["…","…"]}
4
Verify an assertion → get a signed receipt
curl -X POST https://api.verifiedstate.ai/verify -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{"namespace_id":"YOUR_NS","assertion_id":"ASSERTION_ID"}'
# → {"receipt_id":"…","status":"verified","final_confidence":0.5,"conflicts_found":false}
5
Query with natural language
curl -X POST https://api.verifiedstate.ai/query -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{"namespace_id":"YOUR_NS","query_text":"what display theme does Alice prefer?"}'
# → {"assertions":[…],"receipts":{…},"total":1}
Error codes
| Status | Meaning |
| 400 | Missing or invalid request body field |
| 401 | Missing or invalid Authorization: Bearer token |
| 404 | Resource (artifact, assertion, receipt) not found |
| 422 | Hash verification failed (import endpoint) |
| 429 | Rate limit exceeded — 60 req / 60 s per IP |
| 500 | Database or server error |
| 502 | Upstream model error (extract, verify) |
POST /ingest
Accepts raw text content (conversation turn, document excerpt, tool output, etc.), stores it as an artifact with evidence spans, and optionally offloads large payloads to R2 object storage. Returns an artifact_id to use with /extract.
Request body
| Field | Type | Description |
| namespace_id | string (UUID) | Target namespace required |
| content | string | Raw text to store required |
| source_type | string | conversation · document · api · tool_output · user_input required |
| source_id | string | External reference ID (e.g. Slack message ID) optional |
Response
| Field | Type | Description |
| artifact_id | string (UUID) | ID of the stored artifact |
| span_count | integer | Number of evidence spans created |
| r2_stored | boolean | True if content was offloaded to R2 (payload > 10 KB) |
curl example
curl -X POST https://api.verifiedstate.ai/ingest -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{
"namespace_id": "YOUR_NAMESPACE_ID",
"content": "Alice confirmed her Postgres cluster is on version 16.",
"source_type": "conversation",
"source_id": "msg_abc123"
}'
Calls an LLM (Llama 3.3 70B via OpenRouter) to extract subject-predicate-object assertions from the spans of an artifact. Each assertion is stored with status proposed and an embedding for semantic retrieval. Generates embeddings immediately using text-embedding-3-small.
Request body
| Field | Type | Description |
| artifact_id | string (UUID) | Artifact to extract from required |
| namespace_id | string (UUID) | Namespace the artifact belongs to required |
Response
| Field | Type | Description |
| assertions_created | integer | Number of new assertions inserted |
| assertion_ids | string[] | UUIDs of newly created assertions |
curl example
curl -X POST https://api.verifiedstate.ai/extract -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{"namespace_id":"YOUR_NAMESPACE_ID","artifact_id":"ARTIFACT_ID"}'
POST /verify
Runs the 3-tier verification ladder (structural → span grounding → state consistency) on an assertion. Produces a signed Ed25519 receipt and updates the assertion status. Use /receipt/:id to retrieve the full receipt.
Formula: confidence = support_score × source_trust_score × corroboration_factor. Thresholds: ≥ 0.80 → verified, 0.65–0.79 → provisionally_verified, < 0.65 → unverified.
Request body
| Field | Type | Description |
| assertion_id | string (UUID) | Assertion to verify required |
| namespace_id | string (UUID) | Namespace the assertion belongs to required |
Response
| Field | Type | Description |
| receipt_id | string (UUID) | ID of the produced receipt |
| status | string | New assertion status after verification |
| final_confidence | float | Computed confidence score (0–1) |
| conflicts_found | boolean | True if a conflict set was created |
curl example
curl -X POST https://api.verifiedstate.ai/verify -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{"namespace_id":"YOUR_NAMESPACE_ID","assertion_id":"ASSERTION_ID"}'
POST /query
Hybrid retrieval: pgvector cosine similarity (1024-dim embeddings via text-embedding-3-small) plus exact slot_key match when query_text contains pipe separators. Returns assertions ranked by relevance with their active receipts attached.
Request body
| Field | Type | Description |
| namespace_id | string (UUID) | Namespace to search required |
| query_text | string | Natural language query or slot_key (e.g. user|prefers|theme) required |
| limit | integer | Max results (1–100, default 20) optional |
| filters.valid_only | boolean | Only return currently-valid assertions (default true) optional |
| filters.status | string | Filter by status, e.g. verified optional |
| filters.claim_class | string | Filter by claim class, e.g. preference optional |
Response
| Field | Type | Description |
| assertions | Assertion[] | Ranked list of matching assertions |
| receipts | Record<id, Receipt> | Active receipt keyed by assertion ID |
| total | integer | Count of returned assertions |
curl example
curl -X POST https://api.verifiedstate.ai/query -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{
"namespace_id": "YOUR_NAMESPACE_ID",
"query_text": "what database does Alice use?",
"limit": 5,
"filters": {"valid_only": true, "status": "verified"}
}'
GET /receipt/:id
Returns the full verification receipt for a given receipt ID. The receipt includes the Ed25519 signature, evidence refs, method stack, confidence scores, and verifier identity.
Path parameter
| Parameter | Description |
| id | UUID of the receipt |
curl example
curl https://api.verifiedstate.ai/receipt/RECEIPT_ID -H "Authorization: Bearer vs_live_YOUR_KEY"
GET /chain/:writer
Returns the current Merkle chain head for a writer principal. Each assertion stores assertion_hash and prev_hash, forming a tamper-evident chain. Replay the chain client-side to verify integrity.
Path parameter
| Parameter | Description |
| writer_principal | URL-encoded writer ID, e.g. system%3Aextract |
curl example
curl "https://api.verifiedstate.ai/chain/system%3Aextract" -H "Authorization: Bearer vs_live_YOUR_KEY"
POST /compress
Encodes an artifact into the IR1 (Intermediate Representation) format optimised for LLM consumption, and writes the literal sidecar to R2 for lossless recovery. Typical compression ratio: 0.35–0.55× (IR is 2–3× smaller than original in token count).
Request body
| Field | Type | Description |
| artifact_id | string (UUID) | Artifact to encode required |
| namespace_id | string (UUID) | Owning namespace required |
| principal_id | string | Writer identity (default: system:compress) optional |
Response
| Field | Type | Description |
| encoded_artifact_id | string (UUID) | ID of the encoded artifact row |
| artifact_id | string (UUID) | Original artifact ID |
| literal_r2_key | string | R2 object key for the literal sidecar |
| source_hash | string | SHA-256 of original content |
| ir_token_count | integer | Estimated token count of IR |
| original_token_count | integer | Estimated token count of original |
| compression_ratio | float | ir_token_count / original_token_count |
curl example
curl -X POST https://api.verifiedstate.ai/compress -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{"namespace_id":"YOUR_NAMESPACE_ID","artifact_id":"ARTIFACT_ID"}'
POST /decompress
Fetches the literal sidecar from R2, reconstructs the original content, and verifies its SHA-256 hash. Returns the exact original bytes — guaranteed lossless.
Request body
| Field | Type | Description |
| encoded_artifact_id | string (UUID) | Encoded artifact to decode required |
| namespace_id | string (UUID) | Owning namespace required |
curl example
curl -X POST https://api.verifiedstate.ai/decompress -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{"namespace_id":"YOUR_NAMESPACE_ID","encoded_artifact_id":"ENCODED_ID"}'
POST /challenge
Creates a counterevidence record against an existing assertion, opens a conflict set, and updates the assertion status to disputed. Disputed assertions surface in /health counts.
Request body
| Field | Type | Description |
| assertion_id | string (UUID) | Assertion to dispute required |
| namespace_id | string (UUID) | Owning namespace required |
| reason | string | Explanation of the dispute required |
| counterevidence | string | Text of counterevidence optional |
| challenger_id | string | Identity of the challenger (default: system:challenge) optional |
curl example
curl -X POST https://api.verifiedstate.ai/challenge -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{
"namespace_id": "YOUR_NAMESPACE_ID",
"assertion_id": "ASSERTION_ID",
"reason": "Source was unreliable — conflicting data from primary DB",
"counterevidence": "SELECT * FROM users WHERE id = 42 shows preference = light_mode"
}'
POST /retract
Assertions are append-only — they are never deleted. Retraction creates a new assertion that supersedes the original, setting its status to retracted. The original is preserved in the audit trail with status = retracted.
Request body
| Field | Type | Description |
| assertion_id | string (UUID) | Assertion to retract required |
| namespace_id | string (UUID) | Owning namespace required |
| reason | string | Reason for retraction required |
| retractor_id | string | Identity of the retractor (default: system:retract) optional |
curl example
curl -X POST https://api.verifiedstate.ai/retract -H "Authorization: Bearer vs_live_YOUR_KEY" -H "Content-Type: application/json" -d '{
"namespace_id": "YOUR_NAMESPACE_ID",
"assertion_id": "ASSERTION_ID",
"reason": "User corrected their preference directly"
}'
GET /export
Exports all assertions, receipts, evidence spans, artifacts, policies, and encoded artifacts for a namespace as a self-contained JSON bundle. The bundle includes a bundle_sha256 computed over all contents — verify this before importing to detect tampering.
Query parameters
| Parameter | Description |
| namespace_id | UUID of the namespace to export required |
| principal_id | Identity for the audit log (default: system:export) optional |
curl example
curl "https://api.verifiedstate.ai/export?namespace_id=YOUR_NAMESPACE_ID" -H "Authorization: Bearer vs_live_YOUR_KEY" -o bundle.json
GET /health/:namespace_id
Returns a health snapshot for a namespace: assertion counts, verification ratio, stale/expired counts, open conflict sets, and disputed assertions. Use this as a dashboard signal for memory quality.
Path parameter
| Parameter | Description |
| namespace_id | UUID of the namespace |
Response
| Field | Type | Description |
| namespace_id | string (UUID) | Namespace checked |
| total_assertions | integer | All assertions regardless of status |
| verified_count | integer | Assertions with status = verified |
| verified_ratio | float | verified_count / total_assertions |
| stale_or_expired_count | integer | Assertions past their valid_to date |
| open_conflict_sets | integer | Unresolved conflict sets |
| disputed_assertion_count | integer | Assertions with status = disputed |
| assertions_with_valid_until_set | integer | Assertions with an expiry date |
| avg_confidence_older_than_30d | float | null | Average confidence for assertions > 30 days old |
curl example
curl https://api.verifiedstate.ai/health/YOUR_NAMESPACE_ID -H "Authorization: Bearer vs_live_YOUR_KEY"