Skip to main content
Menu
Build / Rerank
Build

Rerank

Order documents by relevance to a query with a model of kind rerank.

3 minute readUpdated 13 November 2026curl · Python · TypeScript

Rerank documents#

POST /v1/rerank scores each document for relevance to the query and returns the results ordered by score, each with the index of the document in your list.

No model of kind rerank is offered yet
The model catalog has no model of this kind today, so this endpoint answers 404 model_not_found for every model id. The samples below show the request for when one is offered.

Set PANWARD_RERANK_MODEL to the id of a model of kind rerank from the model catalog. An id that is not a canonical id answers 404 model_not_found.

cat > body.json <<EOF
{"model": "$PANWARD_RERANK_MODEL", "query": "Which note mentions a penicillin allergy?", "documents": ["Discharge note, ward 4: no known allergies.", "Referral letter: allergic to penicillin.", "Lab report: normal values."], "top_n": 2}
EOF

curl https://api.panward.ai/v1/rerank \
  -H "Authorization: Bearer $PANWARD_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @body.json

Request fields#

FieldRequiredValuesLimitsNotes
modelYesstringCanonical id of a model of kind `rerank`.
queryYesstring
documentsYesarray of stringmin items 1; max items 1000
top_nNointegermin 1Return only the best `top_n` results. Defaults to all documents.
return_documentsNobooleanInclude each document's text in the results.

Not part of the OpenAI API#

Rerank is a Panward addition, so the OpenAI SDKs have no call for it. Call it with plain HTTP, as above.

Receipts and billing#

The response carries the same headers as a chat completion, among them panward-receipt-id, panward-tier and panward-region, and the request has a receipt like any other (Receipts and verification). panward-hold-until-verified: true is accepted: the response waits until the verification level is known and the answer is 503 verification_unavailable instead of an unverified one.

Rerank is billed on input tokens.

Was this page helpful?Suggest an edit