CropPath for developers

API reference

ops

5 operations

GET /healthz

Liveness and operational status

No authentication · getHealth

Unauthenticated. Reports the outbound backlog per target, the watched certificates and, when the MQTT bridge runs, its connection state. In the read-only maintenance mode of the PostgreSQL cutover (#123) it also reports read_only; every other method of every route, and every audited read (the exports), then answers 503 with Retry-After.

Responses

StatusTypeDescription
200Health
application/json

The service is up.

400Error
application/json

The X-Request-Id header is present and malformed.

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Response headers

NameStatusTypeDescription
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Example responses

Response 200 · application/json
{
  "ok": true,
  "outbound_backlog": {
    "national": 0
  },
  "certificates": []
}
Response 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Response 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Response 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/seq-gaps

Open sequence gaps of the tenant's devices

Authentication: cookie, bearer, oauth2 · OAuth2 scopes: device_read · listSeqGaps

B9 (#21): the ranges of sequence numbers the tenant's devices have not sent yet, ascending by device and first missing number, one page (limit, default 50, at most 200; cursor from the previous page). A gap leaves the list when its messages arrive. Allowed for tenant_admin, auditor and platform_admin acting for the tenant, and an operator within its facilities (a device's facility, or its site when it has none). Not audited (a read). Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.

Parameters

NameInTypeDescription
device_id
optional
querystring

Only the gaps of this device.

limit
optional
queryinteger

Page size: 1 to 200 gaps (default 50).

cursor
optional
querystring

The previous page's next_cursor.

Responses

StatusTypeDescription
200SeqGapPage
application/json

One page of open gaps.

400Error
application/json

A bad device_id, limit or cursor, or a bad X-Request-Id.

401Error
application/json

No valid session, API token or legacy token.

403Error
application/json

The caller is known but refused: role not permitted (only tenant_admin, auditor, platform_admin and an operator through a signed-in session or an operator API client) or tenant not allowed (X-Tenant).

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Response headers

NameStatusTypeDescription
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id401string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Example responses

Response 200 · application/json
{
  "items": [
    {
      "device_id": "scale-1",
      "start_seq": 4,
      "end_seq": 6,
      "missing": 3,
      "opened_at": 1790000000.5,
      "alerted": true
    }
  ],
  "next_cursor": null
}
Response 400 · application/json · device_id
{
  "error": "bad device_id",
  "code": "bad_device_id"
}
Response 400 · application/json · limit
{
  "error": "bad limit",
  "code": "bad_limit"
}
Response 400 · application/json · cursor
{
  "error": "bad cursor",
  "code": "bad_cursor"
}
Response 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Response 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
Response 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
Response 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
Response 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Response 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/outbound

Outbound delivery backlog of the tenant

Authentication: cookie, bearer, oauth2 · OAuth2 scopes: tenant_read · getOutboundBacklog

B9 (#21): the tenant's events not yet delivered to each outbound target (national system, a buyer's EPCIS repository, an archive), with a tenant-neutral summary of the error of the event that failed most often (the full text for platform_admin only). Every configured target is listed, with zeros when nothing waits. Allowed for tenant_admin, auditor and platform_admin acting for the tenant. Not audited (a read). Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.

Responses

StatusTypeDescription
200OutboundBacklog
application/json

The backlog per target.

400Error
application/json

The X-Request-Id header is present and malformed.

401Error
application/json

No valid session, API token or legacy token.

403Error
application/json

The caller is known but refused: role not permitted (only tenant_admin, auditor and platform_admin) or tenant not allowed (X-Tenant).

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Response headers

NameStatusTypeDescription
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id401string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Example responses

Response 200 · application/json
{
  "targets": [
    {
      "target": "epcis",
      "pending": 12,
      "held": 1,
      "failing": 12,
      "next_attempt_at": 1790000960.5,
      "max_attempts": 5,
      "last_error": "HTTP 503"
    },
    {
      "target": "file",
      "pending": 0,
      "held": 0,
      "failing": 0,
      "next_attempt_at": null,
      "max_attempts": 0,
      "last_error": null
    }
  ]
}
Response 400 · application/json
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Response 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
Response 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
Response 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
Response 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Response 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

GET /v1/rejections

Refused device messages

Authentication: cookie, bearer · listRejections

B9 (#21): the device messages the server refused, newest first, one page (limit, default 50, at most 200; cursor from the previous page), never their payload (its size only). The record has no tenant (a refused message cannot be trusted to come from the tenant its route names), so the list is for platform_admin only, every tenant's; any other role is refused 403. Not audited (a read). Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.

Parameters

NameInTypeDescription
reason
optional
querystring

Only messages refused for this reason.

tenant
optional
querystring

Only messages whose route names this tenant (its first segment).

limit
optional
queryinteger

Page size: 1 to 200 messages (default 50).

cursor
optional
querystring

The previous page's next_cursor.

Responses

StatusTypeDescription
200RejectionPage
application/json

One page of refused messages.

400Error
application/json

A bad reason, tenant, limit or cursor, or a bad X-Request-Id.

401Error
application/json

No valid session, API token or legacy token.

403Error
application/json

The caller is known but refused: role not permitted (only platform_admin) or tenant not allowed (X-Tenant).

405Error
application/json

The path exists but not for this method. Allow lists the methods it accepts.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Response headers

NameStatusTypeDescription
X-Request-Id200string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id401string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id403string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

X-Request-Id405string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Allow405string

Comma-separated methods the path accepts.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Example responses

Response 200 · application/json
{
  "items": [
    {
      "id": 41,
      "route": "coop-dl/ph1/scale-1/event/ObjectEvent",
      "envelope_id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
      "reason": "bad_signature",
      "received_at": 1790000000.5,
      "payload_bytes": 812
    }
  ],
  "next_cursor": null
}
Response 400 · application/json · reason
{
  "error": "bad reason",
  "code": "bad_reason"
}
Response 400 · application/json · tenant
{
  "error": "bad tenant",
  "code": "bad_tenant"
}
Response 400 · application/json · limit
{
  "error": "bad limit",
  "code": "bad_limit"
}
Response 400 · application/json · cursor
{
  "error": "bad cursor",
  "code": "bad_cursor"
}
Response 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Response 401 · application/json
{
  "error": "missing or invalid token",
  "code": "missing_or_invalid_token"
}
Response 403 · application/json · role
{
  "error": "role not permitted",
  "code": "role_not_permitted"
}
Response 403 · application/json · tenant
{
  "error": "tenant not allowed",
  "code": "tenant_not_allowed"
}
Response 405 · application/json
{
  "error": "method not allowed",
  "code": "method_not_allowed"
}
Response 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}

POST /v1/telemetry/ui

Report a page's web vitals and uncaught errors (browser beacon)

No authentication · postUiTelemetry

Anonymous (#81): the beacon a sampled page of the web app sends once when it is hidden or left (navigator.sendBeacon). A request carrying a session, token or cookie is treated like an anonymous one. In order: the /v1/public/* bucket and the telemetry bucket (bursts of 10, then 2 beacons a minute per client), keyed like the public routes; a Content-Length of 1 to 7 plain digits (400 invalid_beacon when it is missing or anything else, a chunked body included, before the body is read); a body of at most 1024 bytes (413 otherwise, before it is read); the body (UiTelemetryBeacon, strictly: an unknown field, a page kind outside the list, a measure that is not a number in range, more than 5 errors or nothing to report is 400 invalid_beacon). The beacon only adds to this process's counters and histograms, rendered by getMetrics; nothing is stored, logged or echoed, and its request log line names no peer address. It carries no personal data: a page kind, never the URL or an id; an error's kind and constructor name (names outside the standard ones count as other), never its message or stack. Not audited (AUDIT_EXEMPT: it changes no record, and an anonymous route must not append to the audit log). Every answer is no-store. Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.

Request body

UiTelemetryBeacon (required)

Media type: application/json

Example request · application/json
{
  "page": "fruit",
  "lcp_ms": 1834.2,
  "cls": 0.02,
  "inp_ms": 96,
  "errors": [
    {
      "kind": "error",
      "name": "TypeError"
    }
  ]
}

Responses

StatusTypeDescription
204

The beacon was counted.

400Error
application/json

A Content-Length that is missing or is not 1 to 7 plain digits (a chunked body included; invalid_beacon, the connection is closed, the body is never read), invalid JSON, a body that does not fit UiTelemetryBeacon, or a bad X-Request-Id.

413Error
application/json

The body is over 1024 bytes; the connection is closed.

429Error
application/json

The client's public or telemetry bucket is empty: retry after Retry-After seconds.

500Error
application/json

Unexpected failure; the detail is only in the server log.

Response headers

NameStatusTypeDescription
X-Request-Id204string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control204string

no-store.

X-Request-Id400string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control400string

no-store.

X-Request-Id413string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control413string

no-store.

X-Request-Id429string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Cache-Control429string

no-store.

Retry-After429integer

Seconds until a token is back.

X-Request-Id500string

Request id: the caller's X-Request-Id when it is 1 to 64 of A-Z a-z 0-9 . _ -, otherwise a generated one.

Example responses

Response 400 · application/json · invalid_json
{
  "error": "invalid JSON",
  "code": "invalid_json"
}
Response 400 · application/json · invalid_beacon
{
  "error": "invalid beacon: unknown page",
  "code": "invalid_beacon"
}
Response 400 · application/json · bad_content_length
{
  "error": "invalid beacon: bad content length",
  "code": "invalid_beacon"
}
Response 400 · application/json · bad_request_id
{
  "error": "bad request id",
  "code": "bad_request_id"
}
Response 413 · application/json
{
  "error": "body too large",
  "code": "body_too_large"
}
Response 429 · application/json
{
  "error": "too many requests",
  "code": "too_many_requests"
}
Response 500 · application/json
{
  "error": "internal error",
  "code": "internal_error"
}