Skip to Content
Launching the open-source gateway

List cached responses

POSThttps://api.respan.ai/api/caches/

API-key responses expose public cache keys; dashboard JWT responses may include internal numeric IDs.

Servers

https://api.respan.ai — Respan API Server

Authentication

RespanApiKey

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.

HTTP scheme: bearer; format: Respan API key.

Authorization: Bearer $RESPAN_API_KEY

Or:

DashboardJwt

Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.

HTTP scheme: bearer; format: Dashboard JWT.

Authorization: Bearer $RESPAN_DASHBOARD_JWT

Query parameters

Parameter Type Required Description and constraints
page integer Optional
Page number.
Minimum: 1
page_size integer Optional
Number of results to return per page. Maximum 1000.
Minimum: 1
Maximum: 1000

Request body

The request body is optional.

application/json

Field Type Requirement Description and constraints
$ object Optional body
—
filters object Optional
Each key is a field to filter on, and each value is a condition: {"<field>": {"operator": "<operator>", "value": [...]}}. A cached response must match every condition. To set two conditions on one field, such as a range, pass a list of conditions.

Operators: "" (equals, the default), not, in, not_in, lt, lte, gt, gte, contains, not_contains, icontains (ignores case), startswith, not_startswith, endswith, not_endswith, empty, not_empty. Put values in a list: "" and in match any of the listed values, and not and not_in match none of them. Other operators take one value; for empty and not_empty, send [""].

Fields: cache_key_by_org_uuid (the cache_key value the API returns), timestamp (when the response was cached), updated_at, and expiry_date. Send dates as ISO 8601 strings. Unsupported fields return a 400 error.

Example:

json<br />{<br /> "expiry_date": {"operator": "gte", "value": ["2026-10-01T00:00:00Z"]}<br />}<br />
Example: {"cache_key_by_org_uuid":{"operator":"","value":["cached_response_550e8400"]}}

OpenAPI request schema

{
  "type": "object",
  "properties": {
    "filters": {
      "type": "object",
      "description": "Each key is a field to filter on, and each value is a condition: `{\"<field>\": {\"operator\": \"<operator>\", \"value\": [...]}}`. A cached response must match every condition. To set two conditions on one field, such as a range, pass a list of conditions.\n\n**Operators:** `\"\"` (equals, the default), `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte`, `contains`, `not_contains`, `icontains` (ignores case), `startswith`, `not_startswith`, `endswith`, `not_endswith`, `empty`, `not_empty`. Put values in a list: `\"\"` and `in` match any of the listed values, and `not` and `not_in` match none of them. Other operators take one value; for `empty` and `not_empty`, send `[\"\"]`.\n\n**Fields:** `cache_key_by_org_uuid` (the `cache_key` value the API returns), `timestamp` (when the response was cached), `updated_at`, and `expiry_date`. Send dates as ISO 8601 strings. Unsupported fields return a 400 error.\n\n**Example:**\n\n```json\n{\n  \"expiry_date\": {\"operator\": \"gte\", \"value\": [\"2026-10-01T00:00:00Z\"]}\n}\n```",
      "example": {
        "cache_key_by_org_uuid": {
          "operator": "",
          "value": [
            "cached_response_550e8400"
          ]
        }
      }
    }
  }
}

Responses

200

Filtered cached responses plus aggregate cache savings.

application/json

Field Type Requirement Description and constraints
$ object Body
Example: {"summary":{"total_cost":12.5,"total_hit_count":1042,"total_tokens":250000,"total_time":3600.5},"data":{"count":1,"next":null,"previous":null,"current_filters":{},"results":[{"id":123,"cache_key":"cached_response_550e8400-e29b-41d4_abc123def456","prompt_content":"What is the capital of France?","response_content":"The capital of France is Paris.","hit_count":42,"timestamp":"2026-04-10T12:00:00Z","updated_at":"2026-04-10T12:00:00Z","expiry_date":"2026-05-10T12:00:00Z"}]}}
summary object Required in parent
—
summary.total_cost number Required in parent
Estimated total cost saved by cache hits in the current organization.
Example: 12.5
summary.total_hit_count integer Required in parent
Total number of cache hits recorded for the current organization.
Example: 1042
summary.total_tokens integer Required in parent
Estimated total tokens saved by cache hits.
Example: 250000
summary.total_time number Required in parent
Estimated total latency saved in seconds.
Example: 3600.5
data object Required in parent
—
data.count integer Required in parent
Number of cache entries returned on this page.
Example: 15
data.next string or null Optional
URL for the next page, if any.
data.previous string or null Optional
URL for the previous page, if any.
data.current_filters object Optional
Normalized filter state returned by the paginator when filters are applied.
Example: {}
data.results array<object> Required in parent
Cached response entries for the current page.
data.results[] object Array item
—
data.results[].id integer Optional
Internal numeric ID. Present only for dashboard-JWT responses.
Example: 123
data.results[].cache_key string Required in parent
Unique cache key for this cached response.
Example: "cached_response_550e8400-e29b-41d4_abc123def456"
data.results[].prompt_content string Required in parent
Prompt text extracted from the cached request.
Example: "What is the capital of France?"
data.results[].response_content string Required in parent
Response text extracted from the cached response.
Example: "The capital of France is Paris."
data.results[].hit_count integer Required in parent
Live cache hit count enriched from ClickHouse. Defaults to 0 if unavailable.
Example: 42
data.results[].timestamp string Required in parent
When the cache entry was created.
Format: date-time
Example: "2026-04-10T12:00:00Z"
data.results[].updated_at string Required in parent
When the cache entry was last updated.
Format: date-time
Example: "2026-04-10T12:00:00Z"
data.results[].expiry_date string or null Optional
When the cache entry expires. null means no expiry date is set.
Format: date-time
Example: "2026-05-10T12:00:00Z"

OpenAPI response schema

{
  "type": "object",
  "required": [
    "summary",
    "data"
  ],
  "properties": {
    "summary": {
      "type": "object",
      "required": [
        "total_cost",
        "total_hit_count",
        "total_tokens",
        "total_time"
      ],
      "properties": {
        "total_cost": {
          "type": "number",
          "description": "Estimated total cost saved by cache hits in the current organization.",
          "example": 12.5
        },
        "total_hit_count": {
          "type": "integer",
          "description": "Total number of cache hits recorded for the current organization.",
          "example": 1042
        },
        "total_tokens": {
          "type": "integer",
          "description": "Estimated total tokens saved by cache hits.",
          "example": 250000
        },
        "total_time": {
          "type": "number",
          "description": "Estimated total latency saved in seconds.",
          "example": 3600.5
        }
      }
    },
    "data": {
      "type": "object",
      "required": [
        "count",
        "results"
      ],
      "properties": {
        "count": {
          "type": "integer",
          "description": "Number of cache entries returned on this page.",
          "example": 15
        },
        "next": {
          "type": "string",
          "nullable": true,
          "description": "URL for the next page, if any."
        },
        "previous": {
          "type": "string",
          "nullable": true,
          "description": "URL for the previous page, if any."
        },
        "current_filters": {
          "type": "object",
          "description": "Normalized filter state returned by the paginator when filters are applied.",
          "example": {}
        },
        "results": {
          "type": "array",
          "description": "Cached response entries for the current page.",
          "items": {
            "type": "object",
            "required": [
              "cache_key",
              "prompt_content",
              "response_content",
              "hit_count",
              "timestamp",
              "updated_at"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "description": "Internal numeric ID. Present only for dashboard-JWT responses.",
                "example": 123
              },
              "cache_key": {
                "type": "string",
                "description": "Unique cache key for this cached response.",
                "example": "cached_response_550e8400-e29b-41d4_abc123def456"
              },
              "prompt_content": {
                "type": "string",
                "description": "Prompt text extracted from the cached request.",
                "example": "What is the capital of France?"
              },
              "response_content": {
                "type": "string",
                "description": "Response text extracted from the cached response.",
                "example": "The capital of France is Paris."
              },
              "hit_count": {
                "type": "integer",
                "description": "Live cache hit count enriched from ClickHouse. Defaults to 0 if unavailable.",
                "example": 42
              },
              "timestamp": {
                "type": "string",
                "format": "date-time",
                "description": "When the cache entry was created.",
                "example": "2026-04-10T12:00:00Z"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time",
                "description": "When the cache entry was last updated.",
                "example": "2026-04-10T12:00:00Z"
              },
              "expiry_date": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "description": "When the cache entry expires. `null` means no expiry date is set.",
                "example": "2026-05-10T12:00:00Z"
              }
            }
          }
        }
      }
    }
  },
  "example": {
    "summary": {
      "total_cost": 12.5,
      "total_hit_count": 1042,
      "total_tokens": 250000,
      "total_time": 3600.5
    },
    "data": {
      "count": 1,
      "next": null,
      "previous": null,
      "current_filters": {},
      "results": [
        {
          "id": 123,
          "cache_key": "cached_response_550e8400-e29b-41d4_abc123def456",
          "prompt_content": "What is the capital of France?",
          "response_content": "The capital of France is Paris.",
          "hit_count": 42,
          "timestamp": "2026-04-10T12:00:00Z",
          "updated_at": "2026-04-10T12:00:00Z",
          "expiry_date": "2026-05-10T12:00:00Z"
        }
      ]
    }
  }
}

400

Bad Request

application/json

Field Type Requirement Description and constraints
$ object Body
—
error string Optional
—

OpenAPI response schema

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    }
  }
}
Example
{ "error": "Invalid filters" }

403

The API key is missing, invalid or expired.

application/json

Field Type Requirement Description and constraints
$ object Body
—
detail string Required in parent
—

OpenAPI response schema

{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
Example
{ "detail": "Your API key is invalid or expired, please check your API key in the platform settings." }

OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

OpenAPI operation

{
  "summary": "List cached responses",
  "operationId": "filterCachedResponses",
  "tags": [
    "Caches"
  ],
  "description": "API-key responses expose public cache keys; dashboard JWT responses may include internal numeric IDs.",
  "parameters": [
    {
      "name": "page",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1
      },
      "description": "Page number."
    },
    {
      "name": "page_size",
      "in": "query",
      "required": false,
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 1000
      },
      "description": "Number of results to return per page. Maximum 1000."
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "filters": {
              "type": "object",
              "description": "Each key is a field to filter on, and each value is a condition: `{\"<field>\": {\"operator\": \"<operator>\", \"value\": [...]}}`. A cached response must match every condition. To set two conditions on one field, such as a range, pass a list of conditions.\n\n**Operators:** `\"\"` (equals, the default), `not`, `in`, `not_in`, `lt`, `lte`, `gt`, `gte`, `contains`, `not_contains`, `icontains` (ignores case), `startswith`, `not_startswith`, `endswith`, `not_endswith`, `empty`, `not_empty`. Put values in a list: `\"\"` and `in` match any of the listed values, and `not` and `not_in` match none of them. Other operators take one value; for `empty` and `not_empty`, send `[\"\"]`.\n\n**Fields:** `cache_key_by_org_uuid` (the `cache_key` value the API returns), `timestamp` (when the response was cached), `updated_at`, and `expiry_date`. Send dates as ISO 8601 strings. Unsupported fields return a 400 error.\n\n**Example:**\n\n```json\n{\n  \"expiry_date\": {\"operator\": \"gte\", \"value\": [\"2026-10-01T00:00:00Z\"]}\n}\n```",
              "example": {
                "cache_key_by_org_uuid": {
                  "operator": "",
                  "value": [
                    "cached_response_550e8400"
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Filtered cached responses plus aggregate cache savings.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "summary",
              "data"
            ],
            "properties": {
              "summary": {
                "type": "object",
                "required": [
                  "total_cost",
                  "total_hit_count",
                  "total_tokens",
                  "total_time"
                ],
                "properties": {
                  "total_cost": {
                    "type": "number",
                    "description": "Estimated total cost saved by cache hits in the current organization.",
                    "example": 12.5
                  },
                  "total_hit_count": {
                    "type": "integer",
                    "description": "Total number of cache hits recorded for the current organization.",
                    "example": 1042
                  },
                  "total_tokens": {
                    "type": "integer",
                    "description": "Estimated total tokens saved by cache hits.",
                    "example": 250000
                  },
                  "total_time": {
                    "type": "number",
                    "description": "Estimated total latency saved in seconds.",
                    "example": 3600.5
                  }
                }
              },
              "data": {
                "type": "object",
                "required": [
                  "count",
                  "results"
                ],
                "properties": {
                  "count": {
                    "type": "integer",
                    "description": "Number of cache entries returned on this page.",
                    "example": 15
                  },
                  "next": {
                    "type": "string",
                    "nullable": true,
                    "description": "URL for the next page, if any."
                  },
                  "previous": {
                    "type": "string",
                    "nullable": true,
                    "description": "URL for the previous page, if any."
                  },
                  "current_filters": {
                    "type": "object",
                    "description": "Normalized filter state returned by the paginator when filters are applied.",
                    "example": {}
                  },
                  "results": {
                    "type": "array",
                    "description": "Cached response entries for the current page.",
                    "items": {
                      "type": "object",
                      "required": [
                        "cache_key",
                        "prompt_content",
                        "response_content",
                        "hit_count",
                        "timestamp",
                        "updated_at"
                      ],
                      "properties": {
                        "id": {
                          "type": "integer",
                          "description": "Internal numeric ID. Present only for dashboard-JWT responses.",
                          "example": 123
                        },
                        "cache_key": {
                          "type": "string",
                          "description": "Unique cache key for this cached response.",
                          "example": "cached_response_550e8400-e29b-41d4_abc123def456"
                        },
                        "prompt_content": {
                          "type": "string",
                          "description": "Prompt text extracted from the cached request.",
                          "example": "What is the capital of France?"
                        },
                        "response_content": {
                          "type": "string",
                          "description": "Response text extracted from the cached response.",
                          "example": "The capital of France is Paris."
                        },
                        "hit_count": {
                          "type": "integer",
                          "description": "Live cache hit count enriched from ClickHouse. Defaults to 0 if unavailable.",
                          "example": 42
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time",
                          "description": "When the cache entry was created.",
                          "example": "2026-04-10T12:00:00Z"
                        },
                        "updated_at": {
                          "type": "string",
                          "format": "date-time",
                          "description": "When the cache entry was last updated.",
                          "example": "2026-04-10T12:00:00Z"
                        },
                        "expiry_date": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true,
                          "description": "When the cache entry expires. `null` means no expiry date is set.",
                          "example": "2026-05-10T12:00:00Z"
                        }
                      }
                    }
                  }
                }
              }
            },
            "example": {
              "summary": {
                "total_cost": 12.5,
                "total_hit_count": 1042,
                "total_tokens": 250000,
                "total_time": 3600.5
              },
              "data": {
                "count": 1,
                "next": null,
                "previous": null,
                "current_filters": {},
                "results": [
                  {
                    "id": 123,
                    "cache_key": "cached_response_550e8400-e29b-41d4_abc123def456",
                    "prompt_content": "What is the capital of France?",
                    "response_content": "The capital of France is Paris.",
                    "hit_count": 42,
                    "timestamp": "2026-04-10T12:00:00Z",
                    "updated_at": "2026-04-10T12:00:00Z",
                    "expiry_date": "2026-05-10T12:00:00Z"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Bad Request",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string"
              }
            }
          },
          "example": {
            "error": "Invalid filters"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/InvalidApiKey"
    }
  },
  "security": [
    {
      "RespanApiKey": []
    },
    {
      "DashboardJwt": []
    }
  ]
}

OpenAPI path metadata

{}

Referenced OpenAPI components

{
  "responses": {
    "InvalidApiKey": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  },
  "securitySchemes": {
    "DashboardJwt": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Dashboard JWT",
      "description": "Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.",
      "x-fern-bearer": {
        "name": "dashboardJwt",
        "env": "RESPAN_DASHBOARD_JWT"
      }
    },
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}