.. meta::
   :description: Reference for the Neuron Observer daemon HTTP API: how to reach it, each endpoint's request and response fields, error responses, the event stream, and examples.
   :keywords: Neuron Observer, API, reference, HTTP, REST, JSON, NDJSON, event stream, health check, devices, snapshot, query, Trainium
   :date-modified: 11/30/2026
   :content-type-template: _content-types/reference-general.rst

.. _neuron-observer-api-reference:

===============================
Reference: Neuron Observer API
===============================

Use this page to look up the HTTP endpoints that the Neuron Observer daemon serves on each Trainium node, including their request parameters, response fields, and error responses, and how the event stream works. The ``nobs`` command-line tool (see :ref:`neuron-observer-get-started`) is a client of this API; the table in :ref:`neuron-observer-api-cli-mapping` lists the endpoint that each command calls.

.. note::

   Neuron Observer is in public beta. The API can change before general availability; see :ref:`neuron-observer-api-versioning`.

Overview
--------

The daemon that runs on each node serves one HTTP API. The API never writes metrics. Only one kind of request changes daemon state: starting a hardware health check.

The API has three kinds of endpoints:

- **Probes and metrics**: :ref:`/healthz <neuron-observer-api-get-healthz>`, :ref:`/readyz <neuron-observer-api-get-readyz>`, :ref:`/version <neuron-observer-api-get-version>`, and the Prometheus :ref:`/metrics <neuron-observer-api-get-metrics>` exposition. These are always reachable.
- **Node data**: :ref:`/api/v1/node/status <neuron-observer-api-get-node-status>`, :ref:`/api/v1/devices <neuron-observer-api-get-devices>`, :ref:`/api/v1/node/snapshot <neuron-observer-api-get-node-snapshot>`, :ref:`/api/v1/node/models <neuron-observer-api-get-node-models>`, :ref:`/api/v1/tags <neuron-observer-api-get-tags>`, :ref:`/api/v1/node/config <neuron-observer-api-get-node-config>`, :ref:`/api/v1/query <neuron-observer-api-post-query>`, and the :ref:`/api/v1/node/healthcheck <neuron-observer-api-post-node-healthcheck>` health check. These depend on the daemon's latest collected snapshot and are readiness-gated (see :ref:`neuron-observer-api-readiness`).
- **Streams**: the :ref:`/api/v1/events <neuron-observer-api-get-events>` event stream. It is always reachable.

.. _neuron-observer-api-access:

Access
------

Where the API is served
^^^^^^^^^^^^^^^^^^^^^^^

The daemon listens on ``observer.daemon.config.daemon.listen_address`` and ``observer.daemon.config.daemon.port``. The Helm chart sets the listen address to ``0.0.0.0`` and the port to ``7001``, and runs the daemon with ``hostNetwork: true``. The API is therefore reachable at ``http://<node-ip>:7001`` from any host that can route to the node, including other pods and the cluster scheduler or control plane. For the configuration values, see :ref:`neuron-observer-configuration-reference`.

A daemon started outside the Helm chart without configuration listens only on ``127.0.0.1:7001``.

To try the API from your workstation, forward the daemon pod's port:

.. code-block:: bash

   kubectl port-forward -n neuron-observer <daemon-pod> 7001:7001

Then, in a second terminal, run:

.. code-block:: bash

   curl -s http://localhost:7001/api/v1/node/status

Authentication
^^^^^^^^^^^^^^

The API does not authenticate or authorize requests. Restrict access to the daemon port with your cluster's network controls (for example, security groups and Kubernetes network policies).

.. _neuron-observer-api-readiness:

Readiness
^^^^^^^^^

Node data endpoints return the latest snapshot. Until the daemon completes its first collection cycle, those endpoints return ``503 Service Unavailable`` with the plain-text body ``service not ready: waiting for first metric collection``. Poll ``/readyz`` before calling them; ``/api/v1/node/status`` follows the same rule, so before the first collection it returns ``503`` instead of ``"ready": false``. Probes, ``/metrics``, and the event stream respond at any time.

Conventions
-----------

- Request and response bodies are JSON (``Content-Type: application/json``). Two endpoints are exceptions: ``/metrics`` returns Prometheus text exposition, and ``/api/v1/events`` returns ``application/x-ndjson``.
- Fields documented as *omitted when absent* are left out of the JSON object rather than set to ``null``.
- Timestamps use one of two formats, stated per field: an RFC 3339 UTC string (for example ``2026-07-21T10:00:00.000Z``) or an integer count of milliseconds since the Unix epoch.
- Device indexes (``device_id``) match the ``/dev/neuronN`` device index on the node.
- Identifiers: event IDs and health-check run IDs are ULIDs (26-character Crockford base32 strings that sort by creation time).

Endpoint summary
----------------

The **Gated** column marks endpoints that return ``503`` until the daemon completes its first collection cycle (see :ref:`neuron-observer-api-readiness`).

.. list-table::
   :header-rows: 1
   :widths: 8 34 12 46

   * - Method
     - Path
     - Gated
     - Purpose
   * - GET
     - :ref:`/healthz <neuron-observer-api-get-healthz>`
     - No
     - Liveness probe. Always ``200``.
   * - GET
     - :ref:`/readyz <neuron-observer-api-get-readyz>`
     - No
     - Readiness probe. ``200`` after the first collection cycle, ``503`` before.
   * - GET
     - :ref:`/version <neuron-observer-api-get-version>`
     - No
     - Daemon version.
   * - GET
     - :ref:`/metrics <neuron-observer-api-get-metrics>`
     - No
     - Prometheus text exposition of the latest snapshot.
   * - GET
     - :ref:`/api/v1/node/status <neuron-observer-api-get-node-status>`
     - Yes
     - Daemon version and build, liveness, readiness, and driver versions.
   * - GET
     - :ref:`/api/v1/devices <neuron-observer-api-get-devices>`
     - Yes
     - Discovered Neuron devices with topology, health signals, and diagnosis.
   * - GET
     - :ref:`/api/v1/node/snapshot <neuron-observer-api-get-node-snapshot>`
     - Yes
     - The latest snapshot, with all raw metrics.
   * - GET
     - :ref:`/api/v1/node/models <neuron-observer-api-get-node-models>`
     - Yes
     - Loaded models per device and process, with memory breakdowns.
   * - GET
     - :ref:`/api/v1/tags <neuron-observer-api-get-tags>`
     - Yes
     - Processes and loaded models grouped by runtime tag.
   * - GET
     - :ref:`/api/v1/node/config <neuron-observer-api-get-node-config>`
     - Yes
     - The daemon's effective configuration.
   * - POST
     - :ref:`/api/v1/query <neuron-observer-api-post-query>`
     - Yes
     - Aggregate one or more metrics over the node, a device, or a core.
   * - POST
     - :ref:`/api/v1/node/healthcheck <neuron-observer-api-post-node-healthcheck>`
     - Yes
     - Start a hardware health check.
   * - GET
     - :ref:`/api/v1/node/healthcheck <neuron-observer-api-get-node-healthcheck>`
     - Yes
     - State and result of the latest health check.
   * - GET
     - :ref:`/api/v1/events <neuron-observer-api-get-events>`
     - No
     - Long-lived NDJSON stream of device health-state events and heartbeats.

Probes and metrics
------------------

.. _neuron-observer-api-get-healthz:

GET /healthz
^^^^^^^^^^^^

Liveness probe. Returns ``200 OK`` with an empty body while the daemon process is serving.

.. _neuron-observer-api-get-readyz:

GET /readyz
^^^^^^^^^^^

Readiness probe. Returns ``200 OK`` after the daemon completes its first collection cycle and ``503 Service Unavailable`` before. The body is empty.

.. _neuron-observer-api-get-version:

GET /version
^^^^^^^^^^^^

Returns the daemon version.

.. code-block:: json

   {"version": "0.3.0"}

.. _neuron-observer-api-get-metrics:

GET /metrics
^^^^^^^^^^^^

Returns the latest snapshot in Prometheus text exposition format. Before the first collection cycle, the body is empty but the status is ``200``, so a scrape of a starting daemon does not fail. For the metric names and meanings, see :ref:`neuron-observer-metrics-fault-reference`.

Node data
---------

.. _neuron-observer-api-get-node-status:

GET /api/v1/node/status
^^^^^^^^^^^^^^^^^^^^^^^

Returns the daemon's version and build, its liveness and readiness, and the kernel driver versions it has read.

.. code-block:: json

   {
     "version": "0.3.0",
     "git_hash": "4921fb8",
     "live": true,
     "ready": true,
     "driver_version": "2.26.4.0",
     "efa_driver_version": "2.17.1g",
     "driver": {"loaded": true, "version": "2.26.4.0"}
   }

.. list-table::
   :header-rows: 1
   :widths: 24 12 64

   * - Field
     - Type
     - Description
   * - ``version``
     - string
     - Daemon version.
   * - ``git_hash``
     - string
     - Short commit the daemon was built from, with a ``-dirty`` suffix if the build tree had uncommitted changes. Omitted when the daemon was built outside a Git checkout.
   * - ``live``
     - boolean
     - Always ``true`` in a response: a daemon that answers is serving.
   * - ``ready``
     - boolean
     - ``true`` after the Observer daemon completes its first collection cycle. Matches ``/readyz``. Reports the daemon's readiness, not the node's: it is independent of driver state, so it does not change while a node's driver is being upgraded.
   * - ``driver_version``
     - string
     - Neuron kernel driver version from sysfs. Omitted when the daemon has not read one (no devices present, or a driver too old to expose it).
   * - ``efa_driver_version``
     - string
     - EFA kernel driver version from sysfs. Omitted when the ``efa`` module is not loaded.
   * - ``driver.loaded``
     - boolean
     - Whether the ``neuron`` kernel module is loaded. It does not mean the devices are ready. Valid even when ``driver.version`` is ``null``.
   * - ``driver.version``
     - string or null
     - Same value as ``driver_version``, or ``null``.

Driver fields come from the latest snapshot, not from a live sysfs read, so they can be up to one collection interval old.

.. _neuron-observer-api-get-devices:

GET /api/v1/devices
^^^^^^^^^^^^^^^^^^^

Returns one object per discovered Neuron device.

.. code-block:: json

   [
     {
       "device_id": 0,
       "device_name": "Trainium",
       "device_arch_type": "NDv2",
       "serial_number": "...",
       "core_count": 2,
       "connected_devices": [1, 3, 12],
       "core_arch_type": "NCv2",
       "logical_neuroncore_config": 2,
       "health": {"state": "unhealthy", "unhealthy_components": ["hbm"]},
       "unhealthy_components": ["hbm"],
       "diagnosis": {
         "health_state": "unhealthy",
         "findings": [
           {"name": "hbm_unrepairable",
            "recommendation": {"recovery_action": "TERMINATE"}}
         ]
       }
     }
   ]

.. list-table::
   :header-rows: 1
   :widths: 30 14 56

   * - Field
     - Type
     - Description
   * - ``device_id``
     - integer
     - Device index (``/dev/neuronN``).
   * - ``device_name``
     - string or null
     - Device name reported by the driver.
   * - ``device_arch_type``
     - string or null
     - Device architecture string from the driver (sysfs ``info/architecture/arch_type``).
   * - ``serial_number``
     - string or null
     - Device serial number.
   * - ``core_count``
     - integer or null
     - Number of NeuronCores on the device.
   * - ``connected_devices``
     - array of integer
     - Device indexes connected to this device over NeuronLink.
   * - ``core_arch_type``
     - string or null
     - NeuronCore architecture string from the driver (for example ``NCv2``).
   * - ``logical_neuroncore_config``
     - integer or null
     - Logical NeuronCore (LNC) configuration in effect.
   * - ``unhealthy_components``
     - array of string
     - Components reported unhealthy for the device, for example ``hbm`` or ``link_efa``. Omitted when empty. See :ref:`neuron-observer-metrics-fault-reference` for the components and their meanings.
   * - ``diagnosis``
     - object
     - Observer's conclusion from the device's health signals: a health state and the findings behind it, each with the action it needs. See :ref:`neuron-observer-api-device-diagnosis`. Omitted when the daemon has no health reading for the device; treat a missing ``diagnosis`` as ``unknown``.
   * - ``health``
     - object
     - **Deprecated.** Raw health state, kept on the wire for compatibility. Omitted when the driver does not expose a ``health_status`` sysfs tree. Read ``diagnosis.health_state`` instead of ``health.state``, and the top-level ``unhealthy_components`` instead of ``health.unhealthy_components``.
   * - ``health.state``
     - string
     - ``healthy``, ``unhealthy``, or ``unknown``. ``unknown`` means the driver did not report a health state.
   * - ``health.unhealthy_components``
     - array of string
     - Same list as the top-level ``unhealthy_components``. Omitted when empty.

.. _neuron-observer-api-device-diagnosis:

Device diagnosis
^^^^^^^^^^^^^^^^

The ``diagnosis`` object on each device (in ``/api/v1/devices`` and in the ``devices`` array of ``/api/v1/node/snapshot``) is Observer's reading of the device's health signals. It holds a health state and a list of findings. Each finding names the fault, the one recovery action it needs, and any investigative steps. The ``nobs devices`` command prints the health state; ``nobs devices --findings`` adds the findings.

.. code-block:: json

   "diagnosis": {
     "health_state": "unhealthy",
     "findings": [
       {"name": "firmware_service_api",
        "recommendation": {"recovery_action": "MONITOR",
                           "investigative_actions": ["CHECK_NEURON_SOFTWARE_CONFIGURATION"]}},
       {"name": "hbm_unrepairable",
        "recommendation": {"recovery_action": "TERMINATE"}}
     ]
   }

.. list-table::
   :header-rows: 1
   :widths: 40 60

   * - Field
     - Description
   * - ``health_state``
     - Observer's health state for the device; see the health state table below.
   * - ``findings``
     - One entry per problem found, sorted by name; names are unique. Omitted when empty.
   * - ``findings[].name``
     - Finding name from the catalog below. A name always identifies the same fault or set of faults.
   * - ``findings[].recommendation.recovery_action``
     - Exactly one recovery action.
   * - ``findings[].recommendation.investigative_actions``
     - Zero or more investigative actions. Omitted when empty.

**Health state**

.. list-table::
   :header-rows: 1
   :widths: 20 80

   * - Value
     - Meaning
   * - ``healthy``
     - The findings show nothing wrong with the device.
   * - ``unhealthy``
     - The findings show the device needs attention. Each finding's recovery action says what it needs.
   * - ``unknown``
     - Observer could not assess the device: its health reading is unreadable.

Observer derives the health state from the findings. The recovery actions below say what each finding needs.

**Recovery actions**

What to do about the device now, ordered from least to most disruptive. A client that needs one action per device can take the strongest across its findings.

.. list-table::
   :header-rows: 1
   :widths: 24 76

   * - Value
     - Meaning
   * - ``MONITOR``
     - No immediate recovery action is required. The condition is expected to clear or be handled without direct action from you, but you should observe it and keep monitoring; report the issue if it persists or recurs.
   * - ``UPDATE_SOFTWARE``
     - Update or correct the Neuron software stack when a known software compatibility or version issue has a validated fix.
   * - ``RESET``
     - Reset the Neuron device (see :ref:`neuron-sysfs-ug`), or reboot the instance, which also resets it. A reset takes seconds; a reboot typically takes minutes.
   * - ``TERMINATE``
     - Terminate the affected instance. Termination does not guarantee different underlying physical capacity. If the replacement returns on the same capacity, or the same hardware fault occurs repeatedly, report the issue.

**Investigative actions**

Diagnostic or escalation steps that do not change the system.

.. list-table::
   :header-rows: 1
   :widths: 40 60

   * - Value
     - Meaning
   * - ``RUN_HEALTH_CHECK``
     - Run the supported Neuron/Observer :ref:`health diagnostic <neuron-observer-health-check>` to validate recovery or further isolate the issue.
   * - ``CHECK_WORKLOAD_APPLICATION``
     - Inspect your code, model, inputs, and configuration, your framework and application logs, and workload behavior.
   * - ``CHECK_NEURON_SOFTWARE_CONFIGURATION``
     - Verify the Neuron software versions and configuration that you control, and inspect the Neuron logs available to you.
   * - ``REPORT_ISSUE``
     - Escalate the condition to AWS/Neuron with the available diagnostics because the investigation available to you cannot resolve it.

**Finding catalog**

Each finding is computed from the device's ``unhealthy_components`` tokens and, for HBM, its uncorrectable-error counters.

.. list-table::
   :header-rows: 1
   :widths: 28 36 16 20

   * - Finding
     - Computed from
     - Recovery action
     - Investigative actions
   * - ``hbm_repairable``
     - ``hbm``, with ``mem_ecc_repairable_uncorrected`` > 0 and ``mem_ecc_unrepairable_uncorrected`` = 0
     - ``RESET``
     -
   * - ``hbm_unrepairable``
     - ``hbm``, with ``mem_ecc_unrepairable_uncorrected`` > 0
     - ``TERMINATE``
     -
   * - ``dma_abort``
     - ``dma_abort``
     - ``RESET``
     -
   * - ``firmware_service_api``
     - ``firmware_service_api``
     - ``MONITOR``
     - ``CHECK_NEURON_SOFTWARE_CONFIGURATION``
   * - ``firmware_service_processor``
     - ``firmware_service_processor``
     - ``TERMINATE``
     -
   * - ``sram``
     - ``sram``
     - ``TERMINATE``
     -
   * - ``fabric_error``
     - ``fabric_error``
     - ``TERMINATE``
     -
   * - ``link_intraserver``
     - ``link_intraserver``
     - ``TERMINATE``
     -
   * - ``link_host``
     - ``link_host``
     - ``TERMINATE``
     -
   * - ``link_efa``
     - ``link_efa``
     - ``TERMINATE``
     -
   * - ``link_interserver``
     - ``link_interserver``
     - ``TERMINATE``
     -
   * - ``link_switch``
     - ``link_switch``
     - ``TERMINATE``
     -
   * - ``device_unreachable``
     - ``device_unreachable``
     - ``TERMINATE``
     -

.. _neuron-observer-api-get-node-snapshot:

GET /api/v1/node/snapshot
^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the latest snapshot as one JSON object. This is the lowest-level view. It contains every metric the daemon collected in the last cycle, keyed by metric name, with values aligned to devices, cores, processes, and EFA interfaces. The ``nobs metrics --scope efa`` command reads EFA counters from this endpoint.

Top-level keys:

.. list-table::
   :header-rows: 1
   :widths: 26 74

   * - Key
     - Content
   * - ``system_metadata``
     - Host-global metadata: instance identity from IMDS, UltraServer topology, driver load state and versions.
   * - ``system``
     - Host metrics: memory, CPU, swap.
   * - ``vcpu_metrics``
     - Per-vCPU metrics.
   * - ``devices``
     - Array indexed by device ID. Each slot is a device header (``device_id``, ``core_count``, ``info``, ``unhealthy_components``, ``diagnosis``, ``health``) or ``null`` for an index with no device. ``diagnosis`` has the same value as in ``/api/v1/devices`` (see :ref:`neuron-observer-api-device-diagnosis`). ``health`` is deprecated: an object with a ``state`` tag and, when unhealthy, a ``components`` array; read ``diagnosis.health_state`` and ``unhealthy_components`` instead.
   * - ``device_processes``
     - Array indexed by device ID; each element lists the processes using that device (``pid``, ``tag``). Loaded models are not included in the snapshot; read them from ``/api/v1/node/models``.
   * - ``device_metrics``
     - Map of device-scoped metric name to a per-device value vector.
   * - ``core_metrics``
     - Map of core-scoped metric name to a per-core value vector.
   * - ``efa_interfaces``
     - EFA interfaces discovered on the node. Omitted when empty.
   * - ``efa_metrics``
     - Map of EFA metric name to a per-interface value vector. Omitted when empty.

The snapshot carries the daemon's internal store layout, so its shape is the most likely part of the API to change between releases. Prefer ``/api/v1/devices``, ``/api/v1/node/models``, and ``/api/v1/query`` where they cover your need.

.. _neuron-observer-api-get-node-models:

GET /api/v1/node/models
^^^^^^^^^^^^^^^^^^^^^^^

Returns the models loaded by each process on each device. Processes with no loaded models are omitted.

.. code-block:: json

   [
     {
       "device_id": 0,
       "pid": 41237,
       "tag": "trainer-rank-0",
       "models": [
         {
           "name": "model.neff",
           "uuid": "6d8e...",
           "is_running": true,
           "model_id": 10001,
           "sg_index": 0,
           "nc_index": 0,
           "host_mem_bytes": 1048576,
           "device_mem_bytes": 8589934592,
           "host_mem_breakdown": {"code": 1048576, "tensors": 0, "constants": 0, "scratchpad": 0, "misc": 0},
           "device_mem_breakdown": {"code": 268435456, "tensors": 6442450944, "constants": 1073741824, "scratchpad": 805306368, "misc": 0}
         }
       ]
     }
   ]

.. list-table::
   :header-rows: 1
   :widths: 30 14 56

   * - Field
     - Type
     - Description
   * - ``device_id``
     - integer
     - Device index.
   * - ``pid``
     - integer
     - Process ID in the host (init) PID namespace.
   * - ``tag``
     - string
     - Runtime tag of the process (the value of ``NEURON_PROCESS_TAG``, defaulting to the PID).
   * - ``models[].name``
     - string
     - Model name.
   * - ``models[].uuid``
     - string
     - Model UUID assigned by the runtime.
   * - ``models[].is_running``
     - boolean
     - Whether the model is currently executing.
   * - ``models[].model_id``
     - integer
     - Runtime model ID.
   * - ``models[].sg_index``
     - integer
     - Subgraph index within the model.
   * - ``models[].nc_index``
     - integer
     - NeuronCore index the subgraph is placed on.
   * - ``models[].host_mem_bytes``
     - integer
     - Host memory attributed to this loaded model, in bytes.
   * - ``models[].device_mem_bytes``
     - integer
     - Device memory attributed to this loaded model, in bytes.
   * - ``models[].host_mem_breakdown``
     - object
     - Host memory by category (``code``, ``tensors``, ``constants``, ``scratchpad``, ``misc``), in bytes. Omitted when every category is zero.
   * - ``models[].device_mem_breakdown``
     - object
     - Device memory by category, same keys. Omitted when every category is zero.

.. _neuron-observer-api-get-tags:

GET /api/v1/tags
^^^^^^^^^^^^^^^^

Returns processes and their loaded models grouped by runtime tag, sorted by tag. Each group lists the processes carrying that tag, one entry per device the process uses. Model entries carry the same fields as ``/api/v1/node/models`` without the memory breakdowns.

.. code-block:: json

   [
     {
       "tag": "trainer-rank-0",
       "processes": [
         {
           "pid": 41237,
           "device_id": 0,
           "models": [
             {"name": "model.neff", "uuid": "6d8e...", "is_running": true, "model_id": 10001,
              "sg_index": 0, "nc_index": 0, "host_mem_bytes": 1048576, "device_mem_bytes": 8589934592}
           ]
         }
       ]
     }
   ]

``processes[].models`` is omitted when the process has no loaded models on that device.

.. _neuron-observer-api-get-node-config:

GET /api/v1/node/config
^^^^^^^^^^^^^^^^^^^^^^^

Returns the daemon's effective configuration as JSON, with the same sections and keys as the daemon configuration file (``collection``, ``export``, ``logging``, ``daemon``, and the others listed in :ref:`neuron-observer-configuration-reference` under ``observer.daemon.config``). Defaults are filled in, so the response shows what the daemon is actually running with.

.. _neuron-observer-api-post-query:

POST /api/v1/query
^^^^^^^^^^^^^^^^^^

Aggregates one or more metrics over a target. The response returns all results in one request, along with the snapshot's system metadata and host metrics. ``nobs metrics`` uses this endpoint for its system, device, and core scopes.

**Request body**: a JSON array of up to 1,000 query objects.

.. code-block:: json

   [
     {"target": "system", "metric": "power_avg", "strategy": "avg"},
     {"target": {"device": 0}, "metric": "mem_ecc_corrected", "strategy": "sum"},
     {"target": {"core": [0, 1]}, "metric": "utilization", "strategy": "max"}
   ]

.. list-table::
   :header-rows: 1
   :widths: 16 84

   * - Field
     - Value
   * - ``target``
     - ``"system"`` for the whole node; ``{"device": <device_id>}`` for one device; ``{"core": [<device_id>, <core_index>]}`` for one core.
   * - ``metric``
     - Base metric name without the ``neuron.<scope>.`` prefix. For example, the exported series ``neuron.device.mem_ecc_corrected`` is queried as ``mem_ecc_corrected``. See :ref:`neuron-observer-metrics-fault-reference` for the names.
   * - ``strategy``
     - ``"sum"``, ``"avg"``, ``"min"``, ``"max"``, or a percentile written as ``"p"`` followed by a number from 0 to 100 with at most four decimal places, for example ``"p50"`` or ``"p99.9"``.

**Response**

.. code-block:: json

   {
     "results": [
       {"value": 42.5, "type": "f64"},
       {"value": 0, "type": "u64"},
       null
     ],
     "system_metadata": {"instance_id": "i-0123456789abcdef0", "...": "..."},
     "system": {"...": "..."}
   }

.. list-table::
   :header-rows: 1
   :widths: 24 76

   * - Field
     - Description
   * - ``results``
     - One entry per query, in request order. Each entry is ``{"value": <number>, "type": "u64"}`` or ``{"value": <number>, "type": "f64"}``, or ``null`` when the metric has no value for that target (including a metric name the daemon does not know).
   * - ``system_metadata``
     - The snapshot's ``system_metadata`` object (instance identity, UltraServer topology, driver versions).
   * - ``system``
     - The snapshot's ``system`` object (host memory, CPU, swap).

A request with more than 1,000 queries returns ``400 INVALID_QUERY``. An unknown metric name is not an error; its result is ``null``.

Health check
------------

The daemon keeps one health-check result at a time. The resource is in one of three states: never run, running, or completed with exactly one result. Starting a new run replaces the previous result. For what the tests do, their outcomes and failure reasons, and what a passing result does and does not establish, see :ref:`neuron-observer-health-check`.

.. _neuron-observer-api-post-node-healthcheck:

POST /api/v1/node/healthcheck
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Starts a health check. The request has no body.

.. list-table::
   :header-rows: 1
   :widths: 16 84

   * - Query parameter
     - Value
   * - ``test``
     - Optional. Run a single test: ``matmul``, ``collective-neuronlink``, or ``collective-efa``. Omit it to run every test.

**Responses**

- ``202 Accepted`` with ``{"state": "running", "run_id": "<ulid>"}``. Save ``run_id`` so you can confirm that the result you poll for belongs to the run you started.
- ``400 INVALID_QUERY`` for an unknown ``test`` name.
- ``409 CONFLICT`` if a health check is already running, or if the latest snapshot shows another process holding NeuronCore locks (a workload is using the device). The lock check reads the latest snapshot, so it can be up to one collection interval stale.

.. _neuron-observer-api-get-node-healthcheck:

GET /api/v1/node/healthcheck
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Returns the state of the health-check resource. Always returns ``200 OK``; the body carries the state and result.

.. list-table::
   :header-rows: 1
   :widths: 16 84

   * - Query parameter
     - Value
   * - ``logs``
     - Optional. ``true`` includes captured subprocess logs for a passing run. Logs are always included for a failed run.

.. code-block:: json

   {
     "state": "completed",
     "run_id": "01JBQW6Q3Y8ZQ4F0K5N2R7T9VX",
     "outcome": "failed",
     "reason": "collective_failed",
     "started_at": 1793638800000,
     "finished_at": 1793638842517,
     "tests": [
       {"name": "single-core matmul", "status": "passed", "duration_ms": 12840},
       {"name": "collective all-reduce (NeuronLink)", "status": "failed",
        "detail": "rank 3: result mismatch", "duration_ms": 20311},
       {"name": "collective all-reduce (EFA)", "status": "passed", "duration_ms": 18402}
     ],
     "logs": {"stdout": "...", "stderr": "...", "exit_code": 1}
   }

.. list-table::
   :header-rows: 1
   :widths: 24 14 62

   * - Field
     - Type
     - Description
   * - ``state``
     - string
     - ``never_run``, ``running``, or ``completed``.
   * - ``run_id``
     - string (ULID)
     - Identity of the reported run. Omitted when ``state`` is ``never_run``.
   * - ``outcome``
     - string
     - ``passed`` or ``failed``. Present only when ``state`` is ``completed``.
   * - ``reason``
     - string
     - Failure reason. Present only when the outcome is ``failed``. One of ``incorrect_output``, ``device_busy``, ``timeout``, ``no_result``, ``executor_error``, or ``collective_failed``.
   * - ``started_at``
     - integer
     - Start time, milliseconds since the Unix epoch. Present when ``running`` or ``completed``; omitted when ``never_run``.
   * - ``finished_at``
     - integer
     - Finish time, milliseconds since the Unix epoch. Present only when ``completed``.
   * - ``tests``
     - array
     - One entry per test the run covered. Omitted when empty.
   * - ``tests[].name``
     - string
     - Human-readable test name: ``single-core matmul``, ``collective all-reduce (NeuronLink)``, or ``collective all-reduce (EFA)``.
   * - ``tests[].status``
     - string
     - ``passed``, ``failed``, or ``skipped``. ``skipped`` marks a test that did not run on the host. No current test reports it.
   * - ``tests[].detail``
     - string
     - One-line detail, for example which cores or ranks failed, or why the test was skipped. Free text for humans; do not parse it.
   * - ``tests[].duration_ms``
     - integer
     - Wall-clock duration in milliseconds, including runtime initialization and any device reset. Omitted for a test that was skipped without running.
   * - ``logs``
     - object
     - Captured ``stdout``, ``stderr``, and ``exit_code`` of the test subprocess. Present only when ``completed``, and then on failure or when ``logs=true``. ``exit_code`` is omitted when the subprocess was killed on timeout.

To run a check and wait for the result, ``POST`` once, then poll ``GET`` until ``state`` is ``completed`` and ``run_id`` matches the one you received.

.. _neuron-observer-api-events:

Event stream
------------

.. _neuron-observer-api-get-events:

GET /api/v1/events
^^^^^^^^^^^^^^^^^^

Opens a long-lived response that streams device health-state events and heartbeats as newline-delimited JSON (``Content-Type: application/x-ndjson``). The daemon first replays buffered events the client has not seen, then streams live frames until the client disconnects or falls behind. The response also sets ``x-accel-buffering: no`` so reverse proxies forward frames as they are produced.

.. list-table::
   :header-rows: 1
   :widths: 16 84

   * - Query parameter
     - Value
   * - ``since``
     - Optional. An ``event_id`` to resume from. Replay is inclusive: the event with that ID is delivered again, followed by every later event. Omit it to receive the full replay buffer followed by live events.

**Frames**

Each line is one of two objects. A health-state event:

.. code-block:: json

   {"event_id": "01JBQX2M7C4H9W3E8T1P6R5K2D", "ts": "2026-11-02T17:20:41.118Z", "device_id": 3,
    "state": "unhealthy", "unhealthy_components": ["firmware_service_api"],
    "ecc": {"mem_ecc_unrepairable_uncorrected": 0, "mem_ecc_repairable_uncorrected": 0, "sram_ecc_uncorrected": 0}}

A heartbeat:

.. code-block:: json

   {"heartbeat": true, "ts": "2026-11-02T17:14:10.000Z"}

A frame is a heartbeat if it has the ``heartbeat`` key.

.. list-table::
   :header-rows: 1
   :widths: 26 14 60

   * - Field
     - Type
     - Description
   * - ``event_id``
     - string (ULID)
     - Monotonic per-daemon event ID. Use it as the ``since`` cursor on reconnect.
   * - ``ts``
     - string
     - RFC 3339 UTC time the event was observed.
   * - ``device_id``
     - integer
     - Affected device index.
   * - ``state``
     - string
     - ``healthy``, ``unhealthy``, or ``unknown``: the same value as the deprecated ``health.state`` on ``/api/v1/devices``. A later release will report ``diagnosis.health_state`` here instead. Sent when a device's state or ``unhealthy_components`` change; a recovery is ``state: "healthy"`` with no components.
   * - ``unhealthy_components``
     - array of string
     - Components reported unhealthy for the device; the same list as the device's ``unhealthy_components``. Omitted when empty.
   * - ``ecc``
     - object
     - ECC counters at the time of the event: ``mem_ecc_corrected``, ``mem_ecc_unrepairable_uncorrected``, ``mem_ecc_repairable_uncorrected``, ``sram_ecc_corrected``, ``sram_ecc_uncorrected``. Each counter is omitted when the device or driver does not expose it.
   * - ``suggested_action``
     - string
     - ``REBOOT`` or ``DO_NOT_USE``. Advisory, and sent only on some events. A later release will remove this field, so do not depend on it. It can disagree with the device's ``diagnosis``, which the stream does not carry; on an event, read each finding's recovery action from ``diagnosis`` in ``/api/v1/devices`` (see :ref:`neuron-observer-api-device-diagnosis`).
   * - ``heartbeat``
     - boolean
     - Present (and ``true``) only on heartbeat frames.

**Resuming and errors**

- If the stream closes, for example when the daemon restarts or the client falls behind, reconnect with ``since=<last event_id>`` to replay the gap.
- Replay is inclusive and can repeat events you already processed. Event IDs increase monotonically, so skip any event whose ``event_id`` is not newer than the last one you processed.
- Heartbeats are sent every second by default and are never buffered or replayed. Use them to detect a lost connection: if they stop arriving, reconnect.
- ``400 INVALID_QUERY``: ``since`` is not a valid ULID.
- ``410 GONE``: ``since`` is older than the replay buffer. The response header ``x-observer-oldest-id`` holds the oldest event ID still available; reconnect with ``since`` set to that value, or with no ``since``.

.. _neuron-observer-api-errors:

Errors
------

An unknown path returns ``404 Not Found`` with an empty body. Readiness-gated endpoints return a plain-text ``503`` before the first collection (see :ref:`neuron-observer-api-readiness`). Requests rejected by the HTTP framework before they reach a handler (a malformed JSON body or wrong shape on ``/api/v1/query``, a missing ``Content-Type: application/json`` header, or a ``logs`` query value that is not a boolean) return a plain-text ``400``, ``415``, or ``422`` with no envelope. Errors raised by the daemon itself return a JSON envelope:

.. code-block:: json

   {
     "error": {
       "code": "INVALID_QUERY",
       "message": "unknown test 'matmull'; expected one of matmul, collective-neuronlink, collective-efa"
     }
   }

.. list-table::
   :header-rows: 1
   :widths: 10 22 68

   * - Status
     - ``error.code``
     - When it is returned
   * - 400
     - ``INVALID_QUERY``
     - The request cannot be parsed: a malformed ``since`` cursor on the event stream, an unknown health-check ``test`` name, or more than 1,000 queries in one ``/api/v1/query`` request.
   * - 409
     - ``CONFLICT``
     - The request conflicts with current state: a health check is already running, or another process holds NeuronCore locks.
   * - 410
     - ``GONE``
     - The ``since`` cursor passed to the event stream is older than the daemon's replay buffer. The ``x-observer-oldest-id`` response header carries the oldest event ID that can be resumed from.
   * - 500
     - ``INTERNAL_ERROR``
     - The daemon could not complete the request.

``error.message`` is human-readable text for logs and operators. Branch on the HTTP status and ``error.code``, not on the message.

.. _neuron-observer-api-versioning:

Versioning
----------

All data endpoints live under the ``/api/v1`` path prefix. The probes (``/healthz``, ``/readyz``, ``/version``) and ``/metrics`` are not versioned.

During the public beta, the API can change between Neuron releases. Write clients to tolerate additive change:

- Ignore JSON fields you do not recognize.
- Accept new values in open-ended string fields such as ``health.unhealthy_components`` and ``tests[].detail``.
- Treat ``health.state`` and event ``state`` values other than ``healthy`` and ``unhealthy`` as ``unknown``.
- Prefer ``/api/v1/devices``, ``/api/v1/node/models``, and ``/api/v1/query`` over ``/api/v1/node/snapshot``, whose layout follows the daemon's internal store.

``GET /version`` and ``version`` in ``/api/v1/node/status`` report the daemon version so a client can log which build it is talking to.

Examples
--------

Check readiness and list unhealthy devices
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

   NODE=http://localhost:7001

   # Wait for the first collection cycle.
   until [ "$(curl -s -o /dev/null -w '%{http_code}' $NODE/readyz)" = "200" ]; do sleep 1; done

   # Devices whose diagnosis health state is not "healthy", with each finding and its recovery action.
   curl -s $NODE/api/v1/devices \
     | jq '[.[] | select((.diagnosis.health_state // "unknown") != "healthy")
            | {device_id, health_state: (.diagnosis.health_state // "unknown"),
               components: .unhealthy_components,
               findings: [.diagnosis.findings[]? | {name, action: .recommendation.recovery_action}]}]'

Query aggregated metrics
^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

   curl -s -X POST http://localhost:7001/api/v1/query \
     -H 'Content-Type: application/json' \
     -d '[
       {"target": "system", "metric": "power_avg", "strategy": "avg"},
       {"target": {"device": 0}, "metric": "mem_ecc_corrected", "strategy": "sum"}
     ]' | jq '.results'

Run a health check and wait for the result
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

   NODE=http://localhost:7001
   RUN_ID=$(curl -s -X POST "$NODE/api/v1/node/healthcheck?test=matmul" | jq -r '.run_id')

   while :; do
     RESULT=$(curl -s "$NODE/api/v1/node/healthcheck")
     STATE=$(echo "$RESULT" | jq -r '.state')
     if [ "$STATE" = "completed" ] && [ "$(echo "$RESULT" | jq -r '.run_id')" = "$RUN_ID" ]; then
       echo "$RESULT" | jq '{outcome, reason, tests}'
       break
     fi
     sleep 2
   done

.. _neuron-observer-api-cli-mapping:

nobs command mapping
--------------------

.. list-table::
   :header-rows: 1
   :widths: 40 60

   * - Command
     - Endpoint
   * - ``nobs status``
     - ``GET /api/v1/node/status``
   * - ``nobs devices`` / ``nobs devices --findings``
     - ``GET /api/v1/devices``
   * - ``nobs metrics`` (system scope)
     - ``POST /api/v1/query``
   * - ``nobs metrics --scope device`` / ``--scope core``
     - ``POST /api/v1/query`` and ``GET /api/v1/devices``
   * - ``nobs metrics --scope efa``
     - ``GET /api/v1/node/snapshot``
   * - ``nobs tags``
     - ``GET /api/v1/tags``
   * - ``nobs config``
     - ``GET /api/v1/node/config``
   * - ``nobs health run``
     - ``POST`` then ``GET /api/v1/node/healthcheck``
   * - ``nobs health status`` / ``nobs health logs``
     - ``GET /api/v1/node/healthcheck``

By default ``nobs`` connects to ``localhost:7001``; ``--host <address>:<port>`` points it at another daemon.
