---
title: "Create or overwrite a document"
method: PUT
path: "/v1/data/{path}"
tags: ["Data API"]
---

# Create or overwrite a document

`PUT /v1/data/{path}`

If the path does not refer to an existing document (for example *us-west/servers*), the server will attempt to create all the necessary containing documents.

This behavior is similar to the Unix command [mkdir -p](https://en.wikipedia.org/wiki/Mkdir#Options).

## Headers

- `If-None-Match` string

## Request body

- string

## Response `204`

Success

## Other responses

- `304` — Document was not modified
- `400` — Bad request
- `404` — Not found (for example, a requested policy module or document does not exist)
- `500` — Server error

---

[API](https://skmtc.net/open-policy-agent/apis/open-policy-agent-opa-rest-api.md) · [All operations](https://skmtc.net/open-policy-agent/apis/open-policy-agent-opa-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/open-policy-agent/open-policy-agent-opa-rest-api/revisions/47f6f2062932/schema)
