---
title: "Create or update a runtime field"
method: PUT
path: "/api/data_views/data_view/{viewId}/runtime_field"
tags: ["data views"]
---

# Create or update a runtime field

`PUT /api/data_views/data_view/{viewId}/runtime_field`

**Spaces method and path for this operation:**

<div><span class="operation-verb put">put</span>&nbsp;<span class="operation-path">/s/{space_id}/api/data_views/data_view/{viewId}/runtime_field</span></div>

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

Create or update a runtime field for a data view. If the runtime field already exists, it is replaced with the new definition.

## Path parameters

- `viewId` string, required

## Headers

- `kbn-xsrf` string, required

## Request body

- object
  - `name` string, required — The name for a runtime field.
  - `runtimeField` object, required — The runtime field definition object.

## Response `200`

Indicates a successful call.

- object
  - `data_view` object
  - `fields` object[]

## Other responses

- `400` — Bad request

---

[API](https://skmtc.net/elastic/apis/kibana-apis.md) · [All operations](https://skmtc.net/elastic/apis/kibana-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/kibana-apis/versions/531c9e2a7d23/schema)
