---
title: "Set expiration on a key"
method: POST
path: "/kv/expire"
tags: ["KV Store"]
---

# Set expiration on a key

`POST /kv/expire`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/kv/expire`
- Auth: HTTP bearer

## Request body

- ExpireRequest: Request to set expiration on a key
  - `key` string, required: The key to set expiration on
  - `project_id` integer, nullable: Project ID (required for API key/session auth, optional for deployment tokens)
  - `seconds` integer, required: Expiration time in seconds

## Response `200`

Expiration set

- ExpireResponse: Response for expire operation
  - `success` boolean, required: True if expiration was set, false if key doesn't exist

## Other responses

- `401`: Unauthorized
- `500`: Internal server error

## Changes

- **2026-04-25** `774be20905f2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/kv/expire/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
