CasePrimus.aiby Attestr
Documentation menu
POST/case-lookup/orders/download

Download 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.

Auth API keyPermission case.writeContent-Type application/json
Send your API key in the X-CasePrimus-Api-Key header. See Authentication for how to create a key, and Rate limits & errors for how requests are counted.

Request body

FieldDescription
searchId
string
Required
orderId
string
Required
Body: Success: the link
{
  "searchId": "CPCSH0exampledemo0001",
  "orderId": "a1b2c3d4e5f6"
}

Example request

Replace CASEPRIMUS_API_KEY with your key.

Request
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"
  }'

Responses

200The order's document.
FieldDescription
orderId
string
url
string

Signed link, valid for 5 minutes. Never store it.

Response 200
{
  "orderId": "a1b2c3d4e5f6",
  "url": "https://files.example.com/dlct010012342020-9f8e7d6c5b4a.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Expires=300&X-Amz-Signature=..."
}
400Malformed input, this search record does not exist, or this court's orders cannot be downloaded right now.
Response 400
{
  "httpStatusCode": 400,
  "code": 60436,
  "message": "This search record does not exist",
  "appError": true
}
403Caller lacks the case.write permission.
404The orderId is not one of this case's orders.
Response 404
{
  "httpStatusCode": 404,
  "code": 60434,
  "message": "No matching order was found for the number and date provided",
  "appError": true
}
422The court has no document for this order (`details.reason`).
Response 422
{
  "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"
  }
}
503Still being downloaded after 55 seconds. Send the same request again (`Retry-After`).
Response 503
{
  "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.