/case-lookup/orders/downloadDownload Case Order
Returns a link to ONE order's document - the same answer for every court.
Overview
Returns a link to ONE order's document - the same answer for every court. Pass the searchId a prior POST /case-lookup call returned and the orderId (from that response's orders[]). The url is a short-lived (5 minutes) signed link to CasePrimus's own private storage, generated fresh on every call - never store it. Requires case.write. The order also appears in the account's Downloads panel.
The document is the court's order with a CasePrimus provenance strip down the left margin of every page: CasePrimus, the case, when it was retrieved, a reference (CP-...) that identifies the retrieval in CasePrimus's records, and a plain statement that it is not a certified copy. Nothing else on the page is changed.
District Court orders, and orders already downloaded, answer at once. For every other court (High Court, Supreme Court, consumer commissions, NCLT, NCLAT, GSTAT, DRT, DRAT, CESTAT) the document can only be fetched inside a court-site session, so it is downloaded by a background function and this call waits for it (up to 55 seconds; a failed court search is retried a few times automatically). You never get a job to poll from this endpoint: you get the url, or an error.
Errors: 503 ORDER_DOWNLOAD_NOT_READY (with Retry-After) if the court download is still running after 55 seconds - send the SAME request again; it joins the download that is already running, so nothing is fetched or charged twice. 422 ORDER_DOWNLOAD_FAILED if the court has no document for the order (details.reason says why). 404 ORDER_NOT_FOUND if the orderId is not one of that case's orders.
Billing: for District Court one order-download unit is counted per request; for the other courts a unit is counted only when the order is actually delivered, and asking again for an order already downloaded is not counted again.
X-CasePrimus-Api-Key header. See Authentication for how to create a key, and Rate limits & errors for how requests are counted.Request body
| Field | Description |
|---|---|
searchIdstring Required | |
orderIdstring Required |
{
"searchId": "CPCSH0exampledemo0001",
"orderId": "a1b2c3d4e5f6"
}Example request
Replace CASEPRIMUS_API_KEY with your key.
BASE="https://api.caseprimus.ai/api/caseprimus/v1" curl -X POST "$BASE/case-lookup/orders/download" \ -H "X-CasePrimus-Api-Key: $CASEPRIMUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "searchId": "CPCSH0exampledemo0001", "orderId": "a1b2c3d4e5f6" }'
const BASE = "https://api.caseprimus.ai/api/caseprimus/v1"; const res = await fetch(BASE + "/case-lookup/orders/download", { method: "POST", headers: { "Content-Type": "application/json", "X-CasePrimus-Api-Key": process.env.CASEPRIMUS_API_KEY, }, body: JSON.stringify({ "searchId": "CPCSH0exampledemo0001", "orderId": "a1b2c3d4e5f6" }), }); const data = await res.json();
import os import requests BASE = "https://api.caseprimus.ai/api/caseprimus/v1" res = requests.request( "POST", BASE + "/case-lookup/orders/download", headers={"X-CasePrimus-Api-Key": os.environ["CASEPRIMUS_API_KEY"]}, json={ "searchId": "CPCSH0exampledemo0001", "orderId": "a1b2c3d4e5f6", }, ) data = res.json()
Responses
| Field | Description |
|---|---|
orderIdstring | |
urlstring | Signed link, valid for 5 minutes. Never store it. |
{
"orderId": "a1b2c3d4e5f6",
"url": "https://files.example.com/dlct010012342020-9f8e7d6c5b4a.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=300&X-Amz-Signature=..."
}{
"httpStatusCode": 400,
"code": 60436,
"message": "This search record does not exist",
"appError": true
}{
"httpStatusCode": 404,
"code": 60434,
"message": "No matching order was found for the number and date provided",
"appError": true
}{
"httpStatusCode": 422,
"code": 60433,
"message": "Could not download this order right now, please try again shortly",
"appError": true,
"details": {
"reason": "The court site did not provide a document for this order"
}
}{
"httpStatusCode": 503,
"code": 61469,
"message": "This order is still being downloaded from the court. Send the same request again in a few seconds - nothing is charged until it is delivered",
"appError": true,
"details": {
"retryAfterSeconds": 5
}
}Error responses share one shape, listed on Rate limits & errors.