Skip to main content
POST
Create a cache rule

Authorizations

X-Auth-Token
string
header
required

Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI.

Headers

Idempotency-Key
string

A caller-chosen key, 8 to 255 characters, that makes this create safe to retry. The first request to use a key runs normally and its response is stored for 24 hours. A later request with the same key and the same body is not executed again: it returns the stored response, marked with X-Idempotent-Replay: true. The same key with a different body is refused 409 idempotency_error, as is a retry sent while the original is still running. Only successful responses are stored, so a create that failed can simply be retried with the same key.

Required string length: 8 - 255

Body

application/json
name
string
required
Required string length: 1 - 128
matchers
object
required
action
object
required
description
string | null
Maximum string length: 512
priority
integer
Required range: 0 <= x <= 1000
enabled
boolean

Response

Created

cache_rule
object
required
Last modified on May 19, 2026