翻篇收录说明
翻篇网页快照

Batch API - Exa

https://exa.ai/docs/batch/quickstart

最近抓取:2026-12-03 17:06:06(北京时间)

最近内容变化:2026-12-03 17:06:06(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Run Exa API requests asynchronously in batches.

正文摘录

The Batch API is available for Enterprise customers after Exa enables it for your team. Contact sales@exa.ai to discuss Enterprise access and enablement. The Batch API lets you submit many Exa API requests at once and retrieve their results later as a JSONL file. Instead of sending thousands of individual requests and managing rate limits and retries yourself, you send a single batch, poll its status, and download all the results in one file. Use it for offline enrichment, backfills, or any other job that does not need an immediate response. Full request and response schemas are in the API reference. The Batch API is in beta. Include the Exa-Beta: batches-2026-06-06 header on every request. Supported requests Each batch item must be a POST request to one of these routes: RouteUse case/searchRun Exa search requests asynchronously/agent/runsRun Exa Agent requests asynchronously Each item needs a batch-unique customId. The same customId is returned in the results file so you can map output rows back to your input data. Create a batch cURLcurl -s -X POST "https://api.exa.ai/batches" \ -H "Authorization: Bearer $EXA_API_KEY" \ -H "Exa-Beta: batches-2026-06-06" \ -H "Content-Type: application/json" \ -d '{ "requests": [ { "customId": "row-1", "method": "POST", "url": "/search", "body": { "query": "Latest AI infrastructure funding rounds" } }, { "customId": "row-2", "method": "POST", "url": "/agent/runs", "body": { "query": "Summarize recent vector database launches" } } ], "metadata": { "project": "weekly-digest" } }' The response contains the batch ID and initial status: Example response{ "id": "batch_01j7x9v0m2n4p6q8r0s2t4v6w8", "object": "batch", "status": "in_progress", "requestCounts": { "total": 2, "completed": 0, "failed": 0 }, "createdAt": "2026-06-06T12:00:00.000Z", "expiresAt": null, "endedAt": null, "resultsUrl": null, "metadata": { "project": "weekly-digest" } } Check status Poll the batch until it reaches a terminal status: cURLcurl -s "https://api.exa.ai/batches/batch_01j7x9v0m2n4p6q8r0s2t4v6w8" \ -H "Authorization: Bearer $EXA_API_KEY" \ -H "Exa-Beta: batches-2026-06-06" Batch statuses are: StatusMeaningin_progressThe batch is runningcompletedAll requests have finished and results are availablecancellingCancellation was requested and in-flight work is drainingcancelledThe batch was cancelledexpiredResults are no longer available When the batch completes, resultsUrl contains a download URL for the JSONL results file, and expiresAt is set to the end of the results retention window. resultsUrl is a short-lived presigned URL. Re-fetch the batch to get a fresh URL whenever you need to download results again. List batches cURLcurl -s "https://api.exa.ai/batches?limit=100" \ -H "Authorization: Bearer $EXA_API_KEY" \ -H "Exa-Beta: batches-2026-06-06" The response is cursor-paginated: data holds up to limit batches, and when hasMore is true, pass nextCursor as the cursor query parameter to fetch the next page. Pass status=completed to list only completed batches: curl -s "https://api.exa.ai/batches?status=completed" \ -H "Authorization: Bearer $EXA_API_KEY" \ -H "Exa-Beta: batches-2026-06-06" completed is the only supported value; any other value returns an error. Completed listings are ordered by expiry and use their own cursor, so keep sending status=completed on every page — completed and unfiltered cursors are not interchangeable. { "object": "list", "data": [], "hasMore": false, "nextCursor": null } Download results cURLcurl "$RESULTS_URL" -o results.jsonl Each JSONL line contains the original customId and either a response or an error: { "customId": "row-1", "response": { "statusCode": 200, "body": { "results": [] } } } { "customId": "row-2", "error": { "code": "API_ERROR", "message": "request failed" } } Cancel a batch cURLcurl -X POST "https://api.exa.ai/batches/batch_01j7x9v0m2n4p6q8r0s2t4v6w8/cancel" \ -H "Authorization: Bearer $EXA_API_KEY" \ -H "Exa-Beta: batches-2026-06-06" Delete a batch cURLcurl -X DELETE "https://api.exa.ai/batches/batch_01j7x9v0m2n4p6q8r0s2t4v6w8" \ -H "Authorization: Bearer $EXA_API_KEY" \ -H "Exa-Beta: batches-2026-06-06" Access To enable the Batch API for a team, contact sales@exa.ai.