Skip to main content
POST
Rerank documents
Use this endpoint to reorder candidate documents before they are passed to a search, retrieval, or generation step. Verify the model in GET /v1/models before deployment. The default response contains only models with a public Gateway route.

Authorizations

Authorization
string
header
required

Bearer token authentication

Body

application/json
model
string
required
query
string
required
documents
required
Minimum array length: 1
models
string[]

Optional ordered fallback models tried after model. model is required and is always the primary model. When an attempt fails with 429, 500, 502, 503, or 504, the next entry is tried; other errors are returned unchanged. Accepts up to 25 model IDs or presets; duplicates and entries equal to model are ignored. Each attempt is validated, logged, and billed as its own request, and the response model field and routing trace show the model that served the request. Streaming requests fall back only before the first byte, and video and music jobs fall back only at submission. Batch, realtime, and council requests reject models. Fallbacks set on a dynamic route take precedence, and phaseo/auto cannot be combined with models.

Required array length: 1 - 25 elements
Minimum string length: 1
Example:
top_n
integer
Required range: x >= 1
top_k
integer

Alias for top_n.

Required range: x >= 1
return_documents
boolean
max_chunks_per_doc
integer
Required range: x >= 1
rank_fields
string[]
user
string
metadata
object
provider_options
object
debug
object

Gateway debug controls. These flags are never forwarded upstream.

provider
object

Provider routing preferences for gateway selection.

Response

200 - application/json

Rerank response

object
string
id
string
nativeResponseId
string | null
model
string
results
object[]
usage
object
Last modified on October 18, 2026