v1

latestOpenAPI 3.1.0BSD-32026-07-2471176175.5 KB
telemetry

Replace metric records for the submitted dates

Atomically replace metric telemetry records by usage date. For every date present in the submitted batch, all existing records on that date are dropped and the submitted records inserted. Dates not present in the batch are left untouched.

⚠️ You must send all of a day's records in a single request. Each submitted date is replaced wholesale — any record you omit for that date is dropped. Only use replace_period when you can send a day's complete metric telemetry at once. If you can't guarantee that, use sum or replace instead.

A value of 0 is not allowed for the replace_period operation and is rejected with a 400. To remove a target from a date, omit it from that date's batch; to clear records outside a batch, use the delete operation.

Example. A metric has records on 2024-03-05 for targets A and B, and on 2024-03-10 for target A. You submit a replace_period batch containing only 2024-03-05 / target A. Result: 2024-03-05 now contains only target A — target B on that date is dropped because it was not in the batch — while 2024-03-10 is left untouched. To keep target B on 2024-03-05, include it in the same request.

Note: The unit metric must already exist when using this endpoint.

post/unit-cost/v1/telemetry/metric/{metric_name}/replace_period

Path parameters

metric_namestring required

A unique name to identify this unit metric.

Headers

Authorizationstring required

Your CloudZero API Key. Note: This is not a bearer token, and should appear in the header as Authorization: <cloudzero-api-key>

Request body

Example request

{
  "records": [
    {
      "value": 16.4,
      "timestamp": "2020-03-03T15:32:44+00:00"
    }
  ]
}

Response

Telemetry accepted