imsys

REST API

Submit gateway reads with your own reference, retry safely, and watch the desk from an orchestrator.

The GWA desk's REST API is the one its browser page uses. Another platform submits a read with its own reference, a dispatcher dispatches it, and the outcome arrives as a signed event that carries the same reference. Errors are RFC 9457 problem details, and values are exact decimals.

OpenAPI 3.1 document · served by the desk at /api/v1/openapi.json

The browser desk is generated against the same document, so it cannot drift from it. Run gwad ui ADDR without --desk to serve only the API.

Operations

OperationMethod and pathAgent tool
List readsGET /api/v1/readslist_reads (read)
Submit a readPOST /api/v1/readsnone
Show a readGET /api/v1/reads/{id}get_read (read)
Dispatch a readPOST /api/v1/reads/{id}/dispatchesnone
Show a dispatch receiptGET /api/v1/reads/{id}/dispatches/{number}get_dispatch (read)
Supersede a readPOST /api/v1/reads/{id}/supersedenone
List gatewaysGET /api/v1/gatewayslist_gateways (read)
Show a gatewayGET /api/v1/gateways/{recipient}get_gateway (read)
Show the signed-in employeeGET /api/v1/sessionnone

Each read operation declares its tool name and the level read in x-mcp. An agent platform that derives tools from the document exposes those five operations and nothing else. Submitting, dispatching and superseding wake a gateway in someone's home, so they stay with people. The desk runs no model.

Submit a read

Send your reference as client_reference in the body and again in Idempotency-Key. The header is a quoted string, as in the IETF draft; the bare value works too.

curl -sS http://127.0.0.1:8080/api/v1/reads \
  -H "Authorization: Bearer $GWAD_CREDENTIAL" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: "order-2026-11-30-0173"' \
  -d '{"client_reference":"order-2026-11-30-0173","recipient":"0e5453540000000001","revision":1,"window_start":0}'

The answer is 201 Created with the read and its Location. A reference is 1 to 128 printable ASCII characters without a space at either end, and the desk compares it byte for byte. It belongs to the employee who sent it, so two employees can use the same reference.

You sendThe desk answers
The same request again201 with the same read: a lost response is safe to repeat
The same reference for another gateway, revision or window422: choose a new reference
No reference, or no Idempotency-Key400
An Idempotency-Key that differs from client_reference400
A repeat while the first request still holds the reference409 with Retry-After: repeat it unchanged

The desk remembers a reference for as long as the read exists, and it never deletes reads. A reference is therefore never executed twice, however late it comes back.

The response is only an acknowledgement. Dispatch the read with POST /api/v1/reads/{id}/dispatches and {"after": 0}, then follow the Location of the 202 receipt, or wait for de.imsys.gateway.read.completed or …failed with your client_reference in data and subject.

Problem details

Every error is application/problem+json: the desk's own refusals, the desk shell's (signed out, busy, timed out), and the framework's (an unparsable id or query, malformed JSON, a body over 4 KiB, an unknown path or method):

{"type": "about:blank", "title": "Unprocessable Entity", "status": 422,
 "detail": "this client reference already names a read of another gateway, revision or window"}

detail is written for the person at the desk. Decide by status, and honour Retry-After on 409, 429 and 503.

Credentials

On a local desk, gwad grant prints a bearer credential that is valid for eight hours. A workforce desk accepts its OpenID Connect session, and writes also need the X-CSRF-Token from GET /api/v1/session. See workforce sign-in.

Probes and metrics

Start the desk with an operations listener for Kubernetes and Prometheus:

gwad ui 127.0.0.1:8080 --ops-listen 0.0.0.0:9464
PathAnswers
/livez200 while the process runs
/readyz200 while PostgreSQL answers within two seconds, 503 otherwise
/metricsOpenMetrics text
MetricMeaning
gwad_build_info{version}The running version
gwad_http_requests_total{route,status}API requests by route template
gwad_http_request_duration_seconds{route}API latency
gwad_dispatch_enabled1 when the desk owns its callback listeners
gwad_database_up1 when the last scrape reached PostgreSQL
gwad_dispatch_receipts_openReceipts queued, running or waiting to retry (the desk admits 1,000)
gwad_events_undelivered{subscriber}Events a configured subscriber has not acknowledged

Labels carry route templates and configured subscriber names only, never a gateway, metering point, employee or reading. The listener answers nothing else, so it may bind a non-loopback address while the desk stays on loopback.