---
title: "Update a mapping rule with the given state"
method: POST
path: "/namespaces/{namespaceID}/mapping-rules"
tags: ["mapping-rules"]
---

# Update a mapping rule with the given state

`POST /namespaces/{namespaceID}/mapping-rules`

## Path parameters

- `namespaceID` string, required

## Request body

- MappingRule
  - `id` string
  - `name` string
  - `filter` string
  - `aggregation` string[]
  - `storagePolicies` string[]
  - `dropPolicy` integer
  - `cutoverMillis` integer
  - `lastUpdatedBy` string
  - `lastUpdatedAtMillis` integer

## Response `201`

Mapping Rule created

- MappingRule
  - `id` string
  - `name` string
  - `filter` string
  - `aggregation` string[]
  - `storagePolicies` string[]
  - `dropPolicy` integer
  - `cutoverMillis` integer
  - `lastUpdatedBy` string
  - `lastUpdatedAtMillis` integer

## Other responses

- `404` — No such namespace
- `409` — The ruleset got updated while you were looking at it.
- `500` — Something went horribly wrong

---

[API](https://skmtc.dev/m3db/apis/r2-api.md) · [All operations](https://skmtc.dev/m3db/apis/r2-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/m3db/r2-api/revisions/0e7f233d17fb/schema)
