> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://respan.ai/docs/apis/caches/get-cached-response/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://respan.ai/_mcp/server. # Get a cached response GET https://api.respan.ai/api/caches/{cache_key}/ Retrieve a cached response by its organization-scoped cache key. API-key responses omit internal numeric IDs. Reference: https://respan.ai/docs/apis/caches/get-cached-response ## 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 \. 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 ### Path parameters - `cache_key` (string, required) — Organization-scoped cache key returned by the cache list endpoint. ## Response ### 200 Cached response details. - `cache_key` (string, required) — Organization-scoped public cache key. - `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. - `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. - `request_content` (string, optional) — Stored request text preview. The current backend serializer truncates this field to roughly the first 100 characters. - `prompt_messages` (list of ApiCachesCacheKeyGetResponsesContentApplicationJsonSchemaPromptMessagesItems, optional) — Original prompt message array stored with the cache entry. - `full_response` (ApiCachesCacheKeyGetResponsesContentApplicationJsonSchemaFullResponse, optional) — Full cached provider response object. - `response_time` (double, optional) — Stored response time for the cached entry, in seconds. - `expiry_date` (datetime, optional, nullable) — When the cache entry expires. `null` means no expiry date is set. ## Errors ### 403 Forbidden Error The API key is missing, invalid or expired. - `detail` (string, required) ### 404 Not Found Error Cached response not found. - `detail` (string, required) ## Types ### ApiCachesCacheKeyGetResponsesContentApplicationJsonSchemaPromptMessagesItems ### ApiCachesCacheKeyGetResponsesContentApplicationJsonSchemaFullResponse Full cached provider response object. ## Examples **Response** ```json { "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, "request_content": "What is the capital of France?", "prompt_messages": [ { "role": "user", "content": "What is the capital of France?" } ], "full_response": { "choices": [ { "message": { "role": "assistant", "content": "The capital of France is Paris." } } ] }, "response_time": 0.5, "expiry_date": "2026-05-10T12:00:00Z" } ``` **SDK Code** ```python import requests url = "https://api.respan.ai/api/caches/cache_key/" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.respan.ai/api/caches/cache_key/'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; 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" "net/http" "io" ) func main() { url := "https://api.respan.ai/api/caches/cache_key/" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") 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/cache_key/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.respan.ai/api/caches/cache_key/") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'https://api.respan.ai/api/caches/cache_key/', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.respan.ai/api/caches/cache_key/"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.respan.ai/api/caches/cache_key/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```