For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Contact usJoin our Discord
HomeAdministration & GovernanceDevelopment and IntegrationAgent ForgeAPI ReferenceSDK Docs
HomeAdministration & GovernanceDevelopment and IntegrationAgent ForgeAPI ReferenceSDK Docs
  • API Reference
    • POSTResponses
    • POSTChat Completions
    • POSTCompletions
    • POSTEmbeddings
    • POSTAudio Transcription
    • POSTDocuments Extract
    • POSTRerank
    • POSTTokenize
    • POSTDetokenize
    • POSTFactuality
    • POSTInjection
    • POSTPII
    • POSTToxicity
    • GETModels
    • GETMCP Servers
    • GETMCP Tools
  • Valid Inputs
    • Enumerations for API
LogoLogo
Contact usJoin our Discord
API Reference

Rerank

POST
https://{your-pg.api-domain}.com/rerank
POST
/rerank
$curl -X POST https://{your-pg.api-domain}.com/rerank \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "model": "bge-reranker-v2-m3",
> "query": "What is Deep Learning?",
> "documents": [
> "Deep Learning is pizza.",
> "Deep Learning is not pizza."
> ],
> "return_documents": true
>}'
1{
2 "id": "rerank-39bf1cf3-66cd-43d5-9185-b52baf742414",
3 "object": "list",
4 "created": 1732039610,
5 "model": "bge-reranker-v2-m3",
6 "results": [
7 {
8 "index": 0,
9 "relevance_score": 0.25128007,
10 "text": "Deep Learning is not pizza."
11 },
12 {
13 "index": 1,
14 "relevance_score": 0.5100618,
15 "text": "Deep Learning is not pizza."
16 }
17 ]
18}
Rerank sorts text inputs by semantic relevance to a specified query.
Was this page helpful?
Previous

Tokenize

Next
Built with

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
modelstringRequired
The model to use for reranking.
querystringRequired
The query to rank against.
documentslist of stringsRequired
Array of documents to rank.
return_documentsbooleanOptional
Boolean setting whether to return documents in output.

Response

Successful response.
idstring
Unique ID for the rerank response.
objectstring

Type of object (list).

createdinteger
Timestamp of when the rerank response was created.
modelstring
The rerank model used.
resultslist of objects
The set of rankings.

Errors

400
Bad Request Error
403
Forbidden Error