2️⃣ Read the Network
Read the Network
The sequence keeps the API boundary read-only: the watcher pages an indexed projection, then drills into the same execution's sub-resources. A 401, 403, 404, 429, or envelope-free 408/413 is a response to handle at the HTTP boundary, not a mutation of Nexus state.
Keep the API key out of curl arguments
Use a mode-0600 curl configuration file rather than expanding NEXUS_API_KEY into a header argument. Hidden input keeps the terminal from echoing the value; the cleanup trap removes the file and unsets the shell variable, while the key remains visible to same-user process inspection for the lifetime of the shell or child process:
Do not type export NEXUS_API_KEY='...', paste a real key into a command, or commit the configuration file; every request below passes only the configuration path to curl.
Authenticate a request
Every read endpoint accepts the x-api-key header; the configuration file supplies it without putting the secret in curl's argv:
The listing shape
Every list endpoint returns the same envelope — items plus pagination metadata:
Pages default to 20 items and cap at 100. next_token is an opaque cursor: pass it back as page_token for the next page, and stop when it comes back null:
Filter to what you care about
List endpoints filter server-side; combine as many as you like. The executions family understands the run's whole context — its DAG, its invoker, its agent and skill, the task that scheduled it, a status, and an RFC3339 time window:
Filter values are exact: status takes the API's snake_case vocabulary (requested, running, pending_settlement, finished, failed, …). An unknown value is rejected with HTTP 400 and the documented INVALID_FILTER_VALUE error envelope; it is not an empty projection.
Drill into one run
Everything an execution produced hangs off its object id as a sub-resource:
The Run Watcher will use exactly two of these calls: the filtered list for its table, and the per-execution detail when you click a row. The full sub-resource catalog — verdicts, failures, gas, submission failures — is in the API reference.
Read an error on purpose
Ask for a resource your key has no scope for:
Most resource errors follow this contract: a machine-readable error_code (also mirrored in the x-error-code header when the error envelope is emitted) and a human-readable description. The codes worth branching on in a dApp are 401 missing/invalid key, 403 missing scope, 404 unknown object ID, and 429 an empty scope token bucket — back off and retry. The timeout/body-size/malformed-request layer is different: 408, 413, and malformed requests can be envelope-free, so branch on the HTTP status and content-type, capture x-request-id when present, and do not attempt to parse a missing JSON body.
4xx/5xx with JSON
error_code plus description; x-error-code may mirror the code
Branch on the code/status and show the description without treating it as on-chain state.
408 Request Timeout
The timeout layer may return no JSON envelope
Retry only under the service's idempotent read policy and preserve the request ID if present.
413 Payload Too Large
The body may be empty or a deployment-specific plain response
Reduce the request/page or payload before retrying; do not decode it as an API error object.
Malformed request
The parser may reject before the API envelope exists
Fix serialization/headers and branch on status/content type rather than assuming error_code.
Close this step before opening the next
When the API reads are complete, clean this page's configuration and disarm its trap before the stream page installs its own cleanup. If a command fails first, the active EXIT trap still removes the configuration:
Last updated

