---
type: api
title: Ingest Prometheus remote write data
description: Index Prometheus time series into metrics data streams.
url: https://www.elastic.co/elastic/docs-builder/docs/4922/api/doc/elasticsearch/v9/operation/operation-prometheus-remote-write
resource: https://www.elastic.co/elastic/docs-builder/docs/4922/api/doc/elasticsearch/v9/operation/operation-prometheus-remote-write
products:
  - Elasticsearch
---

# Ingest Prometheus remote write data

Authentication: required

Availability: Preview since 9.4

## Paths

- `POST` `/_prometheus/metrics/{dataset}/{namespace}/api/v1/write`
- `POST` `/_prometheus/metrics/{dataset}/api/v1/write`
- `POST` `/_prometheus/api/v1/write`

#### Path parameters

- `dataset` (string · default: generic) — optional, leave it out to use `/_prometheus/api/v1/write`
  The data stream dataset. The value is sanitized rather than rejected.
- `namespace` (string · default: default) — optional, leave it out to use `/_prometheus/api/v1/write`
  The data stream namespace. The value is sanitized rather than rejected.

## Description

Index Prometheus time series into metrics data streams.
The request body is a Prometheus remote write 1.0 message: a protobuf `WriteRequest` sent with the content type `application/x-protobuf`, usually snappy-compressed (`Content-Encoding: snappy`).
A message that declares another `proto` parameter in its content type is rejected with `415 Unsupported Media Type`, so that Prometheus can fall back to remote write 1.0.
Samples go to the `metrics-{dataset}.prometheus-{namespace}` data stream.
In 9.6 and later, exemplars go to the `exemplars-{dataset}.prometheus-{namespace}` data stream.
The `data_stream_dataset` and `data_stream_namespace` labels of a time series override the dataset and namespace from the path.

## Required privileges

- Index privileges: `create_doc`, `auto_configure`

## Request body

`application/json`

Type: `object`


## Responses

`application/json`

## Code examples

#### Console

```console
POST /_prometheus/metrics/generic/default/api/v1/write
{}
```

#### curl

```curl
curl -X POST "${ELASTICSEARCH_URL}/_prometheus/metrics/generic/default/api/v1/write" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Response examples

#### 200

`application/json`

