> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://respan.ai/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://respan.ai/docs/_mcp/server.

# List cached responses

POST https://api.respan.ai/api/caches/
Content-Type: application/json

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

Reference: https://respan.ai/docs/apis/caches/list-cached-responses

## Authentication

- `Authorization` header (bearer token, required) — 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.
- `Authorization` header (bearer token, required) — Use a dashboard JWT only for dashboard-authenticated endpoints. Respan API-key endpoints use the respanApiKey auth field instead.

## Request

### Query parameters

- `page` (integer, optional) — Page number.
- `page_size` (integer, optional) — Number of results to return per page. Maximum 1000.

### Body (application/json)

This endpoint expects an object.

- `filters` (ApiCachesPostRequestBodyContentApplicationJsonSchemaFilters, 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 { "expiry_date": {"operator": "gte", "value": ["2026-10-01T00:00:00Z"]} } ```

## Response

### 200

Filtered cached responses plus aggregate cache savings.

- `summary` (ApiCachesPostResponsesContentApplicationJsonSchemaSummary, required)
- `data` (ApiCachesPostResponsesContentApplicationJsonSchemaData, required)

## Errors

### 400 Bad Request Error

Bad Request

- `error` (string, optional)

### 403 Forbidden Error

The API key is missing, invalid or expired.

- `detail` (string, required)

## Types

### ApiCachesPostRequestBodyContentApplicationJsonSchemaFilters

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 { "expiry_date": {"operator": "gte", "value": ["2026-10-01T00:00:00Z"]} } ```

### ApiCachesPostResponsesContentApplicationJsonSchemaSummary

- `total_cost` (double, required) — Estimated total cost saved by cache hits in the current organization.
- `total_hit_count` (integer, required) — Total number of cache hits recorded for the current organization.
- `total_tokens` (integer, required) — Estimated total tokens saved by cache hits.
- `total_time` (double, required) — Estimated total latency saved in seconds.

### ApiCachesPostResponsesContentApplicationJsonSchemaData

- `count` (integer, required) — Number of cache entries returned on this page.
- `results` (list of ApiCachesPostResponsesContentApplicationJsonSchemaDataResultsItems, required) — Cached response entries for the current page.
- `next` (string, optional, nullable) — URL for the next page, if any.
- `previous` (string, optional, nullable) — URL for the previous page, if any.
- `current_filters` (ApiCachesPostResponsesContentApplicationJsonSchemaDataCurrentFilters, optional) — Normalized filter state returned by the paginator when filters are applied.

### ApiCachesPostResponsesContentApplicationJsonSchemaDataResultsItems

- `cache_key` (string, required) — Unique cache key for this cached response.
- `prompt_content` (string, required) — Prompt text extracted from the cached request.
- `response_content` (string, required) — Response text extracted from the cached response.
- `hit_count` (integer, required) — Live cache hit count enriched from ClickHouse. Defaults to 0 if unavailable.
- `timestamp` (datetime, required) — When the cache entry was created.
- `updated_at` (datetime, required) — When the cache entry was last updated.
- `id` (integer, optional) — Internal numeric ID. Present only for dashboard-JWT responses.
- `expiry_date` (datetime, optional, nullable) — When the cache entry expires. `null` means no expiry date is set.

### ApiCachesPostResponsesContentApplicationJsonSchemaDataCurrentFilters

Normalized filter state returned by the paginator when filters are applied.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "summary": {
    "total_cost": 12.5,
    "total_hit_count": 1042,
    "total_tokens": 250000,
    "total_time": 3600.5
  },
  "data": {
    "count": 1,
    "results": [
      {
        "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",
        "id": 123,
        "expiry_date": "2026-05-10T12:00:00Z"
      }
    ],
    "next": null,
    "previous": null,
    "current_filters": {}
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.respan.ai/api/caches/"

payload = {}
headers = {
    "Authorization": "Bearer <respanApiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.respan.ai/api/caches/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <respanApiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.respan.ai/api/caches/"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <respanApiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.respan.ai/api/caches/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <respanApiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.respan.ai/api/caches/")
  .header("Authorization", "Bearer <respanApiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.respan.ai/api/caches/', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <respanApiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.respan.ai/api/caches/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <respanApiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <respanApiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.respan.ai/api/caches/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```