---
title: "Converts a Prometheus rule group into a Grafana rule group and creates or updates it within the specified namespace."
method: POST
path: "/convert/prometheus/config/v1/rules/{NamespaceTitle}"
tags: ["convert_prometheus"]
---

# Converts a Prometheus rule group into a Grafana rule group and creates or updates it within the specified namespace.

`POST /convert/prometheus/config/v1/rules/{NamespaceTitle}`

## Request

- Base URL: `/api` (relative, and the document’s source URL is not known)
- URL: `/api/convert/prometheus/config/v1/rules/{NamespaceTitle}`
- Auth: one of:
  - HTTP basic
  - API key in header `Authorization`

If the group already exists and was not imported from a Prometheus-compatible source initially,
it will not be replaced and an error will be returned.

## Path parameters

- `NamespaceTitle` string, required

## Headers

- `x-grafana-alerting-datasource-uid` string
- `x-grafana-alerting-recording-rules-paused` boolean
- `x-grafana-alerting-alert-rules-paused` boolean
- `x-grafana-alerting-target-datasource-uid` string
- `x-grafana-alerting-folder-uid` string
- `x-grafana-alerting-notification-settings` string

## Request body `application/yaml`

- PrometheusRuleGroup
  - `interval` integer: A Duration represents the elapsed time between two instants as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.
  - `labels` object
  - `limit` integer
  - `name` string
  - `query_offset` string
  - `rules` PrometheusRule[]
    - `alert` string
    - `annotations` object
    - `expr` string
    - `for` string
    - `keep_firing_for` string
    - `labels` object
    - `record` string

## Response `202`

ConvertPrometheusResponse

- ConvertPrometheusResponse
  - `error` string
  - `errorType` string
  - `status` string

## Other responses

- `403`: ForbiddenError

---

[API](https://skmtc.dev/grafana/apis/grafana-http-api.md) - [All operations](https://skmtc.dev/grafana/apis/grafana-http-api/llms.txt) - [OpenAPI document](https://skmtc.dev/grafana/apis/grafana-http-api/revisions/df55ba1718ba?raw)
