---
title: "Sets a metric for a Job"
method: POST
path: "/api/v1/jobs/{id}/metrics"
tags: ["Job"]
---

# Sets a metric for a Job

`POST /api/v1/jobs/{id}/metrics`

## Request

- Base URL: `/` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v1/jobs/{id}/metrics`
- Auth: none declared
- TypeScript: <https://skmtc.dev/usnistgov/apis/dioptra-rest-api/docs/api/v1/jobs/:id/metrics/post.ts> (a function with typed inputs; its response is checked against the schema)

## Headers

- `X-Fields` string, mask

## Request body

- MetricsLoad
  - `name` string, required: The name of the metric.
  - `value` number, required: The value of the metric. Can be a float, NaN, Infinity, or -Infinity. NaN values are represented with the string "nan" and infinite values are represented with the strings "inf" and "-inf".
  - `step` integer: The step value for the metric, optional. Sequentially increasing step values are used to track how a metric changes over time. Indexed from 0. If not provided, defaults to 0.
  - `timestamp` string, date-time: A timestamp value to associate with the metric. If not provided, defaults to the server time when the metric is received.

## Response `200`

Success

- MetricsDump
  - `name` string, required: The name of the metric.
  - `value` number, required: The value of the metric. Can be a float, NaN, Infinity, or -Infinity. NaN values are represented with the string "nan" and infinite values are represented with the strings "inf" and "-inf".

## Changes

- **2026-09-30** `7615a76631a4`: 1 warning, 1 info
  - deleted the `path` request parameter `id`
  - the `step` request property default value `0` was added
- **2026-02-11** `a73101579c5c`: 1 info
  - endpoint added
- **2024-07-26** `9a36b9043379`: 1 breaking
  - api path removed without deprecation

[Operation history](https://skmtc.dev/usnistgov/apis/dioptra-rest-api/changes/api/v1/jobs/:id/metrics/post.md)

---

[API](https://skmtc.dev/usnistgov/apis/dioptra-rest-api.md) - [All operations](https://skmtc.dev/usnistgov/apis/dioptra-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/usnistgov/apis/dioptra-rest-api/revisions/e1a0ec3a40b2?raw)
