KV Store

Set a value with optional expiration

post/kv/set

Request

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

Request body

exinteger nullable

Expire in seconds

keystring required

The key to set

nxboolean

Only set if key does not exist

project_idinteger nullable

Project ID (required for API key/session auth, optional for deployment tokens)

pxinteger nullable

Expire in milliseconds

valueunknown required
xxboolean

Only set if key exists

Example request

{
  "ex": 3600,
  "key": "user:123",
  "project_id": 1
}

Response

Value set

resultstring required

Always "OK" on success

Example response

{
  "result": "OK"
}

Changes

No recorded changes to this operation across all 53 revisions of this API.