API7 Docs
AISIX AI GatewayOpen-Source AISIX Gateway Admin APIGet Cache Policy by ID

Get Cache Policy by ID

GET /admin/v1/cache_policies/{id}

GET /admin/v1/cache_policies/{id}

Interactive request editor loads with JavaScript.

Authorization

AdminBearer
AuthorizationBearer <token>

Admin key from config.admin.admin_keys.

In: header

Path Parameters

id*string

Cache policy resource ID, as assigned by the active resource source (a UUIDv5 derived from the entry name in file mode; the etcd key's ID segment otherwise).

Response Body

application/json

application/json

application/json

application/json

curl -X GET "http://127.0.0.1:3001/admin/v1/cache_policies/6fdb4165-0970-47fb-9aa8-729f07889fd1"

OK

{
  "id": "string",
  "revision": 0,
  "value": {
    "applies_to": "all",
    "backend": "memory",
    "enabled": true,
    "name": "string",
    "purge_generation": 0,
    "scope": "api_key",
    "semantic": {
      "embedding_model": "string",
      "embedding_timeout_ms": 0,
      "max_entries": 1000,
      "threshold": 0
    },
    "ttl_seconds": 3600
  }
}
Complete operation details and schema variants

GET /admin/v1/cache_policies/{id}

Get Cache Policy by ID

Get a cache policy resource by ID.

Parameters

  • id (path, string, required): Cache policy resource ID, as assigned by the active resource source (a UUIDv5 derived from the entry name in file mode; the etcd key's ID segment otherwise).

Responses

  • 200: OK
  • id (string, required): Resource ID, as assigned by the active resource source.
  • revision (integer, required): Monotonic resource revision: the etcd mod_revision of the entry, or the load generation in file mode.
  • value (object, required): Stored cache policy configuration.
  • allOf variant 1
  • value.applies_to (string, optional): Free-form scope. Supports "all", "model:<name>", and "api_key:<id>". See parsed_applies_to.
  • value.backend (object, optional): Cache backend used for matching requests.
  • allOf variant 1
  • value.enabled (boolean, optional): When false, the cache gate skips this policy. Allows operators to stage a rule before enabling it.
  • value.name (string, required): Operator-facing name that surfaces in metric labels and cache headers.
  • value.purge_generation (integer, optional): Invalidation counter. Entries are readable only while their stored generation matches; a purge bumps this value, making every earlier entry unreachable at once. Managed by the purge operation — not set directly. Full-document updates must carry the current value forward: writing a lower (or omitted, i.e. 0) value re-exposes entries stored under that earlier generation until their TTL passes.
  • value.scope (object, optional): Sharing boundary for entries created under this policy: api_key (default) keeps entries private to the caller that created them; env shares them across the environment.
  • allOf variant 1
  • oneOf variant 1: Per API key
  • oneOf variant 2: Environment-wide
  • value.semantic (object, optional): Embedding-similarity matching. Absent: the policy matches exactly-identical requests only.
  • allOf variant 1
  • value.semantic.embedding_model (string, required): Name of the embedding model used to embed requests. The model must exist in the same environment and carry an embedding block; its dimensions value fixes the vector size for this policy's entries.
  • value.semantic.embedding_timeout_ms (integer, optional): Per-call deadline for the embedding request in milliseconds. 0 or absent disables the embedding-specific deadline. On timeout the request proceeds to the upstream uncached.
  • value.semantic.max_entries (integer, optional): Upper bound on stored entries for this policy on the memory backend; the oldest entry is evicted first. Shared backends bound growth by TTL instead and ignore this value. The ceiling keeps the per-request similarity scan and the per-policy vector memory bounded; workloads needing more entries belong on a shared backend.
  • value.semantic.threshold (number, required): Minimum cosine similarity for a stored entry to be served, in [0, 1]. Higher is stricter. Values below 0.9 noticeably increase wrong-answer risk for most embedding models.
  • value.ttl_seconds (integer, optional): Cache entry TTL in seconds.
  • 401: Missing or invalid admin key
  • error_msg (string, required): Human-readable error message.
  • 404: Resource not found Response fields (application/json): identical to GET /admin/v1/cache_policies/{id}, response 401 above.
  • 500: Configuration store operation failed Response fields (application/json): identical to GET /admin/v1/cache_policies/{id}, response 401 above.

cURL

curl -X GET 'http://127.0.0.1:3001/admin/v1/cache_policies/{id}'