---
title: "Set a value by key."
method: POST
path: "/v1/kv/set"
tags: ["Key-Value"]
---

# Set a value by key.

`POST /v1/kv/set`

## Request

- Base URL: `https://api.scalix.world`
- URL: `https://api.scalix.world/v1/kv/set`
- Auth: HTTP bearer

Writes a value to the tenant's key-value store, with an optional TTL.

## Request body

- KvSetRequest: Set a key in the key-value store. The downstream kvstore accepts a JSON `value` of any shape; `ttl` is in seconds and optional.
  - `key` string, required
  - `value` object, required
  - `ttl` integer, nullable: Optional time-to-live in seconds.

## Response `200`

Value set

## Other responses

- `401`: Missing or invalid API key
- `500`: Internal error

---

[API](https://skmtc.dev/scalix/apis/scalix-cloud-api.md) · [All operations](https://skmtc.dev/scalix/apis/scalix-cloud-api/llms.txt) · [OpenAPI document](https://skmtc.dev/scalix/apis/scalix-cloud-api/revisions/2c04ca0a90bb?raw)
