---
title: "POST /datasets/{dataset_id}/mapfields"
method: POST
path: "/datasets/{dataset_id}/mapfields"
tags: ["datasets"]
---

# POST /datasets/{dataset_id}/mapfields

`POST /datasets/{dataset_id}/mapfields`

## Request

- Base URL: `https://api.axiom.co/v2`
- URL: `https://api.axiom.co/v2/datasets/{dataset_id}/mapfields`
- Auth: OAuth 2
  - Authorization code: `https://accounts.google.com/o/oauth2/v2/auth`
  - Token URL: `https://www.googleapis.com/oauth2/v4/token` scopes: `datasets|update`
- TypeScript: <https://skmtc.dev/axiom/apis/axiom-public-api/docs/datasets/:dataset_id/mapfields/post.ts> (a function with typed inputs; its response is checked against the schema)

Configures a field as a map field. Events you ingest afterward store the field's nested keys inside the map, while previously ingested events keep their structure. Not supported for metrics datasets.

## Path parameters

- `dataset_id` string, required

## Request body

- MapField: A map field, described by a name
  - `name` string, required

## Response `200`

Created map field.

- MapField: A map field, described by a name
  - `name` string, required

## Other responses

- `400`: Empty or invalid field name, or a metrics dataset.
- `403`: Forbidden
- `404`: Not found
- `409`: The field is already a map field.

## Changes

- **2026-10-16** (v2) `fbc1b8430feb`: 4 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `403`
  - added the non-success response with the status `404`
  - added the non-success response with the status `409`

[Operation history](https://skmtc.dev/axiom/apis/axiom-public-api/changes/datasets/:dataset_id/mapfields/post.md)

---

[API](https://skmtc.dev/axiom/apis/axiom-public-api.md) - [All operations](https://skmtc.dev/axiom/apis/axiom-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/axiom/apis/axiom-public-api/revisions/7e39a295e3ba?raw)
