PgBeam Docs
Projects

List cache rules

Returns the cache rules for a database, showing all observed query shapes with their stats and cache recommendations.

At a glance

ItemValue
MethodGET
Path/v1/projects/{project_id}/databases/{database_id}/cache-rules
AuthAuthorization: Bearer <token-or-api-key>

Quick request

Use this as a starting point. Replace the placeholder IDs and set PGBEAM_TOKEN if the endpoint requires auth.

curl -X GET \
  "$PGBEAM_API_URL/v1/projects/<project_id>/databases/<database_id>/cache-rules" \
  -H "Authorization: Bearer $PGBEAM_TOKEN"
GET
/v1/projects/{project_id}/databases/{database_id}/cache-rules
AuthorizationBearer <token>

JWT issued by Better Auth. Verified via JWKS.

In: header

Path Parameters

project_id*string

Unique project identifier (prefixed, e.g. prj_xxx).

Match^[a-zA-Z0-9_.-]+$
database_id*string

Unique database identifier (prefixed, e.g. db_xxx).

Match^[a-zA-Z0-9_.-]+$

Query Parameters

page_size?integer

Maximum number of items to return (1-100, default 20).

Default20
Range1 <= value <= 100
page_token?string

Opaque token for cursor-based pagination.

Match^[a-zA-Z0-9_.-]+$

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.pgbeam.com/v1/projects/string/databases/string/cache-rules"
{
  "entries": [
    {
      "query_hash": "a1b2c3d4e5f60718",
      "normalized_sql": "SELECT * FROM users WHERE id = $1",
      "query_type": "read",
      "cache_enabled": true,
      "cache_ttl_seconds": 0,
      "cache_swr_seconds": 0,
      "call_count": 0,
      "avg_latency_ms": 0.1,
      "p95_latency_ms": 0.1,
      "avg_response_bytes": 0,
      "stability_rate": 0.1,
      "recommendation": "great",
      "first_seen_at": "2019-08-24T14:15:22Z",
      "last_seen_at": "2019-08-24T14:15:22Z"
    }
  ],
  "next_page_token": "string"
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string"
  }
}