Ingest wire format
The HTTP and JSON format the SDKs use to send recorded requests: endpoint, headers, compression, multipart binary bodies, batch envelope, record fields and response codes.
The SDKs send recorded requests to inspector.rest in batches. You do not need this page to use an SDK. It is for people who write their own client, debug traffic or want to know exactly what is stored. The format is defined by a JSON Schema (draft 07) that you can download; the field tables below are generated from it. Current wire version: 1. A breaking change increments v.
Request
| Method and path | POST /api/ingest on https://<org-slug>.api.inspector.rest |
x-inspector-key | The environment’s ingest key (irk_<org-slug>_<secret>) |
content-type | application/json, or multipart/form-data when binary parts are attached |
content-encoding | zstd or gzip (absent when compression is off). Applies to the whole body. Large bodies are compressed as several independent frames or members that are concatenated; a standard decoder reads them as one stream. |
accept | application/json |
The address comes from the key: an environment key irk_acme_… belongs to the organization acme and is sent to https://acme.api.inspector.rest. The records are stored in the environment the key belongs to.
Multipart batches
When binary bodies are captured, the request is multipart/form-data. The first part is named batch (application/json) and holds the envelope below. Every further part holds the raw bytes of one binary body and is named by the part field of its body descriptor (b1, b2, …). Part names are unique within a batch and keep their names when a batch is split or sent again.
Response
{ "accepted": 2, "rejected": [ { "index": 1, "reason": "invalid record" } ] }Every record is validated on its own. accepted is the number of stored records. rejected lists the records that were not stored, by position in records. A batch with an invalid record is still stored for the valid ones.
Status codes
| Status | Meaning | What the SDKs do |
|---|---|---|
| 200 | Batch handled. See accepted and rejected. | Done. Rejected records are counted, not retried. |
401 invalid_key | The ingest key is invalid or revoked. | Disables itself and warns once. |
403 organization_suspended | The organization is suspended. | Pauses like on quota_exceeded. |
413 payload_too_large | The batch is too large. | Splits the batch in halves and sends them again. |
| 415 | The compression is not supported. | Switches from zstd to gzip. |
429 quota_exceeded + Retry-After: 60 | The monthly request limit of the plan is reached. | Stops capturing and sends an empty batch about once a minute. Capturing resumes when the empty batch is accepted. |
503 disk_full + Retry-After | The storage server is almost out of disk space. | Keeps the data in its queue and waits. |
| other 5xx, 408, network errors | Temporary failure. | Keeps the batch and retries with exponential backoff. |
Error responses have the form { "error": { "code", "message", "hint" } }. See Error codes.
Idempotent writes
- A record with the same
request_idreplaces the previous one, except that anin_progressrecord never replaces a complete one. Batches may arrive out of order. - A batch that is sent again after a timeout or a
5xxkeeps itsbatch_id, so the server can discard a duplicate within a short window. - Status, outcome and error phase of a request are derived from its highest numbered attempt.
- Sorting uses
started_at. Retention and paging use the server’s receive time. The clock skew of the client is corrected withsent_at.
Schema
Batch envelope
The JSON body of the request (the batch part in multipart requests).
| Field | Type | Required | Description |
|---|---|---|---|
v | 1 | yesrequired | Wire format version. |
sdk | object | yesrequired | |
sent_at | number | yesrequired | Client wall clock (epoch ms) when this send attempt was assembled. The server compares it with its own receive time to correct clock skew. Re-sent batches carry a fresh value. |
service | string | null | nooptional | Optional service name set in the SDK config. |
instance_id | string | yesrequired | Random id of the SDK instance (one per process/inspector). |
seq | integer (min 1) | yesrequired | Batch sequence number within the instance, starting at 1. |
batch_id | string | yesrequired | <instance_id>:<seq>. A re-sent batch (retry after timeout, 5xx, 503) keeps its batch_id, so the server can discard duplicates inside a short window. |
dropped | object | yesrequired | What the SDK discarded since the previous batch that carried counts. Counts travel with exactly one batch (the same batch_id when re-sent). |
records | array of object | yesrequired | One record per request. Empty for the quota probe. |
SDK info
The sdk field of the envelope.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yesrequired | inspector-rest-sdk-node, inspector-rest-sdk-php. |
version | string | yesrequired | |
runtime | string | null | nooptional | Free-form runtime description, e.g. node/24.1.0. |
Dropped counters
The dropped field of the envelope. The counts travel with exactly one batch (the same one when it is sent again). The app shows them, for example as “N bodies skipped because of load”.
| Field | Type | Required | Description |
|---|---|---|---|
records | integer | yesrequired | Whole records discarded (queue overflow, load budget, permanently rejected batches). |
text_bodies | integer | yesrequired | Text bodies omitted because of the load budget. |
binary_bodies | integer | yesrequired | Binary bodies not uploaded because of the load budget or size limit (not counted when capture_binary is off). |
Record
One request with all of its attempts.
| Field | Type | Required | Description |
|---|---|---|---|
request_id | string | yesrequired | |
started_at | number | yesrequired | Request start, epoch ms on the client clock (sub-millisecond fraction allowed). |
in_progress | boolean | yesrequired | true: sent while the request is still running (after 2 s) or at close; outcome and duration_ms are null. |
method | string | yesrequired | |
url | string | yesrequired | |
labels | object | yesrequired | Fully resolved labels of the request (runtime < config < context < request). Keys and values are non-empty strings. |
outcome | "ok" | "error" | null | yesrequired | |
duration_ms | number | null | yesrequired | Total duration measured with a monotonic clock. |
error | object | null | nooptional | Request-level error (for example domain errors that belong to no attempt, or the final error given at settle time). |
attempts | array of object | yesrequired | Ascending by attempt number. The server derives status, outcome and error phase from the highest numbered attempt. |
Attempt
One try of a request. A request has one attempt unless the HTTP client retried it.
| Field | Type | Required | Description |
|---|---|---|---|
attempt | integer (min 1) | yesrequired | |
offset_ms | number | nooptional | Start of the attempt relative to the record’s started_at. |
method | string | nooptional | Only when different from the record’s method. |
url | string | nooptional | Only when different from the record’s url. |
request | object | null | nooptional | |
response | object | null | nooptional | |
retry | object | null | nooptional | |
error | object | null | nooptional |
Request part
The request field of an attempt.
| Field | Type | Required | Description |
|---|---|---|---|
headers | object | nooptional | Header names are lower-case. Repeated headers (set-cookie) are arrays. |
proxy_url | string | null | nooptional | |
body | object | null | nooptional |
Response part
The response field of an attempt. It is null when no response was received.
| Field | Type | Required | Description |
|---|---|---|---|
status | integer | nooptional | |
headers | object | nooptional | Header names are lower-case. Repeated headers (set-cookie) are arrays. |
duration_ms | number | null | nooptional | Time to response headers. |
read_ms | number | null | nooptional | Time spent reading the body. |
parse_ok | boolean | null | nooptional | false when the engine could not parse the body (raw body is kept). |
body | object | null | nooptional |
Retry
The retry field of an attempt: the decision that was made after this attempt.
| Field | Type | Required | Description |
|---|---|---|---|
policy | any | nooptional | Retry policy name or description. |
stage | string | null | nooptional | |
delay_ms | number | null | nooptional | |
exhausted | boolean | null | nooptional |
Error
Errors appear on records and attempts. Header names are always lower case; repeated headers such as set-cookie are arrays.
| Field | Type | Required | Description |
|---|---|---|---|
phase | string | null | nooptional | network, http, parse, domain, or an engine-specific phase. |
name | string | null | nooptional | Error class name; HTTP status errors are named HttpError. |
message | string | null | nooptional | |
code | string | number | null | nooptional | |
stack | string | null | nooptional | |
request_id | string | null | nooptional | |
status | integer | null | nooptional | HTTP status for HttpError. |
details | any | nooptional | Free-form data returned by the error_details hook. |
cause | object | nooptional | error.cause chain (depth-limited). |
errors | array of object | nooptional | Members of an AggregateError. |
Body descriptor
Describes a request or response body. A body is binary when its content type says so (images, audio, video, archives, application/octet-stream and so on) or, when the type does not decide, when its bytes are not valid UTF-8.
| Field | Type | Required | Description |
|---|---|---|---|
encoding | "utf8" | "part" | "none" | yesrequired | utf8: the body text is inline in text. part: raw bytes travel in the multipart part named part. none: only metadata (see omitted). |
size | integer | null | nooptional | Size of the original body in bytes (before truncation), null when unknown (streams). |
content_type | string | null | nooptional | |
text | string | nooptional | Body text (encoding utf8). Possibly truncated, see truncated. |
truncated | boolean | nooptional | text was cut at max_body_bytes (UTF-8 character boundary). |
binary | boolean | nooptional | Detected as binary (content type or invalid UTF-8). |
part | string | nooptional | Multipart part name (encoding part). |
omitted | "binary" | "load" | "too_large" | "stream" | nooptional | Why no content is carried (encoding none). binary: binary capture is off. load: dropped by the load budget. too_large: above max_binary_bytes. stream: body not readable (stream, FormData). |
Labels and headers
labelsis an object whose keys and values are non-empty strings. It contains the fully resolved labels of the request. See Labels.headersis an object with lower-case header names. A header with several values is an array of strings.
Body encodings
encoding | Meaning |
|---|---|
utf8 | The body text is inline in text. size is the original size in bytes. truncated is true when text was cut at max_body_bytes. |
part | The raw bytes are in the multipart part named by part. binary is true. |
none | Metadata only. omitted says why: binary (binary capture is off), load (dropped by the load budget), too_large (above max_binary_bytes) or stream (the body could not be read, for example a stream or FormData). |
Examples
Minimal batch
One successful request.
{
"v": 1,
"sdk": {
"name": "inspector-rest-sdk-php",
"version": "0.0.1"
},
"sent_at": 1790000000000,
"instance_id": "c1a0e2f4-0000-4000-8000-000000000001",
"seq": 1,
"batch_id": "c1a0e2f4-0000-4000-8000-000000000001:1",
"dropped": {
"records": 0,
"text_bodies": 0,
"binary_bodies": 0
},
"records": [
{
"request_id": "5a1d2a54-7a9e-4b4e-8d0d-0d5c7f6a1001",
"started_at": 1789999999000.125,
"in_progress": false,
"method": "GET",
"url": "https://api.example.com/v1/items?limit=10",
"labels": {},
"outcome": "ok",
"duration_ms": 41.5,
"attempts": [
{
"attempt": 1,
"offset_ms": 0,
"request": {
"headers": {
"accept": "application/json"
},
"proxy_url": null,
"body": null
},
"response": {
"status": 200,
"headers": {
"content-type": "application/json"
},
"duration_ms": 38.2,
"read_ms": 1.1,
"parse_ok": true,
"body": {
"encoding": "utf8",
"size": 11,
"content_type": "application/json",
"text": "{\"ok\":true}"
}
}
}
]
}
]
}Quota probe
When the monthly limit is reached the SDK sends batches without records to find out when recording is possible again.
{
"v": 1,
"sdk": {
"name": "inspector-rest-sdk-node",
"version": "0.0.1",
"runtime": "node/24.1.0"
},
"sent_at": 1790000000000,
"service": null,
"instance_id": "0b7f4c1e-52c1-4a7e-9f4f-1d9f5a0c2c11",
"seq": 3,
"batch_id": "0b7f4c1e-52c1-4a7e-9f4f-1d9f5a0c2c11:3",
"dropped": {
"records": 0,
"text_bodies": 0,
"binary_bodies": 0
},
"records": []
}Full batch
Two records: a failed request with retries, a multipart binary body, an omitted body and an error chain, and a request that was still in progress.
{
"v": 1,
"sdk": {
"name": "inspector-rest-sdk-node",
"version": "0.0.1",
"runtime": "node/24.1.0"
},
"sent_at": 1790000005000,
"service": "billing",
"instance_id": "0b7f4c1e-52c1-4a7e-9f4f-1d9f5a0c2c11",
"seq": 12,
"batch_id": "0b7f4c1e-52c1-4a7e-9f4f-1d9f5a0c2c11:12",
"dropped": {
"records": 4,
"text_bodies": 17,
"binary_bodies": 2
},
"records": [
{
"request_id": "5a1d2a54-7a9e-4b4e-8d0d-0d5c7f6a2001",
"started_at": 1789999990123.456,
"in_progress": false,
"method": "POST",
"url": "https://api.example.com/v1/charges",
"labels": {
"env": "production",
"server_host": "web-1",
"app_package": "billing",
"app_commit": "a1b2c3d4e5f6",
"op": "charge"
},
"outcome": "error",
"duration_ms": 1530.25,
"error": {
"phase": "domain",
"name": "Error",
"message": "card declined",
"code": "card_declined",
"details": {
"decline_code": "insufficient_funds"
}
},
"attempts": [
{
"attempt": 1,
"offset_ms": 0,
"request": {
"headers": {
"authorization": "Bearer abc",
"content-type": "application/json",
"set-cookie": [
"a=1",
"b=2"
]
},
"proxy_url": "http://proxy.local:8080",
"body": {
"encoding": "utf8",
"size": 27,
"content_type": "application/json",
"text": "{\"amount\":1200,\"cur\":\"usd\"}"
}
},
"response": {
"status": 503,
"headers": {
"retry-after": "1"
},
"duration_ms": 210.5,
"read_ms": 0.4,
"parse_ok": true,
"body": {
"encoding": "utf8",
"size": 3,
"text": "oops",
"truncated": true
}
},
"retry": {
"policy": {
"name": "backoff",
"max": 3
},
"stage": "http",
"delay_ms": 1000,
"exhausted": false
},
"error": {
"phase": "http",
"name": "HttpError",
"message": "HTTP 503 Service Unavailable",
"status": 503
}
},
{
"attempt": 2,
"offset_ms": 1210.75,
"url": "https://api.example.com/v1/charges",
"request": {
"headers": {},
"proxy_url": null,
"body": {
"encoding": "part",
"size": 2048,
"content_type": "image/png",
"binary": true,
"part": "b1"
}
},
"response": {
"status": 200,
"headers": {
"content-type": "image/png"
},
"duration_ms": 300,
"read_ms": 12,
"parse_ok": null,
"body": {
"encoding": "none",
"size": 5000000,
"content_type": "image/png",
"binary": true,
"omitted": "too_large"
}
},
"error": {
"phase": "network",
"name": "AggregateError",
"message": "all failed",
"stack": "AggregateError: all failed\n at x (/app/x.js:1:1)",
"errors": [
{
"name": "Error",
"message": "a",
"cause": {
"name": "Error",
"message": "root cause",
"code": "ECONNRESET"
}
}
]
}
}
]
},
{
"request_id": "5a1d2a54-7a9e-4b4e-8d0d-0d5c7f6a2002",
"started_at": 1789999991000,
"in_progress": true,
"method": "GET",
"url": "https://api.example.com/v1/slow",
"labels": {
"env": "production"
},
"outcome": null,
"duration_ms": null,
"attempts": [
{
"attempt": 1,
"offset_ms": 0,
"request": {
"headers": {
"accept": "*/*"
}
}
}
]
}
]
}