HTTP API

The complete inbound surface of acdp-registry. Routes are assembled in build_router() (crates/acdp-registry-core/src/lib.rs); handlers live under crates/acdp-registry-core/src/handlers/.

Endpoint summary

MethodPathAuthBuilt when
GET/.well-known/acdp.jsonnonealways
GET/.well-known/jwks.jsonnonealways
GET/.well-known/did.jsonnonealways (404 unless [receipt] configured)
GET/healthznonealways
GET/liveznonealways
GET/metricsoptional scrape bearermetrics.enabled
POST/contextsproducer signaturealways
GET/contexts/{ctx_id}optional beareralways
GET/contexts/{ctx_id}/bodyoptional beareralways
GET/contexts/searchoptional beareralways
POST/contexts/{ctx_id}/retractproducer-signed eventalways (501 unless lifecycle.enabled)
POST/contexts/{ctx_id}/republishproducer-signed eventalways (501 unless lifecycle.enabled)
GET/lineages/{lineage_id}optional beareralways
GET/lineages/{lineage_id}/currentoptional beareralways
GET/log/checkpointnonealways (501 unless log.enabled)
GET/log/proofoptional beareralways (501 unless log.enabled)
GET/log/entriesoptional beareralways (501 unless log.enabled)
GET/changesoptional beareralways (501 unless changes.enabled)
POST/subscriptionsbeareralways (501 unless events.enabled)
GET/subscriptions/{subscription_id}beareralways (501 unless events.enabled)
DELETE/subscriptions/{subscription_id}beareralways (501 unless events.enabled)
POST/key-attestations—501 unless keyless.enabled (off by default): mint a key attestation (RFC-ACDP-0021 §5)
GET/key-attestations—501 unless keyless.enabled: list a controller's attestations, newest first (§5.4)
POST/auth/challengenoneauth.enabled
POST/auth/tokenchallenge signatureauth.enabled
POST/auth/token/revokebearerauth.enabled
GET/admin/statusadmin beareralways
GET/admin/lineages/{lineage_id}/auditadmin beareralways
POST/admin/contexts/{ctx_id}/retractadmin beareralways (501 unless lifecycle.enabled)
POST/admin/contexts/{ctx_id}/republishadmin beareralways (501 unless lifecycle.enabled)
GET/admin/contextsadmin bearerplayground feature
POST/admin/pinned-keys/reloadadmin bearerplayground feature

The /auth/* routes are mounted at runtime only when auth.enabled = true. The two /admin/{contexts,pinned-keys} routes are compiled in only with the playground Cargo feature; /admin/status always ships.

Media types and middleware

Every ACDP data and auth endpoint returns application/acdp+json — on both success bodies and error envelopes (RFC-ACDP-0007 §4). /.well-known/jwks.json returns application/jwk-set+json; /healthz, /livez and /admin/* return plain operational JSON.

All requests pass through, outermost first: a media-type backstop that stamps application/acdp+json on any response that set none; request-id assignment (x-request-id, a UUIDv4 minted if absent, propagated downstream, and present on every response including the ones the middleware generates itself); an envelope backstop that gives a 413 the RFC-ACDP-0007 §4 error body; the CORS layer (off unless registry.cors.allowed_origins is populated or registry.cors.public_reads is set, see CONFIGURATION); a RequestBodyLimitLayer capped at limits.max_payload_bytes (so even unauthenticated /auth/* calls can't push oversized JSON); a 30 s TimeoutLayer; and TraceLayer. When metrics.enabled, a request-metrics layer sits innermost of these, recording count/latency/status by matched route — so observed latency covers the router and its per-route layers and excludes the stack above it.

The request-id layers sit outside the body limit, the timeout and CORS on purpose: a 413, a 408 or a CORS preflight is generated by those layers themselves and never reaches the router, so an id assigned any deeper would be missing from exactly the failures an operator most needs to correlate.

The /auth/* subrouter additionally carries the FEAT-06 per-IP + process-global rate limiter ([rate_limit]): it admits or rejects a request with 429 + Retry-After before any DID resolution, keyed by the resolved client IP (TCP peer, or the trusted-proxy X-Forwarded-For policy). It runs as a route_layer on the three /auth/* routes only, ahead of their handlers and body extractors, so every request it admits is charged whatever the handler then answers (a 415 or 400 included). It checks the global ceiling first, then the per-IP budget. With the default rate_limit.backend = "memory" both are counted per process. With backend = "postgres" the in-memory limiter stays in front as a pre-filter and an admitted check is then counted once across every replica sharing the database (see CONFIGURATION.md · [rate_limit]); a shared-counter denial is the same 429 with the database's own Retry-After. If the database cannot answer, backend_unavailable = "allow" (the default) admits the request on the per-process check alone, while "deny" refuses it with 429 and Retry-After: 5.

Request bodies and Content-Type

The body-bearing routes gate the request Content-Type before reading the body. Accepted on all of them: application/json or any application/*+json type (so application/acdp+json), with parameters such as ; charset=utf-8 ignored. Anything else that is present — text/plain, application/xml, an empty value — is 415 unsupported_media_type. The routes differ only on an absent header:

Route familyNo Content-TypeWrong-shaped or non-JSON body
POST /contextsaccepted (treated as JSON)400 schema_violation
POST /contexts/{ctx_id}/retract, POST /contexts/{ctx_id}/republishaccepted400 schema_violation (400 immutable_field for a body-content member)
POST /admin/contexts/{ctx_id}/retract, POST /admin/contexts/{ctx_id}/republishaccepted (the body is optional)400 schema_violation
POST /auth/challenge, POST /auth/token, POST /auth/token/revoke415 unsupported_media_type400 schema_violation (never 422)

Accepting an absent header on the publish and lifecycle routes is a deliberate choice (POST /contexts never required it, and rejecting it would break every publisher that omits it); /auth/* has always required it. On every route an oversized body is 413 payload_too_large, and a search query string that does not parse (for example GET /contexts/search?limit=abc) is 400 schema_violation (GET /admin/contexts parses its query with plain axum, so a malformed one answers axum's plain-text 400). These rejections carry the error envelope below, not plain text. POST /admin/pinned-keys/reload takes no body.

Rate limits (429)

Every 429 is rate_limited with a Retry-After header (whole seconds, never 0). Each limiter is a fixed 60-second window, and the sources are:

SourceApplies toKeyed byConfigured by
/auth/* global ceilingall three /auth/* routes—rate_limit.global_per_minute (default 6000)
/auth/* per-IP budgetall three /auth/* routesresolved client IPrate_limit.per_ip_per_minute (default 60)
Shared backend unavailable, backend_unavailable = "deny"all three /auth/* routes—Retry-After: 5, fixed
Challenge global ceilingPOST /auth/challenge—64 × limits.challenge_rate_per_minute
Challenge per-agent budgetPOST /auth/challengethe requested agent_idlimits.challenge_rate_per_minute (default 60)
Publish per-agent budgetPOST /contextsthe signing agent_idlimits.publish_rate_per_minute (default 60)
Lifecycle per-agent budgetPOST /contexts/{ctx_id}/retract, /republishthe event actorthe same per-agent bucket as publish
Keyless per-IP budgetPOST /key-attestationsresolved client IPkeyless.rate_per_ip_per_minute (default 30)
Keyless per-identity budgetPOST /key-attestationsthe workload identity (type, issuer, subject)keyless.rate_per_identity_per_minute (default 10); charged only after the token verifies
Anonymous read budgetevery data-plane GET/HEAD (contexts, search, lineages, /log/*, /changes, GET /subscriptions/{id}, GET /key-attestations)resolved client IP (an IPv6 client by its /64)read_limits.anonymous_per_minute (default 600) when read_limits.enabled
Authenticated read budgetthe same routes, with a valid bearer tokenthe requester DIDread_limits.authenticated_per_minute (default 1200) when read_limits.enabled

The read budgets (RFC-ACDP-0008 §4.3) are off by default. When on, the read is refused before its handler runs, so a throttled read is always 429, never a 404 or 403. HEAD draws on the same budget as GET. A request carrying a present but invalid bearer token is charged to its client IP and then refused 403 as usual, so rotating bad tokens buys no extra budget. Capabilities, did.json, JWKS, /healthz, /livez, /metrics, /admin/* and /auth/* are never read-limited. The read budgets are per process.

"Resolved client IP" is the same for every per-IP budget (/auth/*, keyless and anonymous reads): it is the TCP peer, or the X-Forwarded-For hop allowed by rate_limit.forwarded_header_trust (see CONFIGURATION.md).

The admin lifecycle routes have no registry-side rate limit. The challenge, publish and lifecycle budgets are always per process, whichever rate_limit.backend is configured. Publish and lifecycle charge the same way: before signature verification they only peek at the bucket (an agent already over budget gets 429; nothing is charged and no bucket is created), and the request is charged once its signer is proven (see POST /contexts and the lifecycle endpoints). A lifecycle request is charged to its event actor once the event is proven — the context is visible to the caller, the actor is its producer, and the event signature verifies — and from then on on every exit, including a 409, a store error and a byte-identical replay. An unsigned or mis-signed event naming an agent therefore spends nothing from that agent's budget, and does not create a bucket; nor does an event refused before its signature is checked (an unknown or invisible context, an actor that is not the producer). Because the pre-verification peek answers for whatever agent a request names, the 429s it returns are counted before verification: an unauthenticated caller naming an agent that is already over budget increments the rejection counter (scope publish_per_agent or lifecycle_per_agent) without being verified, so those two scopes can be inflated by anyone. Every 429 is counted on the rejection counter documented under GET /metrics, labelled with the check that refused it; a refusal because the shared backend was unavailable counts under that check's own auth_global or auth_per_ip scope.


Metadata

Cache-Control on the data plane (#205). Every requester-relative endpoint below — GET /contexts/{ctx_id}, /contexts/{ctx_id}/body, GET /contexts/search, GET /lineages/{lineage_id}, /lineages/{lineage_id}/current, GET /log/checkpoint, GET /log/proof and GET /log/entries, GET /changes, the /subscriptions and /key-attestations routes, plus the publish/retract/republish POSTs — answers with Cache-Control: private and Vary: authorization, x-tenant-id, so a shared cache cannot reuse one requester's view for another (POST /subscriptions answers no-store, since it carries the secret). GET /changes also varies on accept-encoding (it is the only gzip-compressed route; see below). /auth/*, /admin/*, GET /healthz, GET /livez and GET /metrics answer Cache-Control: no-store. The three /.well-known/* documents are requester-invariant and keep Cache-Control: public, max-age=300 — public is the half that matters: it is the deliberate opposite of private above, not an omission. (/.well-known/did.json's 404 arm is the one arm in that group answering a different directive: no-store, because a cached miss outlives the configuration change that would fix it. The document's own 200 arm is public like the others. The group's 405 arms emit no directive at all, which is why this says "different" rather than "the only exception".)

Two exceptions, stated rather than left to be discovered. (GET /metrics was a third until #218 closed: it now answers no-store on every arm — 200, 401 and 405 — the 401 being the one that mattered, since a cached 401 is what a shared cache would hand an authorized scraper.)

  • GET /log/checkpoint answers private even though the checkpoint itself is requester-invariant. It inherits the data-plane posture by group membership. That is conservative, not wrong — it forgoes shared caching of a cacheable document rather than risking the reverse.
  • CORS preflight is not covered. An OPTIONS request is answered by the CORS layer above the route layers, so it carries no Cache-Control. A preflight response has no body and discloses nothing requester-specific.

The headers are emitted on every matched route regardless of status — a 405, and a handler-produced 404 on a real path, both carry private. That is deliberate: a 404 whose existence depends on the caller's visibility is exactly what private is for. Unrouted paths fall through to a bare router fallback and carry no directive.

See RECEIPTS.md for what this does and does not buy you.

GET /.well-known/acdp.json

Capabilities document. Cache-Control: public, max-age=300. The fields, their meaning, an example, and the consumer validation rules are normative in RFC-ACDP-0007 §3; this section records only what this registry emits in each one (build_capabilities in crates/acdp-registry-server/src/main.rs):

FieldWhat this registry emits
acdp_versionAlways "0.5.0" — see below.
registry_diddid:web: + registry.authority (a port's : becomes %3A).
supported_signature_algorithms["ed25519", "ecdsa-p256"], fixed by the build; not configurable.
supported_did_methodsauth.did_methods; may include "did:key".
profilesregistry.profiles (default: acdp-registry-core, acdp-registry-discovery) plus the receipts, head-receipts, lifecycle, transparency-log, acdp-registry-changes ([changes]) and acdp-registry-events ([events]) profiles when their config sections enable them.
limitsmax_payload_bytes, max_embedded_bytes and idempotency_key_ttl_seconds from [limits]; change_retention_seconds, max_change_filters and max_changes_page from [changes] when it is enabled, plus max_change_bucket_length only when [changes] max_change_bucket_length is also set; max_subscriptions_per_requester from [events] when it is enabled; max_publish_per_minute is never emitted.
supports_idempotency_keyAlways true.
anonymous_public_readsauth.anonymous_public_reads; always present (default false).
read_authentication_methods["bearer_jwt"] when auth.enabled = true, plus "bearer_static" when [[auth.read_tokens]] is configured; omitted otherwise.

acdp_version is unconditionally "0.5.0" (RFC-ACDP-0016 §10 — anchors handling has no admin-config gate, so its version claim always wins), but profiles still lights up per config. The advertised version string and the set of active capabilities are two different axes — do not infer what a registry actually enforces from acdp_version alone; check profiles and the response bodies instead.

How signatures are verified. Every ACDP signature check (publish, /auth/token, lifecycle events, witness cosignatures) goes through the acdp crate. ed25519 is verified strictly, as RFC-ACDP-0001 §5.10 requires: small-order keys and nonce points are rejected with invalid_signature (conformance sig-004). ecdsa-p256 high-S signatures are accepted, and signature bytes are never used as an identity, as registries/signature-algorithms.md requires. A lifecycle retry counts as idempotent only if it matches the stored event byte for byte, including signature.value, so a re-sent event whose P-256 signature was flipped to its high-S twin is rejected with schema_violation (RFC-ACDP-0013 §6).

bearer_jwt (the /auth/* DID challenge answered with a registry-minted JWT) is the id registered for this flow in the spec's registries/auth-methods.md, whose requirements are in RFC-ACDP-0008 §6.2; AUTHENTICATION.md maps them to this registry. Before 0.3.0 the value was bearer-jwt, which the capabilities schema's ^[a-z][a-z0-9_]*$ rejects.

GET /.well-known/jwks.json

JSON Web Key Set for verifying this registry's JWTs. Cache-Control: public, max-age=300, Content-Type: application/jwk-set+json.

  • EdDSA mode — one OKP/Ed25519 public key:
    { "keys": [ { "kty": "OKP", "crv": "Ed25519", "use": "sig",
                  "alg": "EdDSA", "kid": "<fingerprint-or-config>", "x": "<base64url>" } ] }
  • HS256 mode — { "keys": [] }. Symmetric secrets are never published.

See AUTHENTICATION.md.

GET /.well-known/did.json (ACDP 0.2.0)

The registry's own did:web DID document, generated from [receipt] — this is where consumers resolve the receipt verification key (did:web:<authority> resolves to exactly this URL). The active signing key appears in verificationMethod and assertionMethod; retired keys ([[receipt.retired_keys]]) appear in verificationMethod only, per the RFC-ACDP-0010 §9 retention rule. Cache-Control: public, max-age=300 on the 200 arm. 404 when no receipt key is configured — and that arm answers no-store, not public: a cached 404 would keep hiding the document from every resolver that saw the miss once an operator configures a key. See RECEIPTS.md.

GET /healthz

Storage readiness, plus the identity of the running build. Readiness, not liveness: see GET /livez below for why the distinction is load-bearing and which probe belongs on which.

200 with {"status":"ok","storage":true,"version":"..."} when the backend responds, 503 with {"status":"degraded","storage":false,"version":"..."} otherwise. version is present on both responses — build identity matters most when the service is unhealthy.

The version field (#117)

GET /healthz MUST include a top-level "version": a non-empty, human-readable identifier of the running build. It SHOULD begin with the package's SemVer and MAY carry SemVer build metadata (+g<shortsha>). Consumers MUST treat it as opaque — display or equality at most, never parsing.

What it contains depends on how the binary was built:

BuildversionUniquely identifies the build?
Image built by .github/workflows/docker.yml&lt;version&gt;+g<shortsha>Yes
cargo build, cargo run, docker compose up --build, or any other build that injects no commit&lt;version&gt;No

The commit is injected at compile time through the ACDP_BUILD_SHA build ARG. Outside docker.yml it is unset and the field degrades to the bare package version, which every such build shares. Every workspace crate inherits the single workspace version from Cargo.toml (released via release-plz — see the per-crate CHANGELOG.md files), so the bare string is shared by every build of a given release and the +g<shortsha> suffix is what carries build identity.

&lt;version&gt; is the SAME value in both rows — that is the whole point of the table. Two builds of one release carry an identical package version and are told apart only by the +g<shortsha> suffix, which is why the second row cannot uniquely identify a build.

It is deliberately a placeholder rather than a literal: this table named a real version once and that is exactly how it went stale. The contrast it teaches does not depend on which number it is, only on the two rows sharing one.

acdp-control-plane serves the same flat version string shape on its own /healthz. The two are two precision levels of one contract, not two different fields.

For the commit on its own — and for which storage implementation was compiled in — see the build group on GET /admin/status, which is bearer-gated.

GET /livez

Liveness. Always 200, never touches storage. Cache-Control: no-store.

{ "status": "ok", "version": "<opaque build identifier>" }

version is the same field, with the same normative rules, as GET /healthz's — non-empty, human-readable, and opaque to consumers. It is repeated here so a liveness probe's logs identify the build without a second, storage-touching request. status is always the literal "ok": a /livez that can answer at all is alive by definition, so there is no degraded arm to report.

Why this is separate from /healthz

/healthz is readiness — it answers 503 while the database is unreachable, which is exactly right for gating traffic and gating a deploy. It is exactly wrong for a liveness probe: a liveness probe that sees 503 restarts the process, and a process cannot fix an unreachable database by restarting. The restart loop that follows also discards the in-memory webhook queue on every cycle, and that queue has no outbox and no replay.

So: readiness probe → /healthz. Liveness probe → /livez. Pointing both at /healthz turns a database outage into data loss. See RAILWAY.md for the deployment-side note.

GET /metrics (FEAT-10)

Answers Cache-Control: no-store on every arm — 200, 401 and 405: its content is authorization-relative, so a shared cache must never store any of them. The guarantee is unconditional on purpose, and the 405 is the load-bearing part of it: a 405 is produced by the router before any handler runs, so a handler-set header cannot reach it — only a layer can. That layer must then be scoped to this route rather than applied group-wide, because aux also carries the /.well-known/* documents. Two separate constraints, both load-bearing. Stating the guarantee as "the 200 and the 401" would let a refactor to a handler-set header satisfy this sentence verbatim while silently dropping an arm — metrics_is_never_cacheable pins all three so that refactor reddens instead.

Prometheus text exposition (Content-Type: text/plain; version=0.0.4). Mounted only when metrics.enabled = true (404 otherwise). Deliberately outside the ACDP auth pipeline and the /auth/* rate limiter so a scraper reaches it unimpeded; when metrics.bearer_token is set the endpoint requires Authorization: Bearer <token> and answers 401 otherwise. Exposed series:

MetricTypeLabelsMeaning
acdp_registry_request_totalcounterroute, method, status_classHTTP requests by matched route pattern (never the resolved ctx_id).
acdp_registry_request_duration_secondshistogramroute, methodRequest latency.
acdp_registry_publish_totalcounteroutcomePublishes: inserted, idempotent_replay (every path), or a wire code (schema_violation, payload_too_large, …).
acdp_registry_receipts_minted_totalcounter—RFC-ACDP-0010 receipts minted on accepted publishes.
acdp_registry_event_receipts_minted_totalcounter—RFC-ACDP-0017 §10 event receipts minted: one per accepted lifecycle event, plus each earlier event receipted by fill-on-append or the startup sweep.
acdp_registry_event_receipts_incomplete_totalcounter—Reads by a minting registry that omitted registry_state.event_receipts because a context's history is not fully receipted.
acdp_registry_event_receipts_sweep_skipped_totalcounter—Contexts the startup sweep (or fill-on-append) could not complete: a NULL before a receipted event, or a corrupt stored receipt.
acdp_registry_log_leaves_totalcounter—RFC-ACDP-0012 transparency-log leaves appended.
acdp_registry_lifecycle_event_totalcounterevent, outcomeRetract / republish outcomes.
acdp_registry_witness_cosignatures_totalcounteroutcomeWitness cosignatures aggregated / rejected / store_error.
acdp_registry_rate_limit_rejections_totalcounterscope429s by scope (auth_per_ip, auth_global, challenge_per_agent, challenge_global, publish_per_agent, lifecycle_per_agent, keyless_per_ip, keyless_per_identity, read_anonymous, read_principal).
acdp_registry_keyless_key_fetch_totalcounteroutcomeRFC-ACDP-0021 issuer key fetches (JWKS, SPIFFE bundle, OIDC discovery): ok, transport, bad_status, too_large, bad_document, bad_discovery or policy_refused (the address is outside public unicast). Emitted only with keyless.enabled.
acdp_registry_keyless_key_stale_served_totalcounter—Token verifications answered from an issuer key set past its TTL because the refetch failed (stale-if-error, bounded by keyless.jwks_max_stale_seconds).
acdp_registry_rate_limit_shared_totalcounterscope, outcomeRound trips to the shared (cluster-wide) /auth/* limiter backend: scope is auth_per_ip or auth_global, outcome is allow, deny or unavailable. Counts which layer answered; a client-visible 429 still increments the rejections counter above. Emitted only when a shared backend is configured.
acdp_registry_rate_limit_shared_secondshistogramscopeLatency of those round trips. The series to watch to confirm the shared limiter's database load assumption (see docs/OPERATIONS.md).
acdp_registry_changes_requests_totalcounteroutcomeRFC-ACDP-0018 GET /changes requests: ok, or the wire code (invalid_cursor, cursor_expired, schema_violation, …).
acdp_registry_changes_rows_scanned_totalcounter—Feed rows scanned (not returned) by GET /changes; the ratio to requests is the visibility post-filter cost.
acdp_registry_changes_pages_byte_capped_totalcounter—GET /changes pages ended early by the 1 MiB page-size bound (RFC-ACDP-0018 §5.2) rather than by limit or the feed head.
acdp_registry_changes_pruned_totalcounter—Feed rows deleted by the retention prune task.
acdp_registry_changes_head_seqgauge—Feed head seq after the last prune pass.
acdp_registry_changes_pruned_throughgauge—Highest pruned seq; a cursor below it is cursor_expired.
acdp_registry_hint_deliveries_totalcounteroutcomeRFC-ACDP-0018 hint attempts. outcome is delivered, nothing_visible (matching entries the owner cannot see; the position advanced, nothing sent), failed (non-2xx, redirect, timeout, connect error), ssrf_refused (the host no longer resolves to public unicast only), unknown_key (the secret is sealed under a [changes] key_id this replica does not hold; nothing sent, retried like a failure), disabled (the attempt that disabled the subscription: 72 h of failure, a corrupt secret, an unreadable stored owner, or no tenant while auth.require_tenant is set), lease_lost (the subscription was deleted or taken over meanwhile; nothing recorded) or error (a store or evaluation error, or the attempt overran its 20 s bound; nothing recorded, retried once the lease lapses). An address refused at connect time, after the pre-check passed, counts as failed.
acdp_registry_hint_subscriptionsgaugestatusSubscriptions by status (active, disabled), refreshed after every worker pass.
acdp_registry_hint_oldest_due_secondsgauge—Seconds the oldest active subscription behind the feed head has been due (its next_attempt_at to now), 0 when none is overdue; refreshed after every worker pass.
acdp_registry_subscription_requests_totalcounterop, outcomeRFC-ACDP-0018 /subscriptions requests. op is create, get or delete; outcome is ok or the wire code (schema_violation, not_found, not_authorized, not_implemented, …).

scope changed meaning for global challenge rejections (H-A/P4). Until this change, a /auth/challenge rejection caused by the process-global ceiling was labelled challenge_per_agent — the same label as a single noisy agent. It is now challenge_global. If you alert on challenge_per_agent, that series will drop by however much of its volume was actually global-ceiling rejections, and the missing volume reappears under the new label. The two are worth separating precisely because they mean opposite things operationally: challenge_per_agent is one agent to throttle, challenge_global is a flood rotating agent_id to defeat the per-key limit, which is the case the global ceiling exists to catch and the old label hid.

The authoritative list is RateLimitScope::ALL in crates/acdp-registry-core/src/metrics.rs; the table row above is pinned against it by every_rate_limit_scope_is_documented.

Adding a handler needs no metrics-middleware change: request metrics are automatic (from MatchedPath); domain counters are explicit metrics::counter! calls in the handlers.


Contexts

POST /contexts

Publish a context. Not bearer-authed — the producer's signature over the content_hash is the authentication. Runs the full RFC-ACDP-0003 §2.1 pipeline (see ARCHITECTURE.md).

Request headers:

HeaderRequiredNotes
Idempotency-Keyoptional1–256 ASCII chars; replays return the prior result within limits.idempotency_key_ttl_seconds.
X-Run-Idoptional≤256 chars; correlation id echoed into the context.published webhook.
X-Tenant-IdoptionalSelects the tenant only when no signed tenant claim (or, for writes, [[auth.tenant_agents]] binding) applies and auth.tenant_header_trust trusts the sender: none (the default in every mode since 0.4.0) never, trusted_proxies only from a listed gateway peer, any_peer always. A header that is present but untrusted, and does not simply repeat the claim/binding, is 403 not_authorized; default is 400 schema_violation. See MULTI-TENANCY.md.

Body: an RFC-ACDP-0003 PublishRequest (JSON). Response: 201 Created with a PublishResponse (assigned ctx_id, lineage_id, version, status, and — on a receipts-advertising registry — the top-level registry_receipt, the signed RFC-ACDP-0010 attestation minted atomically with the row). A per-agent rate limit (limits.publish_rate_per_minute, default 60, keyed by the body's agent_id) answers 429 + Retry-After when drained. Before signature verification it is only a read-only peek: the claimed agent_id is not yet proven, so an over-budget agent is refused but nothing is charged and no bucket is created. The publish is charged only once the signer's identity is proven (from then on, a later failure such as a store error is charged too) or when the publish succeeds. A publish that fails before its signer is proven — a bad signature, an unresolvable key, a malformed body — costs the named agent nothing. In playground mode without a pinned key nothing is verified, so only a successful publish is charged. Because peek and charge are separated by the verify, concurrent publishes by one agent can overshoot the limit by the number in flight.

Status and Location. A first successful publish answers 201 Created (RFC-ACDP-0003 §4); an idempotent replay (same agent, same Idempotency-Key, same content_hash) answers 200 OK with the original response (§6.2). Both carry Location: /contexts/<ctx_id>, a path-relative URL whose ctx_id is percent-encoded as one path segment (acdp://host/uuid becomes /contexts/acdp%3A%2F%2Fhost%2Fuuid, uppercase hex). A replay emits no second context.published webhook, mints no receipt and appends no log leaf. Before 0.5.0 the response was 200 with no Location (see UPGRADING.md).

did:key producers (ACDP 0.2.0) are verified offline — no DID-document fetch — when "did:key" is in supported_did_methods; otherwise the publish is rejected with key_resolution_failed (400, permanent).

anchors (RFC-ACDP-0016, still Draft) is an optional array of typed, content-addressed references to external artifacts. Its shape, the content-hash binding, and the version rules are normative in RFC-ACDP-0016 §4 and §10; the request-side version rule (a declared acdp_version of 0.5.0 or above) is RFC-ACDP-0016 §14. What this registry adds: since it always advertises acdp_version "0.5.0", only the request half of the gate can fail — a publish carrying anchors whose declared acdp_version is absent or below 0.5.0 is rejected with schema_violation (400). The check runs right after the body parses, before the rate-limit peek and before signature verification, so it applies to every publish path (did:key, playground pinned-key, playground unpinned, and the default did:web pipeline) and a rejected publish is never charged. Each anchor's uri is stored and re-served verbatim and is never dereferenced by this registry.

GET /contexts/{ctx_id}

Retrieve a full context. Optional Authorization: Bearer <jwt> identifies the caller for the visibility gate (RFC-ACDP-0008 §4.5). 404 when not found or not visible to the caller (no existence oracle). If ctx_id's authority differs from this registry's and registry.cross_registry_resolution = true, the request is resolved against the foreign registry anonymously — only remote public contexts are surfaced (see OPERATIONS.md).

On a receipts-advertising registry the response carries the top-level registry_receipt member (outside body and registry_state); contexts published before receipts were enabled omit it (no backfill — see RECEIPTS.md). Foreign retrievals pass the upstream's verified receipt through verbatim, along with the upstream's registry_state and its body exactly as the origin sent it (never re-serialized), so a consumer recomputing content_hash over the raw body (RFC-ACDP-0001 §5.7) gets the producer's bytes whatever timestamp spelling the producer used.

On a lifecycle-advertising registry (lifecycle.enabled, ACDP 0.3.0) a context that has been retracted/republished carries its append-only registry_state.lifecycle_events array (RFC-ACDP-0013 §4.1; omitted when empty) and its status reflects the §7.2 precedence (retracted > superseded > expired > active). Retraction is mark-not-delete: the body of a retracted context is served unchanged.

When the registry also advertises acdp-registry-receipts and declares acdp_version >= 0.5.0, registry_state.event_receipts runs parallel to lifecycle_events: element i is the acdp-event-receipt/1 the registry signed with its receipt key when it accepted event i (RFC-ACDP-0017 §10). It is append-only, and it is served only when every event has a receipt (omitted otherwise, including when there are no events). A byte-identical retry of an event serves the stored receipt rather than minting another. See RECEIPTS.md.

GET /contexts/{ctx_id}/body

As above, but returns only the context Body (no envelope metadata, and never registry_receipt — the immutable-cache story is unchanged).

GET /contexts/search

Keyword + filter search. Optional bearer scopes which contexts are disclosable.

Query parameters (all optional):

ParamMeaning
qFull-text query over title, summary, description, domain, tags and agent_id. On Postgres it is plainto_tsquery('english', q): English stemming (running matches "run"), English stopwords dropped, case-folded, every remaining word required (any order), no operator syntax. SQLite (FTS5 porter tokenizer plus the same stopword list) is brought to the same contract, and both backends run the same parity test; the two stemmers are different implementations and can still disagree on individual words. A query made only of stopwords (q=the) matches nothing on either. The demo memory backend differs: one case-insensitive substring match of the whole query, unstemmed, so a multi-word q is a contiguous phrase (matched over all fields joined with spaces, so it can span two fields).
typeContext type filter.
domain, tags, agent_id, schema_uri, derived_fromExact-match facets.
statusStatus filter (default active). A retracted context matches only status=retracted — never the default, nor superseded/expired even where those facts also hold (RFC-ACDP-0013 §8.2).
visibilityNarrow to public / restricted / private.
created_after, created_beforeRFC 3339 bounds on creation time.
data_period_start_after, data_period_end_beforeBounds on the context data period.
expires_after, expires_beforeBounds on expiry.
limitPage size, default 20, clamped to 100. Values above the cap are served at the cap, not rejected; 0 floors to 1.
cursorOpaque pagination cursor from a prior next_cursor.

Response: a SearchResponse — { matches: [...], total_estimate, next_cursor }. Visibility (RFC-ACDP-0008 §4.5) is enforced in the SQL WHERE clause on both backends, and tenant narrowing is too — a tenant-scoped request is served by ExtendedRegistryStore::search_in_tenant, which carries the tenant predicate in the same statement as the keyset and the count. A ?visibility= narrow is still post-filtered with a bounded refill loop (up to 6 inner pages), so a page may return fewer than limit rows near the end of a result set even though next_cursor is set — keep paging until next_cursor is absent.

total_estimate is returned for every caller, including a tenant-scoped one, and it is the caller's own count. For a request that asserts a tenant it is the number of §4.5-visible matches within that tenant — never the registry-wide figure. It also counts only what the status filter keeps: a retracted context is excluded from the default (active) search's matches[] and from its total_estimate (RFC-ACDP-0013 §8.2, fixture lc-001 D). The status projection runs in the same SQL scan as the count. Before #561 it ran afterwards, so a retracted, superseded or expired context was still counted.

This paragraph previously documented the opposite, and the history is worth one sentence because the field's meaning changed rather than its presence. It was omitted from tenant-scoped responses because it was wrong: the count was taken in the store before the handler applied the tenant predicate, so it described rows across every tenant and handed a tenant-scoped caller a population size for data it could not see. search_in_tenant put the predicate in the same statement as the keyset and the count, so COUNT(*) OVER () now rides a scan that only ever sees the caller's rows. The number is correct by construction, and withholding it would hide a figure the caller is entitled to and which discloses nothing.

Two things a client should not infer. The count is not the page size: with limit smaller than the result set, total_estimate exceeds matches.len() and is the pre-page total. And it is an estimate in name only on these backends — COUNT(*) OVER () is exact for the scan it rides — but treat it as advisory, per RFC-ACDP-0008, rather than as a value to paginate against.

The cursor oracle described here previously is closed. Recorded rather than deleted, because the shape of it is worth knowing and because this paragraph used to tell readers the fix had not been built.

next_cursor is unsigned plaintext base64 of {mint_ms}:{anchor_ms}:{ctx_id}, anchored on the last row the store scanned — not the last row returned. While tenant narrowing was a handler-side post-filter, the scan saw other tenants' rows, so a returned cursor could carry a foreign (created_at, ctx_id): the filter dropped the row but the anchor had already been computed from it. No post-filter can fix that, which is the whole point — dropping a row after the fact does not un-scan it.

A tenant-scoped request is now served by search_in_tenant, so the scan never sees another tenant's rows and the anchor can only ever be one of the caller's own. Cursors remain unsigned and unauthenticated, so a caller can still read and forge its own {mint_ms}:{anchor_ms}:{ctx_id} — that is a separate property, unchanged by this, and not a cross-tenant disclosure.

GET /lineages/{lineage_id}

Every version in a lineage as a FullContext array, visibility- and tenant-filtered. Optional bearer. Each version carries its own projected status and (under the lifecycle profile) its lifecycle_events — the lineage array is the record, and the record includes withdrawals. Each member also carries what its full retrieval carries (RFC-ACDP-0017 §11): the top-level registry_receipt when one was minted and, on an event receipts registry, registry_state.event_receipts, so a consumer can verify a whole lineage from this one response.

GET /lineages/{lineage_id}/current

The newest version that is neither superseded nor retracted (RFC-ACDP-0004 §5.2 as amended by RFC-ACDP-0013 §8.3 — an expired head is still a valid head). 404 when the lineage is unknown, no version is visible, or every version is superseded-or-retracted; retracting a linear lineage's head therefore takes the lineage off /current entirely until the producer republishes it or supersedes it with a fresh version. The head is served as a full FullContext, with the same registry_receipt, lifecycle_events and event_receipts as its full retrieval.

When receipt.head_receipts = true (ACDP 0.3.0 / RFC-ACDP-0011) the response additionally carries a top-level lineage_head_receipt: a registry-signed, per-response attestation that "as of as_of, the head of this lineage is head_ctx_id at head_version with head_status". It is minted after head selection (so it can never name a superseded or retracted head), signed with the RFC-ACDP-0010 receipt key, never persisted, and never attached to body-only responses. See RECEIPTS.md.

POST /contexts/{ctx_id}/retract, POST /contexts/{ctx_id}/republish (ACDP 0.3.0)

Lifecycle events & retraction. The request envelope, the event object, its signing, the ordered processing steps (visibility-first resolution, closed shape with immutable_field for body content, actor authentication, the invalid_lifecycle_transition alternation check, atomic append), retry idempotency and the response shape are normative in RFC-ACDP-0013 §4, §5 and §6; the handler follows §6 in order. A registry with the flag off never serves lifecycle state: it refuses to start over a store that holds any (see CONFIGURATION.md). What is specific to this registry:

  • Gate. Mounted always; a registry without lifecycle.enabled = true answers 501 not_implemented.
  • Signature verification goes through the same DID pipeline as a publish — did:web via resolution, did:key offline.
  • Rate limit. Per-agent limiting draws on the same bucket as publish (limits.publish_rate_per_minute), keyed by the event actor. After the shape and path checks the handler only peeks at the bucket (an actor already over budget gets 429). After the tenant gate and the bearer check, the acdp SDK proves the event (visibility, event validation, actor == producer, signature) before it commits anything, and the request is charged between the two — on every exit from then on, including a 409 and a byte-identical replay. An event that fails to prove (unsigned, mis-signed, an unknown or invisible context, a 403 for an actor that is not the producer) is never charged. See Rate limits.
  • Response. 200 with the post-transition full-retrieval envelope (body + registry_state, status re-derived, lifecycle_events including the new event, and on an event-receipts registry event_receipts including its receipt).

Only the producer may use these endpoints (delegation is not supported). Registry-initiated events go through the admin-gated POST /admin/contexts/{ctx_id}/retract and /republish, which attribute the event to the registry's own DID.

GET /log/checkpoint, GET /log/proof, GET /log/entries (ACDP 0.3.0)

Registry transparency log. The checkpoint object, the two /log/proof modes and their parameters, the /log/entries shape, and the verification procedures are normative in RFC-ACDP-0012 §6, §8 and §9; the witness_signatures aggregation envelope is RFC-ACDP-0015 §6.1. This section records what this registry does with them:

  • Gate. Mounted always; a registry without log.enabled = true answers 501 not_implemented from every /log/* path. With it there is no log_unavailable anywhere: every accepted publish appends its leaf in the same storage transaction as the context row and its receipt, so the proof for a context exists the moment its publish response does.
  • Checkpoints are signed with the [receipt] key (no new key role); timestamp is fresh per evaluation, and a /log/proof request for a historical tree_size gets a checkpoint signed at that size on demand. Publicly readable wherever capabilities are.
  • Witness cosignatures (ACDP 0.4.0). When [[witnesses]] is configured and at least one verified cosignature exists for the exact (log_id, tree_size, root_hash) being served, GET /log/checkpoint returns the envelope (log_checkpoint plus a sibling witness_signatures array), and the checkpoint embedded in a GET /log/proof response carries the same sibling. With none collected the response is the bare checkpoint — the array is never fabricated or served empty. Aggregation adds no profile (still acdp-registry-transparency-log) and does not move acdp_version, which is "0.5.0" regardless (see GET /.well-known/acdp.json). See CONFIGURATION.md for [[witnesses]].
  • Visibility. An inclusion proof by ?ctx_id= applies retrieval visibility exactly as for GET /contexts/{ctx_id}: an unauthorized or unlogged ctx_id is 404 not_found, indistinguishable from absence. Proofs by ?leaf_index= and consistency proofs have no visibility gate. The convenience leaf echo on /log/proof, and the leaf of each /log/entries entry, are present only when the requester is authorized to retrieve that context (public contexts: always); otherwise absent, never null. Leaf hashes, positions and tree size are public by design — a registry with confidentiality requirements over publication volume/timing metadata must weigh that before enabling [log].
  • Limits and errors. GET /log/entries returns at most 256 entries per page; continue from start + len(entries). Mixing the /log/proof parameter sets, omitting both, malformed integers, or out-of-range positions/sizes → 400 schema_violation. A stored leaf that no longer parses surfaces as invalid_log_proof from this registry's own /log/proof — see the status table.

GET /changes (ACDP 0.5.0)

The registry change feed (profile acdp-registry-changes). Entry shapes, parameters and cursor semantics are normative in RFC-ACDP-0018 §5 and §6. This section records what this registry does with them:

  • Gate. Mounted always; without changes.enabled = true every request is 501 not_implemented. Enabling it needs lifecycle, a [receipt] key and a durable store (see CONFIGURATION.md).
  • What is recorded. One entry per accepted lifecycle event (kind: lifecycle, carrying the event and its event receipt), per superseding publish (kind: superseded, ctx_id the older version, superseded_by and registry_receipt the new one's), and per accepted key-revocation context (kind: key_revocation). A plain publish and an idempotent retry record nothing. Each entry commits in the same storage transaction as its change, and its evidence is byte-identical to what registry_state (or the new version's retrieval) serves.
  • Parameters. since is absent (start at the oldest retained entry), head (start at the current head; returns changes: []), or a cursor from an earlier next_cursor; an empty since= is 400 invalid_cursor. limit is a positive integer (default 100); one above max_changes_page is clamped to it. ctx_id, lineage_id, agent_id and kind repeat; the three id filters OR together and kind ANDs with them, and a ctx_id watch also matches key_revocation entries for that context's producer. More than max_change_filters filter values in total, a repeated since/limit, a malformed id or an unknown kind → 400 schema_violation (limit errors name details.field = "limit"). Unknown parameters are ignored, except lineage_bucket and agent_bucket (below).
  • Bucket filters (§6.1). Served only when [changes] max_change_bucket_length is set, which advertises limits.max_change_bucket_length. lineage_bucket and agent_bucket repeat; each value is 1 to that many lowercase hex digits, a prefix of lowercase hex(SHA-256(UTF-8(value))) of the lineage_id or agent_id exactly as served. They OR with each other and with the id filters, kind ANDs with the result, and their values count toward max_change_filters. The page holds the whole bucket: every visible entry whose id hashes into a requested prefix, so the consumer keeps the exact ids it watches and discards the rest. There is no key-revocation counterpart: only an exact ctx_id watch matches its producer's key_revocation entries, so watch the producer's agent_bucket to hear those. Visibility, refill and cursors are unchanged. Not advertised (the default), either parameter is 400 schema_violation with details.field naming it, whatever its value, rather than being ignored; advertised, an empty, upper-case, non-hex or over-long value is the same 400. Parameters are checked before the anonymous-reader refusal below, so a malformed or unsupported bucket parameter is a 400 for an anonymous caller too.
  • Response. {changes, next_cursor, has_more}; next_cursor is always present, including on an empty page, and resumes strictly after the last entry returned when the page is full, otherwise after the last position scanned. Cursors are opaque, authenticated (AES-GCM under the [changes] key) and durable: they stay valid until the entry they point past is pruned.
  • Visibility. Entries are filtered per requester after the scan: a lifecycle entry is visible when its context is retrievable, a superseded entry only when the new version is retrievable, and a key_revocation entry always. Hidden entries never end the feed early: the scan refills past them (up to six scan batches per request), and if that budget runs out the page comes back short with has_more: true and a next_cursor past everything scanned. A short page is not the end of the feed; has_more: false is. A ctx_id watch matches its producer's revocations only when that context is visible, so a watch never discloses who produced a hidden context. Responses carry Cache-Control: private. When anonymous_public_reads is false, an anonymous request is 403 not_authorized, as on search.
  • Page size. A serialized page body stays at or under 1 MiB (1,048,576 bytes, measured before any content coding, RFC-ACDP-0018 §5.2) whatever limit asks for: the page ends early with has_more: true and a next_cursor that resumes at the first entry left out. A single entry larger than that on its own is served alone on its page, so the feed always moves forward. With the default max_changes_page = 100 real pages stay far below the bound.
  • Compression. GET /changes is the only compressed route, and gzip the only coding: with Accept-Encoding: gzip (or x-gzip, or *, at any q > 0, case-insensitive) a response body of at least 32 bytes comes back Content-Encoding: gzip without Content-Length; error bodies included. Every response the handler produces carries Vary: accept-encoding, whether or not it is compressed. It never answers 406: an Accept-Encoding that rules out gzip, even one that also rules out identity (identity;q=0, *;q=0, br, identity;q=0), gets the handler's own status with an identity body (RFC 9110 §12.1, §12.5.3, §15.5.7), and a malformed header is treated as absent. A 403 from read authentication is never compressed. Every other route ignores Accept-Encoding.
  • Retention. Entries are kept at least change_retention_seconds (advertised; at least 30 days) and pruned oldest-first by a background task. A cursor pointing before the oldest retained entry, past the head, or minted under a key this registry does not hold is 400 cursor_expired; restart from since absent or head. A cursor that does not decode or authenticate is 400 invalid_cursor.
  • Sequence resets (§5.3). A cursor carries the feed head it was issued at and that row's fingerprint. After a restore that rolls seq back, a cursor whose anchor row is gone or is now a different entry is cursor_expired, even once new entries have reused its position, so no consumer skips them. A restore also raises [changes] cursor_epoch, which expires every cursor of the earlier epoch. A cursor issued by 0.9 or earlier (the 51-character version-1 format) carries no anchor and is cursor_expired once; resync from since=head.

POST /subscriptions, GET /subscriptions/{id}, DELETE /subscriptions/{id} (ACDP 0.5.0)

Change-hint subscriptions (profile acdp-registry-events), normative in RFC-ACDP-0018 §8. This section records what this registry does:

  • Gate. Mounted always; without events.enabled = true every request is 501 not_implemented, before authentication. Enabling it needs the change feed and auth.enabled (see CONFIGURATION.md).
  • Ownership. Every request needs a bearer; an anonymous one is 403 not_authorized. A subscription belongs to the DID that created it. Another requester's id, an id that does not exist and an id that is not a UUID are all 404 not_found, so an id discloses nothing.
  • Create. The body is an acdp-subscription-request: a filter with the GET /changes semantics (at least one member, no empty or duplicate values, at most max_change_filters values in total) and an https callback_url. A filter carrying lineage_bucket or agent_bucket is 400 schema_violation (details.field = "filter"), whether or not GET /changes serves bucket filters: a subscription filter has no bucket member (RFC-ACDP-0018 §8.1, §6.1). The callback_url is refused unless it is https, names a host rather than an IP literal, and every address that host resolves to is public unicast (RFC-ACDP-0006 §7). A public IP literal is refused too: stricter than §8.3, which constrains only the resolved address. A refusal at resolution gives one fixed message, so the response never reveals what a name resolves to. A bad filter, a refused callback_url and a requester already holding max_subscriptions_per_requester subscriptions are each 400 schema_violation with details.field set to filter, callback_url or limits.max_subscriptions_per_requester. Other malformed bodies are 400 schema_violation. Success is 201 with the subscription, status: "active", and a secret of 32 random bytes in base64, sent with Cache-Control: no-store. The secret appears in this response only. The registry stores it sealed (AES-256-GCM under a key derived from the [changes] key, bound to the subscription id), never in plaintext. A new subscription hints only for changes after its creation.
  • Read. GET returns the same object without secret (Cache-Control: private).
  • Delete. DELETE is 204. The slot it held counts toward the limit until then; a disabled subscription still holds one.
  • Hints. A background worker on every replica POSTs an acdp-change-hint/1 body (Content-Type: application/json, header ACDP-Signature: t=<unix seconds>,v1=<hex HMAC-SHA-256>) to the callback_url when the feed holds an entry past the subscription's last hint that matches its filter and that the owner's own GET /changes would return. A change the owner cannot see sends nothing. Every change since the last hint is covered by one hint, and a subscription is hinted at most once a second. The hint carries no change content: the receiver calls GET /changes itself. Each delivery re-resolves the host and refuses it unless every address is public unicast (a lookup has 5 s); the connection's own lookup is checked the same way, so an answer that rebinds in between is refused too. It follows no redirect, gives up after 10 s and never reads the response body. Any non-2xx, a redirect, a timeout or a refused address is a failure: retries back off from one minute, doubling to an hourly ceiling, and changes in the meantime coalesce into the next hint. A subscription still failing 72 hours after its first failure is disabled, GET then shows "status": "disabled", and it is never tried again; the owner deletes and re-creates it. A delivered hint ends the failure run. Replicas share the work through 60-second store leases, so a hint is delivered by one replica.

POST /key-attestations, GET /key-attestations (RFC-ACDP-0021)

Without keyless.enabled (the default) both answer 501 not_implemented, decided before the request is read (no body or query refusal can precede it), and the capabilities document carries neither the acdp-registry-keyless profile nor the keyless member. With it, both are served as below, and the profile and the keyless member (accepted_oidc_issuers, accepted_spiffe_trust_domains, max_attestation_ttl_seconds) are advertised together (§13.1). See CONFIGURATION.md and OPERATIONS.md.

POST takes an acdp-key-attestation-request/1 body (Content-Type JSON, under max_payload_bytes, no HTTP signature: the workload token authenticates it) and runs RFC-ACDP-0021 §5.2 in order, stopping at the first failure:

StepFailureHTTPcodedetails.reason
—per-IP budget (keyless.rate_per_ip_per_minute, charged on arrival)429rate_limited—
1not the closed schema (a did:key controller, an X509-SVID, requested_ttl_seconds outside 1..3600, unknown member)400schema_violation—
—the identity's budget (keyless.rate_per_identity_per_minute; peeked here, charged only once the token verifies)429rate_limited—
2issuer or trust domain not configured403key_not_authorizedissuer_not_accepted
3token signature, iss/sub, exp/nbf/iat, header rules403key_not_authorizedtoken_invalid
3issuer's key set unreachable (no usable cached copy)502key_resolution_unreachableissuer_unreachable
3aud does not contain this registry's DID403key_not_authorizedaudience_mismatch
3cnf.jkt is not the presented key's thumbprint403key_not_authorizedconfirmation_mismatch
3the token already minted an attestation403key_not_authorizedtoken_replayed
4pop does not verify (a P-256 pop must be 64-byte P1363; DER is refused)400invalid_signaturepop_invalid
5algorithm is not the key's, or not in supported_signature_algorithms400unsupported_algorithm—
6the controller's DID document cannot be fetched400 / 502key_resolution_failed / key_resolution_unreachable—
6the document's AcdpKeylessSigning service does not list the identity, after one re-fetch past the cache403key_not_authorizedidentity_not_authorized
6not listed in a cached document, and the re-fetch is rate-limited502key_resolution_unreachable—

On success it publishes the acdp:key-attestation body under the registry's DID, signed with the receipt key, untenanted, through the ordinary publish path (receipt, transparency-log leaf and attestation index row in one transaction; a token that raced another request to it is refused there as token_replayed), and answers 201 Created with Location: /contexts/{ctx_id} and the full retrieval representation (body, registry_state, registry_receipt). The window is [now, min(now + requested_ttl_seconds (default 600), now + keyless.max_attestation_ttl_seconds, token exp)]. The token is never logged or stored; token_hash is its trace.

GET /key-attestations?controller=<did:web> lists a controller's attestations, newest first, optionally filtered by issuer and subject, paged like search (limit default 20, at most 100; cursor from next_cursor). Items are {ctx_id, content_hash, metadata}. A missing or non-did:web controller is 400 schema_violation; a bad cursor is 400 invalid_cursor; an unknown controller is an empty page.

Keyless publish, supersession and lifecycle events (RFC-ACDP-0021 §6.3, §7)

With keyless.enabled, POST /contexts accepts a body whose signature.key_id fragment begins acdp-kl- and whose key_attestation names an attestation this registry minted. The body is checked against the stored attestation in the publish transaction, and the receipt and transparency-log leaf carry the attested key_fingerprint. Refusals:

FailureHTTPcodedetails.reason
a key_attestation member beside a key_id that is not acdp-kl-400schema_violation—
an acdp-kl- key_id with no key_attestation400key_resolution_failedattestation_missing
key_attestation.ctx_id is on another registry400key_resolution_failedattestation_foreign
nothing (or no attestation) at that ctx_id400key_resolution_failedattestation_not_found
key_attestation.content_hash is not the stored attestation's400key_resolution_failedattestation_mismatch
agent_id, key_id or algorithm is not the attestation's403key_not_authorizedattestation_mismatch
the attestation was retracted (withdrawn, §9.2)403key_not_authorizedattestation_withdrawn
the registry's created_at is outside [not_before, not_after)403key_not_authorizedoutside_attestation_window
the controller no longer lists the identity (re-checked on publish)403key_not_authorizedidentity_not_authorized
the signature does not verify under the attested key400invalid_signature—
a successor's identity may not supersede its predecessor (§7: same identity, or an org_wide successor; a non-org-wide keyless body never supersedes a controller-signed one)403not_authorizedkeyless_identity_mismatch
a lifecycle event (/retract, /republish) signed under an acdp-kl- key id (R13)400key_resolution_failedkeyless_event_unsupported

Without the profile, an acdp-kl- key id is an ordinary unresolvable key (400 key_resolution_failed, no details). A registry advertising an acdp_version below 0.5.0 refuses any key_attestation member as 400 schema_violation (kl-007 C); this binary advertises 0.5.0.


Auth

Mounted only when auth.enabled = true. Full flow and JWT details in AUTHENTICATION.md.

POST /auth/challenge

Body { "agent_id": "did:web:..." } — did:key: is accepted here too.

The agent_id is checked cheaply before any storage work: it must start with did:web: or did:key: and be 9–2048 bytes long (UTF-8 bytes, both bounds inclusive). Anything else is rejected 403 not_authorized (auth challenge: unsupported DID method: …) without a challenge record being written, so a client mistyping the method cannot fill the challenge table.

Measured against a running registry:

agent_idlengthresult
did:web:a9200 — a challenge is minted
did:web:8403 not_authorized
did:key:z6MkExample19200 — even with auth.did_methods = ["did:web"]
did:foo:bar11403 not_authorized
""0403 not_authorized

This is a prefix and length check only. Full DID parsing, and the auth.did_methods capability gate, run later at POST /auth/token — so a registry that does not list did:key in auth.did_methods will still issue a challenge for a did:key: agent and reject it at token time. See AUTHENTICATION.md step 5.

Returns an AuthChallenge:

{
  "nonce": "<24 random bytes, url-safe base64>",
  "registry_authority": "registry.example.com",
  "expires_at": 1748000300,
  "signing_input": "acdp-registry-auth:v1:{nonce}:{agent_id}:{authority}:{expires_at}"
}

agent_id must be a did:web: or did:key: DID of 9–2048 bytes (the screen above). Bounded by limits.challenge_rate_per_minute (default 60) per agent_id plus a process-global ceiling; 429 + Retry-After when drained.

POST /auth/token

Exchange a signed challenge for a JWT. Body:

{
  "agent_id": "did:web:agents.example.com:my-agent",
  "key_id":   "did:web:agents.example.com:my-agent#key-1",
  "nonce":    "<from the challenge>",
  "expires_at": 1748000300,
  "algorithm": "ed25519",
  "signature": "<base64 signature over signing_input>"
}

algorithm is ed25519 or ecdsa-p256; it must match the algorithm declared on the resolved verification method (downgrade defense). Response:

{ "token": "<jwt>", "token_type": "Bearer", "expires_at": 1748003600 }

A challenge failure is 403 not_authorized. A did:web document the registry could not reach (non-2xx, timeout, TLS failure, or a key absent from a stale cached copy whose forced re-fetch was rate-limited) is 502 key_resolution_unreachable: retry with a new challenge. See AUTHENTICATION.md, step 6.

POST /auth/token/revoke

Body { "jti": "<token id>" }. Requires Authorization: Bearer <jwt>; the caller's DID must own the jti. 204 on success. 501 not_implemented if no revocation store is configured — unreachable from the shipped binary, which always wires one; only a library embedder building its own AppState can hit it. See AUTHENTICATION.md.


Admin

All six /admin/* routes are bearer-gated against auth.admin_tokens (constant-time compare; empty list disables every route that checks it): GET /admin/status, GET /admin/lineages/{lineage_id}/audit, POST /admin/contexts/{ctx_id}/retract, POST /admin/contexts/{ctx_id}/republish, GET /admin/contexts, and POST /admin/pinned-keys/reload. See OPERATIONS.md.

GET /admin/status

Operational snapshot. Always shipped.

{
  "build":       { "version": "<version>+g83de685c2f26", "commit": "83de685c2f26",
                   "storage_impl": "acdp_registry_sqlite::store::SqliteStore" },
  "storage":     { "healthy": true },
  "idempotency": { "records": 128 },
  "webhook":     { "enabled": true, "queue_in_flight": 0, "queue_capacity": 1024 },
  "revocation":  { "configured_feeds": 2 },
  "migrations":  { "backend": "Sqlite", "applied": true },
  "tenancy":     { "require_tenant": true, "tenant_header_trust": "trusted_proxies",
                   "tenant_header_trust_configured": true, "trusted_proxies": 1 }
}

idempotency.records, the webhook queue fields (queue_in_flight, queue_capacity) and build.commit are omitted entirely when unavailable — they are not serialised as null. Each carries #[serde(skip_serializing_if = "Option::is_none")] (crates/acdp-registry-core/src/handlers/admin.rs), so a client must treat the key as absent, not as present-with-null. A consumer doing body["webhook"]["queue_in_flight"] === null will not match.

Measured on a local SQLite build with webhooks disabled — note webhook carries only enabled, and build carries no commit:

{
  "build":       { "version": "<version>",
                   "storage_impl": "acdp_registry_sqlite::store::SqliteStore" },
  "storage":     { "healthy": true },
  "idempotency": { "records": 0 },
  "webhook":     { "enabled": false },
  "revocation":  { "configured_feeds": 0 },
  "migrations":  { "backend": "Sqlite", "applied": true },
  "tenancy":     { "require_tenant": false, "tenant_header_trust": "none",
                   "tenant_header_trust_configured": false, "trusted_proxies": 0 }
}

The tenancy group (#391)

The tenant-resolution policy the running process applies, so it can be checked without reading startup logs.

  • require_tenant — auth.require_tenant.
  • tenant_header_trust — the effective mode: "none", "trusted_proxies" or "any_peer" (who may send X-Tenant-Id).
  • tenant_header_trust_configured — whether the key was set (file or environment). false means the mode is the default, none (since 0.4.0).
  • trusted_proxies — how many rate_limit.trusted_proxies entries are configured: the gateway list the trusted_proxies mode matches against. A count only; the CIDRs are not disclosed.

The build group (#117)

The coarse version string is also served unauthenticated on GET /healthz; the commit and the compiled-in storage implementation are disclosed only here, behind the admin bearer.

  • version — identical to the /healthz value. Opaque; see the version field.
  • commit — the injected build SHA. Omitted entirely when the binary was not built by docker.yml (ACDP_BUILD_SHA unset). Its absence is meaningful rather than an error: it means this build is not uniquely identified, and version is the bare package version that every such build shares.
  • storage_impl — which store implementation was compiled in, as opposed to the runtime storage.backend that migrations.backend reports. An opaque diagnostic identifier for human consumption: it is a Rust type path from std::any::type_name, whose output carries no stability guarantee and may change across compiler versions. Display it; do not parse it or branch on it.

GET /admin/lineages/{lineage_id}/audit (ACDP 0.2.0)

Full lineage walk as an on-demand integrity check (workstream D3): the publish path validates only against the immediate predecessor's persisted row (lineage anchoring); this endpoint re-walks the entire chain. Always shipped.

{
  "lineage_id": "lin:sha256:…",
  "versions": 4,
  "ok": true,
  "issues": [],
  "receiptless_contexts": 1
}

Checks: version contiguity from 1, supersedes links, the lineage_id derivation from v1's ctx_id, producer continuity, and the single-non-superseded-tip invariant. receiptless_contexts counts rows without a stored receipt (informational — pre-receipts history is legitimate; see RECEIPTS.md). 404 for an unknown lineage.

POST /admin/contexts/{ctx_id}/retract, POST /admin/contexts/{ctx_id}/republish (ACDP 0.3.0)

Registry-attested lifecycle events (RFC-ACDP-0013 §6, "registry-initiated events") — the policy/legal takedown path, distinct from the producer-signed POST /contexts/{ctx_id}/{retract,republish}. Use when a context must be formally withdrawn (or a withdrawal reversed) and the producer is unavailable: the registry mints the event itself and attributes it to its own DID (capabilities.registry_did = did:web:<authority>), not the producer.

Auth is the standard admin gate (auth.admin_tokens bearer). Requires [lifecycle] enabled — a registry not advertising acdp-registry-lifecycle answers 501 not_implemented (after the admin gate). Always mounted.

Request body — a closed object with one optional member (the operator supplies only the reason; the registry mints the event_id, occurred_at, actor, and signature):

{ "reason": "removed by policy: court order 2026-… (producer unavailable)" }

An empty body is accepted (reason is optional). Any other member → 400 schema_violation.

Signing (mirrors the SDK's record_registry_lifecycle_event contract exactly):

  • [receipt] key configured → the event MUST be signed under the receipt key (RFC-ACDP-0013 §5; the receipts-profile MUST). signature.key_id is did:web:<authority>#<receipt.key_id_fragment>, verifiable against the registry DID document at /.well-known/did.json.
  • No [receipt] key → the event is recorded unsigned but attributed: actor still names the registry DID, and signature is omitted. Consumers weight an unsigned registry event only as far as the response transport (§5). This is not a refusal — it is exactly what the SDK helper permits when no receipt signer is present.

Downstream semantics are identical to the producer path: atomic commit_lifecycle_event, the retracted > superseded > expired > active status projection, the strict-alternation transition check (409 invalid_lifecycle_transition on a double-retract or a republish of a non-retracted context), byte-identical-event_id idempotency, and the context.retracted / context.republished webhook (with actor = the registry DID). On success returns 200 with the full-retrieval envelope (body + registry_state), the minted event appended to registry_state.lifecycle_events so its registry attribution is visible to consumers. On an event-receipts registry the event is receipted exactly like a producer event, in the same transaction, under the same receipt key.

Cross-actor alternation is allowed. RFC-ACDP-0013 §7.1 derives retraction state from event-type order alone (never the actor), and §6 authorizes the producer (actor == agent_id) and the registry (actor == registry_did) independently. So a producer may /republish a context the registry retracted, and vice versa; both events remain in the append-only history, attributed to their distinct actors. (The RFC is silent on actor symmetry for the reversal; allowing it is the natural reading of an actor-agnostic §7.1 and the intended "registry retracts by policy, producer later resolves and republishes" flow.)

GET /admin/contexts (playground feature)

Paginated dump of stored contexts for the requested tenant. Query: limit (default 50), cursor. Returns { items: [...], next_cursor }. Tenant filter applies at the SQL level.

Admin-bearer gated, like every other /admin/* route (see the note at the top of Admin). The admin bearer authenticates the caller but names no agent DID, so under the RFC-ACDP-0008 §4.5 predicate it reaches the public arm only: visibility = 'public' rows are always included, and restricted/private rows are never disclosed to this listing — because admin_list (crates/acdp-registry-core/src/handlers/admin.rs) passes public_arm_open = true to list_contexts unconditionally (its local admin_sees_public_arm), independent of the configured auth.anonymous_public_reads, which instead governs whether an anonymous (no-bearer) caller of GET /contexts/search sees public rows. That flag is carried on the CapabilitiesDocument, and RegistryServer::search reads it off self.caps. The tenant filter applies only when a tenant is asserted; with none, the listing spans every tenant rather than defaulting to one (in strict mode an unscoped listing is 403, as for any other request). On this route an X-Tenant-Id header is honoured from the admin-bearer caller whatever auth.tenant_header_trust says (#391): the admin credential is already cross-tenant, so the header only narrows the listing. default is still 400 schema_violation.

POST /admin/pinned-keys/reload (playground feature)

Re-reads config from disk and hot-swaps only the [playground] section (pinned keys). No body. Returns { "ok": true, "count": <n> }. Other config sections require a restart.

The loaded [playground] section is validated before it is applied, against exactly the rules the startup validator enforces (see CONFIGURATION.md). Three failure modes, and the distinction between the two 5xx-looking ones matters operationally:

StatusMeaningLive config
403bearer missing, malformed, or not in auth.admin_tokensunchanged
400the config was read fine, but its [playground] section is one startup would refuse — an operator errorunchanged
500the registry could not read or parse its own config file at all — a server faultunchanged

400 is deliberately not 500. A config typo is not an outage, and an operator watching 5xx should not be paged for one. The 400 body names the offending entry and states that the running configuration is unchanged:

{ "error": "rejected: the on-disk playground config is invalid and was NOT applied; the running configuration is unchanged. playground.pinned_keys[0] (did:web:agents.test:mallory): algorithm 'Ed25519' is not supported (expected one of: ed25519, ecdsa-p256). A publish from this agent that selects this entry is rejected at request time (HTTP 500, internal_error)." }

Validation runs before the write lock is taken, so a rejected reload cannot half-apply: the swap is not reached at all.


Error envelope

Errors use the envelope of RFC-ACDP-0007 §4, emitted as application/acdp+json; its fields and when details is present are specified there. What this registry adds: internal_error responses never leak detail — the message is always "internal error", with the real cause in the server log only. The /admin/* routes and /metrics do not use the envelope; see the note under the table.

Each code's meaning and canonical HTTP status are in the spec's error-code registry, and how an acdp client maps each one back to a typed AcdpError (with retry guidance) is in acdp-rs · Errors & Retries. This page documents only what this registry answers and when.

Status / code table

HTTPWire codeRaised when
400schema_violationMalformed body, missing field, schema mismatch.
400hash_mismatchRecomputed content_hash ≠ declared.
400data_ref_hash_mismatchAn embedded/remote data_ref hash ≠ declared.
400key_resolution_failedDID document fetched but the key isn't usable, or the producer's did:web host was refused by the SSRF policy (a permanent, producer-caused failure).
400immutable_fieldA lifecycle request tried to supply/alter body content (RFC-ACDP-0013 §6 step 2).
400invalid_signatureThe producer signature did not verify against the resolved key.
400unsupported_algorithmSignature algorithm outside supported_signature_algorithms.
400invalid_cursorA cursor= value that does not decode or does not match its query, or a GET /changes since cursor that does not decode or authenticate.
400cursor_expiredA structurally valid cursor whose window has passed; on GET /changes, one before the oldest retained entry, past the head, under a key or cursor_epoch this registry does not hold, issued before a sequence reset, or in the 51-character format of 0.9 and earlier.
400superseded_targetA static supersession violation: any details.reason other than the two 409 ones below (e.g. not_found, lineage_mismatch, cross_registry_supersession_unsupported, lineage_walk_failed, revocation_type_mismatch).
403not_authorizedBad/expired/revoked bearer, challenge failure, an anonymous search when anonymous_public_reads is off, tenant-scope denial in strict mode, an X-Tenant-Id the registry does not trust from the sending peer (auth.tenant_header_trust). Retrieval never answers 403 for visibility: see 404.
403key_not_authorizedThe key resolved fine but is not authorized to sign for that agent.
404not_foundContext/lineage absent or not visible to the caller — including a restricted/private context outside its audience on GET /contexts/{ctx_id} and /body, and any context for an anonymous caller when anonymous_public_reads is off.
409duplicate_publishIdempotency conflict: same Idempotency-Key, different content.
409superseded_targetOnly for the two race reasons: details.reason version_mismatch or already_superseded. Every other reason is 400 (row above).
409invalid_lifecycle_transitionDouble retract, or republish of a never-retracted context (RFC-ACDP-0013 §6 step 4).
413payload_too_largeBody over max_payload_bytes.
413embedded_too_largeEmbedded data over max_embedded_bytes.
415unsupported_media_typeA body-bearing request (POST /contexts, POST /key-attestations, the lifecycle and admin lifecycle routes, /auth/*) whose Content-Type is present but neither application/json nor application/*+json (parameters such as charset are ignored). An absent Content-Type is accepted on those routes except /auth/*, where it is also a 415. How to treat an absent header is registry choice under RFC-ACDP-0007 §4.1; this is ours.
429rate_limitedA rate-limit bucket drained (/auth/*, challenge, publish, lifecycle, POST /key-attestations or a data-plane read; see Rate limits), or the shared /auth/* backend unavailable under backend_unavailable = "deny"; carries Retry-After.
500internal_errorStorage/config/internal failure (detail logged, not returned).
501not_implementedUnimplemented protocol feature (incl. /log/*, /changes, /subscriptions, /key-attestations and lifecycle endpoints when their profiles are not enabled).
502key_resolution_unreachable / cross_registry_resolution_failedDID document or foreign registry unreachable (on publish, and on POST /auth/token since 0.5.1). A foreign registry refused by the SSRF policy is also cross_registry_resolution_failed, and so is one that serves a context document this registry cannot parse (not JSON, an unknown or missing field); a refused DID host is not (it is 400 key_resolution_failed).
502invalid_witness_cosignatureA witness cosignature failed verification (RFC-ACDP-0015 §6.1). Like invalid_log_proof, a 502 because it is normally another party's artifact that failed.
502invalid_log_proofA transparency-log proof/checkpoint failed RFC-ACDP-0012 §9 verification. Normally raised when validating an upstream's proofs (federation), which is why it is a 502. It is also reachable from this registry's own /log/proof: for a retrieval-authorized requester the handler echoes the leaf via record.leaf() (log_proof in crates/acdp-registry-core/src/handlers/log.rs), and a stored leaf that no longer parses under the closed schema surfaces as invalid_log_proof from here, not from a peer (LogEntryRecord::leaf in crates/acdp-registry-store/src/log.rs, with the reject cases pinned by that module's own tests). If you see it and you are not federating, suspect your own log_leaves table. The other /log/* failures are schema_violation, not_found, or not_implemented; there is no log_unavailable.

Note: auth failures on the ACDP routes surface as 403 not_authorized, not 401, and carry no WWW-Authenticate challenge. /admin/* likewise answers 403 (with its own {"error": "admin-only"} body rather than this envelope). GET /metrics is the exception and is not covered by this table: it answers 401 with WWW-Authenticate: Bearer realm="metrics", because it sits outside the ACDP auth pipeline entirely — see AUTHENTICATION.md.