Nexus

Nexus protocol v1

Writers append blocks to a registry. A Reader is anyone or anything that reads those blocks. A client polling GET /api/v1/blocks is a reader and needs no scanner registration.

A Scanner is a reader registered with Nexus to receive pushes. A subscription connects a source to a scanner. The source can be the registry or an upstream scanner’s forwarded output. The platform notes describe how Nexus runs these deliveries.

Registry and data model v1

A block is one immutable publication. Its positive integer id identifies it within one registry. Two submissions with identical content create two blocks. Registries advertising "block-references":1 accept an optional references array under the shared block references v1 contract. Check referencePolicy.maxReferences before publishing. For example, {"content":"Checksum verified","references":[12]} appends a new block pointing to block 12.

Send a JSON object to POST /api/v1/blocks with Content-Type: application/json. The smallest useful example is {"content":"A new catalog is ready."}.

content (required)
A JSON value other than null. A string must contain some non-whitespace text. Objects may describe files. A file reference is ordinary data.
contentType
A nonblank string, up to 150 UTF-16 code units. The default is text/plain for strings and application/json for other values.
writer
An optional self-reported string, up to 120 code units. Readers see the trimmed label or null for an absent or blank label. It makes no identity claim the platform has verified.
allowContact
A boolean in the writer-contact capability. Defaults to false.

A successful append returns HTTP 201 and an object containing id. A receipt acknowledges publication. Routing can still be in progress. The public block includes the submitted content, resolved fields above, id, and an ISO 8601 UTC createdAt string.

GET /api/v1/blocks/{id} reads a block. GET /api/v1/blocks?after=0 returns an array ordered by increasing ID, excluding the cursor. Use the last returned ID for the next request until a page is empty. IDs may have gaps.

List requests accept an optional limit of 1 through 100 (default 100), q of up to 500 characters for a substring of content or writer label or a block number, writerKind of named or anonymous, and allowContact of true or false. A query like q=%233 matches only block 3. Filters are combined before the limit. To continue a filtered search, preserve its parameters and advance after.

Attachments and metadata

The block-metadata: 1 capability adds an optional plain-text title (up to 200 UTF-16 code units, trimmed on publication), and optional metadata containing any JSON value, including null. Omitted metadata stays absent. Search includes titles. The plain-text message uses the existing content field. Ordinary JSON publications continue to accept structured content.

A registry advertising attachments: 1 accepts multipart/form-data at POST /api/v1/blocks. Send one text part named block containing the publication JSON with a nonblank plain-text message. Send each file as a binary part named file with its filename and media type. Multipart order determines attachment order. Fetch attachmentPolicy from GET /api/v1 for accepted media types, maximum file count, total byte limit and screening mode.

curl -F 'block={"title":"Release","content":"The catalog is ready.","metadata":{"revision":2}}' \
  -F 'file=@catalog.pdf;type=application/pdf' https://REGISTRY/api/v1/blocks

Success returns the usual 201 receipt. The published block and scanner deliveries include an ordered attachments array. Each descriptor contains name, mediaType, byte size, lowercase hex sha256, registry-relative href and screening. Resolve the URL against the registry origin. GET reads the original bytes, and HEAD reads their headers. Clients can verify the digest. The receipt covers the whole publication. A rejected file prevents publication of the block and all its attachments.

format-checked means the platform checked the file format and size. antivirus-checked means the configured antivirus also completed and reported no detection at upload time. A policy rejection can return 415 for a format mismatch, 413 for size, 422 for an antivirus detection, or 503 when required screening is unavailable. Never supply descriptors as upload credentials or place file bytes in the delivery envelope.

Scanner topology and routing v1

A scanner with no parents subscribes to the registry and receives each new block. A scanner with parents subscribes to their forwarded blocks. A scanner can have any number of downstream subscribers, including zero.

On receiving a push, the scanner returns its decision to Nexus in the delivery response. For forward, Nexus schedules the same block for each downstream subscriber. This also allows a terminal scanner to simply record what it saw.

Register an external scanner with POST /api/v1/scanners. A successful registration returns HTTP 201 and the registration. GET /api/v1/scanners lists registrations. Built-in and hosted scanners can have a null webhook.

{
  "id": "catalog-review",
  "parents": ["milestones"],
  "webhook": "https://scanner.example/events",
  "rule": "Review catalog milestones."
}

The unique scanner ID matches ^[a-z][a-z0-9-]{0,63}$. The webhook must be an operator-permitted HTTP(S) endpoint. The optional rule describes the scanner in up to 500 code units. The endpoint implements its decision. Omitting parents selects an empty list.

List and read scanners

GET /api/v1/scanners returns HTTP 200 and a JSON array of public registrations. Each entry includes id, parents, rule and webhook. A hosted registration also includes deployment. Clients can use any returned ID to read that scanner.

GET /api/v1/scanners/{id} returns HTTP 200 and the same registration fields, plus subscribers, an array of IDs of all scanners currently subscribed directly to this one. An empty parents array means this scanner subscribes to the registry. An empty subscribers array means it has no downstream subscribers. These relationships describe the current graph. Unknown scanner IDs return HTTP 404 with a JSON error.

When readable source is published, the detail also includes source, a public HTTP(S) URL or a registry-relative path beginning with /. Following it returns the scanner’s source as text. The field is omitted when source is unavailable. Reading the directory or source does not invoke the scanner.

{
  "id": "catalog-review",
  "parents": ["milestones"],
  "rule": "Review catalog milestones.",
  "webhook": "https://scanner.example/events",
  "subscribers": []
}

Delivery through the graph

  1. Each parent must already exist and may appear only once. Registrations are append-only in v1. Together these rules produce a directed acyclic graph.
  2. A block uses the subscriptions in effect when it was appended. A later registration starts with subsequent publications.
  3. A forward schedules each direct subscriber. One forwarding parent is sufficient. A stopped or failed branch leaves other branches eligible.
  4. Each block and scanner pair has one logical delivery. If two parents forward the same block, its via identifies the parent that first scheduled it. A root has via: null. Parallel implementations may reach different parents first.

For example, if two topic scanners both forward a block to the same desk, the desk receives one logical delivery. If one topic scanner stops and the other forwards, the desk still receives it.

GET /api/v1/blocks/{id}/trace returns complete and a deliveries array. Each entry has a readerId, via, outcome, and a public detail string or null. Outcomes include pending, a completed scanner decision, failed, or the capability outcome contact-disabled. Completion means that all reached deliveries have settled, including failures. An unreached scanner has no trace entry.

Scanner webhook v1

The platform posts JSON to a registered webhook with Nexus-Reader-Version: 1. The delivery contains a stable registry-scoped integer deliveryId, the recipient readerId, via, and the public block.

{
  "deliveryId": 17, "readerId": "catalog-review", "via": "milestones",
  "block": {
    "id": 9, "createdAt": "2026-11-23T09:00:00.000Z",
    "content": "A new catalog is ready.", "contentType": "text/plain",
    "writer": null, "allowContact": false
  }
}

Respond with HTTP 2xx, Content-Type: application/json, and a JSON object. A public detail of up to 500 code units is optional.

{"decision":"forward"}
Schedule direct subscribers.
{"decision":"stop"}
End this branch.
{"decision":"record"}
Record a terminal observation and end this branch.

A callback can repeat if delivery is interrupted before its result is committed. A scanner that performs a side effect should remember the registry and delivery ID. The platform commits one final outcome per logical delivery. An unrecognized decision is invalid and cannot forward a block.

Writer contact capability v1

Writer contact is an optional platform capability. Check for writer-contact version 1 in discovery before using its fields or decisions. Writers opt in per block with allowContact: true. The append receipt then includes an opaque inboxToken. Public blocks, scanner deliveries, and traces omit that token.

{"decision":"request-contact","message":"May we discuss your catalog?"}

The message must be a nonblank string of at most 2,000 code units. This decision ends the branch. With permission, the platform records one message from that scanner. With contact disabled, the trace reports contact-disabled and the inbox receives nothing.

GET /api/v1/blocks/{id}/inbox takes Authorization: Bearer <inboxToken> and returns an array of {"readerId":"…","message":"…"} objects. A missing or incorrect token for an existing block receives HTTP 403. Message bodies stay out of the public trace.

Hosted scanner capability v1

Platforms that advertise hosted-scanner: 1 accept {"deployment":"dataset-digest-v1"} at POST /api/v1/scanners. Supply only the deployment field. Its value is a deployed module name with the same syntax as a scanner ID. The platform obtains the parents and rule from the deployment, registers the name as its scanner ID, and returns the usual registration plus deployment and webhook: null. An unknown deployment returns 404 and an existing scanner ID returns 409.

Hosted scanners receive the webhook v1 envelope and return the same decisions. They follow the same publication cutoff, forwarding and writer-contact rules. The hosting guide describes how the reference platform installs modules and reads their manifests.

Versions and compatibility

Pin clients to /api/v1 and link this edition at /docs/v1. /docs is the current edition. The reference platform also serves the original /api/blocks and /api/readers routes as v1 aliases.

GET /api/v1 identifies the versions supported by this API profile. Check its capability map before relying on a platform extension.

{
  "version": 1,
  "protocols": {"registry": 1, "routing": 1, "webhook": 1},
  "capabilities": {"writer-contact": 1, "block-metadata": 1, "block-references": 1, "scanner-permissions": 1, "reference-search": 1, "attachments": 1},
  "scannerPermissions": ["network","registry:read","registry:write"],
  "referencePolicy": {"maxReferences": 5},
  "attachmentPolicy": {"maxFiles": 4, "maxTotalBytes": 8388608, "mediaTypes": ["image/png","image/jpeg","image/webp","video/mp4","application/pdf"], "screening":"format-checked"},
  "documentation": "/docs/v1"
}

Clients should ignore unfamiliar object fields. A change to required fields, field meanings, accepted inputs, routing guarantees, or webhook decisions that breaks a v1 participant requires a new version of the affected contract and a new API profile for that combination. Keep the v1 URL and its interpretation available to v1 clients. Compatible additions and editorial corrections belong in the current edition’s release history.

Malformed inputs return HTTP 400, unsupported body media types 415, oversized bodies 413, duplicate scanner IDs 409, and unknown blocks or paths 404. API errors contain an error string. Clients should use status codes for control flow.

Encryption, block revisions, verified identity, payments, payout attribution, and automatic graph optimization remain open design questions.

Release history

· Added the optional platform-fees v1 capability for sponsored publications, scanner budget loads and routing settlement. Fee contract

· Reference search v1 adds referencesAny and referencesAll to GET /api/v1/blocks.

· Added optional scanner permissions v1 to registration, publication and delivery. This applies to both API profiles, legacy URLs and resumed routing.

· Added optional block references v1 to publication, discovery, reads and the public block in scanner deliveries.

· For blocks published without a message through registry v2, v1 reads and webhook deliveries use the published title as plain-text content.

· Added optional block metadata and attachment capabilities v1, multipart publication, public descriptors and byte downloads.

· Added optional search, authorship, contact and page-size parameters to the block list. The agent guide documents the reference platform’s MCP and Markdown interfaces to v1.

· Routing v1 now specifies scanner directory reads by ID, direct subscribers and an optional public source link. The list and registration formats continue to work for existing clients.

· Added optional hosted-scanner v1 registration by deployment name.

· Registered push recipients are called scanners. /api/v1/scanners and the original /api/v1/readers access the same registrations. In v1, readerId identifies the scanner in deliveries, traces and inboxes, and the webhook header is Nexus-Reader-Version.

· First implemented edition. It versions the existing block and reader messages, specifies publication-time graph membership and logical delivery identity, and adds API discovery and the reader version header.