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
Get an API key at verifiedstate.ai/keys

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

StatusMeaning
400Missing or invalid request body field
401Missing or invalid Authorization: Bearer token
404Resource (artifact, assertion, receipt) not found
422Hash verification failed (import endpoint)
429Rate limit exceeded — 60 req / 60 s per IP
500Database or server error
502Upstream model error (extract, verify)

POST /ingest

POST https://api.verifiedstate.ai/ingest Store raw content

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

FieldTypeDescription
namespace_idstring (UUID)Target namespace required
contentstringRaw text to store required
source_typestringconversation · document · api · tool_output · user_input required
source_idstringExternal reference ID (e.g. Slack message ID) optional

Response

FieldTypeDescription
artifact_idstring (UUID)ID of the stored artifact
span_countintegerNumber of evidence spans created
r2_storedbooleanTrue 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"
  }'

POST /extract

POST https://api.verifiedstate.ai/extract LLM-powered assertion extraction

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

FieldTypeDescription
artifact_idstring (UUID)Artifact to extract from required
namespace_idstring (UUID)Namespace the artifact belongs to required

Response

FieldTypeDescription
assertions_createdintegerNumber of new assertions inserted
assertion_idsstring[]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

POST https://api.verifiedstate.ai/verify Run verification ladder → signed receipt

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

FieldTypeDescription
assertion_idstring (UUID)Assertion to verify required
namespace_idstring (UUID)Namespace the assertion belongs to required

Response

FieldTypeDescription
receipt_idstring (UUID)ID of the produced receipt
statusstringNew assertion status after verification
final_confidencefloatComputed confidence score (0–1)
conflicts_foundbooleanTrue 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

POST https://api.verifiedstate.ai/query Semantic + slot-key retrieval

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

FieldTypeDescription
namespace_idstring (UUID)Namespace to search required
query_textstringNatural language query or slot_key (e.g. user|prefers|theme) required
limitintegerMax results (1–100, default 20) optional
filters.valid_onlybooleanOnly return currently-valid assertions (default true) optional
filters.statusstringFilter by status, e.g. verified optional
filters.claim_classstringFilter by claim class, e.g. preference optional

Response

FieldTypeDescription
assertionsAssertion[]Ranked list of matching assertions
receiptsRecord<id, Receipt>Active receipt keyed by assertion ID
totalintegerCount 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

GET https://api.verifiedstate.ai/receipt/:id Fetch a verification receipt

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

ParameterDescription
idUUID of the receipt

curl example

curl https://api.verifiedstate.ai/receipt/RECEIPT_ID   -H "Authorization: Bearer vs_live_YOUR_KEY"

GET /chain/:writer

GET https://api.verifiedstate.ai/chain/:writer_principal Merkle chain head for a 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

ParameterDescription
writer_principalURL-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

POST https://api.verifiedstate.ai/compress Encode artifact into IR + literal sidecar

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

FieldTypeDescription
artifact_idstring (UUID)Artifact to encode required
namespace_idstring (UUID)Owning namespace required
principal_idstringWriter identity (default: system:compress) optional

Response

FieldTypeDescription
encoded_artifact_idstring (UUID)ID of the encoded artifact row
artifact_idstring (UUID)Original artifact ID
literal_r2_keystringR2 object key for the literal sidecar
source_hashstringSHA-256 of original content
ir_token_countintegerEstimated token count of IR
original_token_countintegerEstimated token count of original
compression_ratiofloatir_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

POST https://api.verifiedstate.ai/decompress Reconstruct original from literal sidecar

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

FieldTypeDescription
encoded_artifact_idstring (UUID)Encoded artifact to decode required
namespace_idstring (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

POST https://api.verifiedstate.ai/challenge Dispute an assertion with counterevidence

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

FieldTypeDescription
assertion_idstring (UUID)Assertion to dispute required
namespace_idstring (UUID)Owning namespace required
reasonstringExplanation of the dispute required
counterevidencestringText of counterevidence optional
challenger_idstringIdentity 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

POST https://api.verifiedstate.ai/retract Create a retraction assertion

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

FieldTypeDescription
assertion_idstring (UUID)Assertion to retract required
namespace_idstring (UUID)Owning namespace required
reasonstringReason for retraction required
retractor_idstringIdentity 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

GET https://api.verifiedstate.ai/export?namespace_id=… Portable verified bundle

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

ParameterDescription
namespace_idUUID of the namespace to export required
principal_idIdentity 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

GET https://api.verifiedstate.ai/health/:namespace_id Memory health metrics

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

ParameterDescription
namespace_idUUID of the namespace

Response

FieldTypeDescription
namespace_idstring (UUID)Namespace checked
total_assertionsintegerAll assertions regardless of status
verified_countintegerAssertions with status = verified
verified_ratiofloatverified_count / total_assertions
stale_or_expired_countintegerAssertions past their valid_to date
open_conflict_setsintegerUnresolved conflict sets
disputed_assertion_countintegerAssertions with status = disputed
assertions_with_valid_until_setintegerAssertions with an expiry date
avg_confidence_older_than_30dfloat | nullAverage confidence for assertions > 30 days old

curl example

curl https://api.verifiedstate.ai/health/YOUR_NAMESPACE_ID   -H "Authorization: Bearer vs_live_YOUR_KEY"