---
type: api
title: Update field metadata
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-updatefieldsmetadatadefault
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-updatefieldsmetadatadefault
products:
  - Kibana
---

# Update field metadata

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/data_views/data_view/{viewId}/fields`
- `POST` `/s/{space_id}/api/data_views/data_view/{viewId}/fields`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#basicauth)

#### Path Parameters

- `viewId` (string)
  An identifier for the data view.

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Update field metadata for a data view. Use this endpoint to set custom labels, custom descriptions, and format overrides for individual fields.

## Request Body

`application/json`

- `fields` (object) — required
  The field object.

## Responses

#### `200`

Indicates a successful call.

`application/json`

- `acknowledged` (boolean)
#### `400`

Bad request

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (number)
## Code Examples

#### Console

```console
POST kbn://api/data_views/data_view/{viewId}/fields
{"fields":{"field_name":{"customLabel":"My custom label"}}}
```

#### curl

```curl
curl \
  -X POST "${KIBANA_URL}/api/data_views/data_view/${DATA_VIEW_ID}/fields" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{"fields":{"field_name":{"customLabel":"My custom label"}}}'
```

## Response Examples

#### Field metadata was updated successfully.

The acknowledged flag confirms that the field metadata changes were applied to the data view.

```json
{
  "acknowledged": true
}
```

#### A bad request response.

The request was rejected because the payload or query parameters are missing required fields or contain invalid values.

```json
{
  "error": "Bad Request",
  "message": "[request body.data_view.title]: expected value of type [string] but got [undefined]",
  "statusCode": 400
}
```

