# PayWeave Retrieval Rerank

> PayWeave Retrieval Rerank is a paid API for AI agents from retrieval.payweave.services, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Reranks a list of candidate documents by relevance to a search query using Cloudflare Workers AI

## Facts

- Endpoint: POST https://retrieval.payweave.services/rerank
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/payweave-retrieval-rerank-65411d9c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_1iQ7rYE_e1oYXzFrtIyRn

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability payweave-retrieval-rerank-65411d9c -d '<json body>'
```

Example prompt: I have a user query 'what are the side effects of ibuprofen' and 20 candidate passages I pulled from a knowledge base — can you rerank them by relevance to the query and return just the top 5?

## When to prefer this

Use this endpoint when you need a pay-per-call, low-cost reranker backed by Cloudflare's global edge network without managing your own infrastructure. Ideal for RAG pipelines needing fast cross-encoder style reranking of up to 50 candidate passages. Prefer this over embedding-only similarity when you need a more accurate relevance signal for a specific query.

## Known failure modes

- More than 50 documents submitted — API rejects with validation error
- Query or individual document exceeds 2000 characters — truncation or rejection
- Empty documents array — required field missing, 400 error
- Service unavailable on Cloudflare Workers AI backend — 5xx response
- Payment not included or insufficient — 402 Payment Required response

## How this service works

Text embeddings and reranking on Cloudflare Workers AI.

## Output

An array of documents ordered by descending relevance score, each including the original document text, its index in the input array, and a numerical relevance score — making it easy to identify and extract the most relevant results.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "query",
  "documents"
 ],
 "properties": {
  "query": {
   "type": "string",
   "description": "The search query. Up to 2000 characters."
  },
  "top_k": {
   "type": "integer",
   "description": "Return only the top K highest-scoring documents. Defaults to all, ranked."
  },
  "documents": {
   "type": "array",
   "description": "Candidate documents to score against the query. 1-50 items, each up to 2000 characters."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "results"
 ],
 "properties": {
  "results": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "index",
     "score",
     "document"
    ],
    "properties": {
     "index": {
      "type": "integer",
      "minimum": 0,
      "description": "Index into the input `documents` array"
     },
     "score": {
      "type": "number",
      "description": "Relevance score; higher is more relevant"
     },
     "document": {
      "type": "string",
      "description": "The document text at `index`"
     }
    },
    "additionalProperties": false
   },
   "description": "Documents ordered by descending relevance score"
  }
 },
 "description": "Reranked documents",
 "additionalProperties": false
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/payweave-retrieval-rerank-65411d9c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from retrieval.payweave.services](https://www.zero.xyz/host/retrieval.payweave.services/llms.txt)
