---
title: "Kv Set"
method: POST
path: "/api/v1.kv.set"
tags: ["Key Value Store"]
---

# Kv Set

`POST /api/v1.kv.set`

KV Set

## Request body

- KvSetIn
  - `namespace` string, nullable
  - `key` string, required
  - `value` integer[], required
  - `ttl_ms` integer, nullable — Time to live in milliseconds
  - `behavior` 'upsert' | 'insert' | 'update'
  - `version` integer, nullable — If set, the write only succeeds when the stored version matches this value. Use the `version` field from a prior `get` response.

## Response `200`

- KvSetOut
  - `success` boolean, required — Whether the operation succeeded or was a noop due to pre-conditions.
  - `version` integer, required

## Other responses

- `400`
- `401`
- `403`
- `422`

## Changes

- **2026-03-31** `f62be26d2a53` — 6 breaking, 4 warning, 4 info
  - the `detail` response's property type changed from `string` to `array` for status `422`
  - removed the required property `code` from the response with the `422` status
  - removed the required property `type` from the response with the `400` status
  - removed the required property `type` from the response with the `401` status
  - …10 more

[Change history](https://skmtc.dev/svix/apis/diom-api/changes/api/v1.kv.set/post.md)

---

[API](https://skmtc.dev/svix/apis/diom-api.md) · [All operations](https://skmtc.dev/svix/apis/diom-api/llms.txt) · [OpenAPI document](https://skmtc.dev/svix/apis/diom-api/revisions/8128e16dd64a?raw)
