/historical-search/{searchId}/downloadDownload a completed asynchronous search
For an asynchronous search whose status is COMPLETE: a fresh link (valid for 15 minutes) to ONE JSON file with the whole result set - the search, its `resultCount`, any `warnings` and every result, in the same shape and order as the pages.
Overview
For an asynchronous search whose status is COMPLETE: a fresh link (valid for 15 minutes) to ONE JSON file with the whole result set - the search, its resultCount, any warnings and every result, in the same shape and order as the pages. Ask again for a new link any time within the 7 days the file is kept; downloading is free. Before COMPLETE the call returns 409; a synchronous search has no file (404). Requires historicalSearch.read.
X-CasePrimus-Api-Key header. See Authentication for how to create a key, and Rate limits & errors for how requests are counted.Parameters
| Name | In | Description |
|---|---|---|
searchIdstring Required | path | The id returned when the resource was created. |
Example request
Replace CASEPRIMUS_API_KEY with your key.
BASE="https://api.caseprimus.ai/api/caseprimus/v1" curl "$BASE/historical-search/SEARCH_ID/download" \ -H "X-CasePrimus-Api-Key: $CASEPRIMUS_API_KEY"
const BASE = "https://api.caseprimus.ai/api/caseprimus/v1"; const res = await fetch(BASE + "/historical-search/SEARCH_ID/download", { method: "GET", headers: { "X-CasePrimus-Api-Key": process.env.CASEPRIMUS_API_KEY, }, }); const data = await res.json();
import os import requests BASE = "https://api.caseprimus.ai/api/caseprimus/v1" res = requests.request( "GET", BASE + "/historical-search/SEARCH_ID/download", headers={"X-CasePrimus-Api-Key": os.environ["CASEPRIMUS_API_KEY"]}, ) data = res.json()
Responses
| Field | Description |
|---|---|
urlstring | Presigned link, valid for 15 minutes. |
expiresAtinteger | Epoch ms when the link stops working. |
formatenum | json |
resultCountinteger | |
sizeBytesinteger |
{
"url": "https://files.example.com/historical-search/CPA0example/CPHS0exampleasync01.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=900&X-Amz-Signature=...",
"expiresAt": 1791940500000,
"format": "json",
"resultCount": 1843,
"sizeBytes": 2764310
}{
"httpStatusCode": 404,
"code": 61468,
"message": "There is no download for this search: only a completed asynchronous search has one",
"appError": true
}{
"httpStatusCode": 404,
"code": 61449,
"message": "This search was not found",
"appError": true
}{
"httpStatusCode": 409,
"code": 61467,
"message": "This search is still being collected. Its results can be read once its status is COMPLETE",
"appError": true,
"details": {
"status": "RUNNING"
}
}Error responses share one shape, listed on Rate limits & errors.