KV Store

Set a value with optional expiration

Changed on
post/kv/set

Request

  • Base URL
    /api (relative, and the document was published on a file host, not at the API’s origin)
  • 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, or result: null when an NX/XX condition did not hold

resultstring nullable

"OK" when the value was written; null when an NX/XX condition did not hold and the key was left unchanged (the Redis reply)

Example response

{
  "result": "OK"
}

Changes