---
title: "Add a key-value pair to the HTTP keyval zone"
method: POST
path: "/http/keyvals/{httpKeyvalZoneName}"
tags: ["HTTP Keyvals", "Method POST"]
---

# Add a key-value pair to the HTTP keyval zone

`POST /http/keyvals/{httpKeyvalZoneName}`

Adds a new key-value pair to the HTTP keyval shared memory [zone](https://nginx.org/en/docs/http/ngx_http_keyval_module.html#keyval_zone). Several key-value pairs can be entered if the HTTP keyval shared memory zone is empty.

## Request body

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

## Response `201`

Created

## Other responses

- `400` — Invalid JSON (*KeyvalFormatError*), invalid key format (*KeyvalFormatError*), key required (*KeyvalFormatError*), keyval timeout is not enabled (*KeyvalFormatError*), only one key can be added (*KeyvalFormatError*), reading request body failed *BodyReadError*)
- `404` — Keyval not found (*KeyvalNotFound*), unknown version (*UnknownVersion*)
- `405` — Method disabled (*MethodDisabled*)
- `409` — Entry exists (*EntryExists*), key already exists (*KeyvalKeyExists*)
- `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)
