---
title: "Modify a key-value or delete a key"
method: PATCH
path: "/http/keyvals/{httpKeyvalZoneName}"
tags: ["HTTP Keyvals", "Method PATCH"]
---

# Modify a key-value or delete a key

`PATCH /http/keyvals/{httpKeyvalZoneName}`

Changes the value of the selected key in the key-value pair, deletes a key by setting the key value to <literal>null</literal>, changes expiration time of a key-value pair. If <a href="https://nginx.org/en/docs/stream/ngx_stream_zone_sync_module.html#zone_sync">synchronization</a> of keyval zones in a cluster is enabled, deletes a key only on a target cluster node. Expiration time in milliseconds can be specified for a key-value pair with the *expire* parameter which overrides the [*timeout*](https://nginx.org/en/docs/http/ngx_http_keyval_module.html#keyval_timeout) parameter of the <a href="https://nginx.org/en/docs/http/ngx_http_keyval_module.html#keyval_zone">keyval_zone</a> directive.

## Request body

- NginxHTTPKeyvalZonePostPatch — Contents of an HTTP keyval shared memory zone when using the POST or PATCH methods.

## Response `204`

Success

## Other responses

- `400` — Invalid JSON (*KeyvalFormatError*), key required (*KeyvalFormatError*), keyval timeout is not enabled (*KeyvalFormatError*), only one key can be updated (*KeyvalFormatError*), reading request body failed *BodyReadError*)
- `404` — Keyval not found (*KeyvalNotFound*), keyval key not found (*KeyvalKeyNotFound*), unknown version (*UnknownVersion*)
- `405` — Method disabled (*MethodDisabled*)
- `413` — Request Entity Too Large
- `415` — JSON error (*JsonError*)

---

[API](https://skmtc.dev/nginx/apis/nginx-plus-rest-api.md) · [All operations](https://skmtc.dev/nginx/apis/nginx-plus-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nginx/nginx-plus-rest-api/revisions/533ae7834228/schema)
