Learning resourcesReviewed · Perplexity

Perplexity Agent API Batch guide

The Perplexity Batch API guide teaches developers to process many AI requests in the background, but completion time is not guaranteed. It explains JSONL uploads, job monitoring, result downloads and failure handling, with Python, TypeScript and cURL examples. Files expire after 30 days, and organizations requiring zero data retention cannot use the service.

Researched 24 Nov 2026

In short.

The Perplexity Batch API guide helps developers build large background AI jobs, but its 24-hour completion target is not guaranteed. It documents a complete upload, submit, monitor and download process, including built-in web tools, partial failures, cancellation and billing. Pending requests expire after 48 hours, while running requests may continue. File retention excludes zero-data-retention organizations. Exact prices, observed performance and operational reliability are unknown; nothing was executed.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected page at [https://docs.perplexity.ai/docs/agent-api/batch.md], including examples, availability and retention notices, supported requests, output and error formats, lifecycle, cancellation, listings, limits, billing and errors. Linked pages, including the documentation index, models, pricing, usage tiers and API references, are excluded. No code or API requests were executed, and no operational results, benchmarks, charges or broader licence terms were verified.

The overview

identity

This is Perplexity's documentation for batching Agent API requests, available at [https://docs.perplexity.ai/docs/agent-api/batch.md]. It is a technical guide to an API feature, with examples using the Perplexity Python and TypeScript SDKs and direct HTTP requests.

The documented process uses the Files and Batch endpoints to submit requests to /v1/responses. The page identifies that endpoint as equivalent to /v1/agent for these requests. Batch files are separate from files an individual Agent API response can create.

assessment

The guide provides enough detail to plan an integration: input validation, submission, polling, output parsing, cancellation, expiry, limits and billing are all explained. Its strongest practical distinction is that a finished batch does not establish that every request succeeded.

It is a useful starting point for deferred AI processing when waiting hours is acceptable. It does not establish actual throughput, response quality, reliability or savings. Suitability depends especially on timing flexibility, permitted data retention and the tools each request needs.

users

The documented audience includes developers running evaluations, classification, enrichment or offline research across datasets. Each request can use the Agent API's tool loop, making the feature relevant to research jobs that need web access as well as text generation.

Beginners need some familiarity with API credentials, JSON and downloading files. Experienced developers get details for handling retries, partial results and organization limits. Interactive applications needing immediate answers and organizations with zero data retention are poor fits.

capabilities

A batch can contain up to 50,000 requests, all using the same model. Requests run the full Agent API loop, including built-in tools such as web_search and fetch_url. Fields including instructions, reasoning, response_format, max_steps and max_output_tokens remain available.

The API supports monitoring, cancellation, paginated batch and file listings, file downloads and file deletion. Results contain full Response objects that can also be retrieved individually using their response IDs. Batch execution requests do not count toward the Agent API request rate limit, although token limits still apply and requests hitting them are retried.

Using it

requirements

Use requires a Perplexity API organization, an API key and available API credits. Organizations with zero data retention are excluded. The examples read PERPLEXITY_API_KEY from the environment; the cURL examples also use jq. Required SDK versions and runtime versions are not specified.

Input must be UTF-8 JSONL: one JSON object per line, without an enclosing array, blank lines or duplicate JSON keys. Each request needs a unique custom_id of 1 to 64 bytes, method POST, url /v1/responses and a normal Agent API body. Every line must name the same model. The supported-model list is linked but its contents are outside this page.

mechanism

Upload the input file to /v1/files with purpose=batch, then create a batch referencing its file ID and endpoint /v1/responses. Upload validation checks every line before storage and rejects the entire upload at the first invalid line. Passing validation does not establish that requests will run successfully; an unknown model ID can still fail during execution.

The batch queues requests, runs them asynchronously and writes output and error files. Match results using custom_id because line order is not guaranteed. An output line can contain a completed, incomplete or failed response, so inspect response.body.status before accepting its content.

Final request_counts.completed counts output-file lines, including responses that are incomplete or failed. Requests without a result appear in the error file. Some error lines contain an HTTP error response with error set to null; others have response set to null and a batch error code.

setup

Prepare the JSONL file, upload it, save the file ID and create the batch. completion_window accepts only 24h and defaults to that value. Optional metadata can label the job. Poll until completed, expired, cancelled or failed; the guide recommends intervals of 30 to 60 seconds.

File and batch management endpoints use the organization's request rate limit, documented here as one request per second at tier 0. A polling response without status indicates an API error. Download both result files when present, handle an empty output file and preserve results before file expiry.

For batch-creation retries, an optional Idempotency-Key returns the original batch when reused with the same creation parameters within 24 hours. Use a different key for each new batch. Reusing a key with different input_file_id, endpoint or metadata returns 400.

example

The guide's walkthrough submits three short questions about France's capital, multiplication and the largest planet. Each JSONL line has its own custom_id, uses the same model and sets max_output_tokens to 200. The illustrated outputs are Paris, 144 and Jupiter. These are documentation examples, not independently observed results.

A suggested extension is an overnight classification job: assign a stable identifier to each record, use a shared model and response format, then reconcile every input against output and error files. This application follows the documented interface, but classification accuracy and processing time are not assessed.

Assessment & evidence

limitations

Completion within 24 hours is a target. At 48 hours, requests that have not started or are waiting for capacity expire, while requests already running continue and bill normally. An individual run can stop after 30 minutes with poll_timeout. The 48-hour deadline is therefore not a guaranteed time for receiving every final result.

Files are limited to 50,000 requests and 200 MB (209,715,200 bytes), with a 4 MB limit per line. Responses larger than 20 MB cannot be stored. Combined output and error files exceeding 8 GB cause the batch to fail. Organization limits for unfinished requests range from 50,000 at tier 0 to 1,000,000 at tier 6 and above.

Streaming is rejected, as are function, connector and advisor tools. MCP tools must omit require_approval or set it to never. The models field is unsupported, preset requires model, and background, store and service_tier fields are ignored.

Cancellation is supported only while validating or in_progress. Running requests can still finish briefly after cancellation, usually for up to about a minute, and incur charges. Completed output survives cancellation, but stopped requests can still incur charges for work already performed.

reasoning

The documented design suits workloads that can trade immediate answers for deferred processing: jobs are submitted together, processing avoids the ordinary Agent API request-rate allowance, and results can be reconciled using stable identifiers. Token limits and capacity constraints still prevent assuming unlimited throughput.

The central integration requirement is to separate batch completion from usable results. A final batch status, an output-file entry or a completed counter can coexist with individual failures or incomplete answers. The documentation supports planning this handling, but provides no measured basis for predicting accuracy, turnaround or savings.

alternatives

The page refers to normal Agent API requests and links to Background mode as adjacent options. Normal requests are relevant when a file-based batch is unnecessary. Background mode is identified at [https://docs.perplexity.ai/docs/agent-api/background-mode.md], but its behavior, limits and costs are not established by the supplied text.

The guide says its Batch and Files endpoints follow the shape of OpenAI's Batch API and identifies a difference in file-list pagination limits. That similarity does not establish complete compatibility or equivalent pricing, retention or reliability. No competing service was assessed.

evidence

The evidence is the complete Perplexity Batch API documentation page at [https://docs.perplexity.ai/docs/agent-api/batch.md]. It includes explanations, Python, TypeScript and cURL examples, sample responses, operational limits and billing rules.

The examples and responses establish what the documentation describes, not observed service behavior. Nothing was executed. Actual SDK compatibility, model availability, request success, performance, billing and deletion behavior remain untested. Linked model lists, pricing details, API references and other documentation pages are outside the evidence.

Access & freshness

costs

The page states that there is no separate batch price. OpenAI models use flex where the model supports it; other models use their normal standard tier. Starting 20 to 24 hours after batch creation, requests that start or resume use the standard tier. Tokens are billed according to the tier serving each step, and tool calls retain their normal charges. Exact monetary rates and total job cost are unknown from this page.

Requests that never start or expire are not billed. Completed requests and work already performed before cancellation can be billed. The batch usage field sums token usage only for requests in the output file and is not a complete bill.

Without a request, effort-level or saved-profile output budget, a generation can reach 128,000 output tokens, subject to the model's limit. Explicit output and step budgets are therefore useful cost controls. Exhausted credits pause the batch without extending its deadline; adding credits allows it to resume.

rights

The supplied page does not state a documentation or code-example licence, grant redistribution rights, or establish ownership and permitted reuse of generated outputs. Those rights remain unknown from this evidence.

Input, output and error files expire 30 days after their individual creation times. Custom expiry options are rejected, although file deletion is supported. Deleting an input file does not affect batches already created from it. Batch requests are stored even when a store field is supplied, and zero-data-retention organizations cannot use the feature. Broader privacy terms and data-use commitments are not established here.

freshness

The supplied page was captured on 24 November 2026 at 13:13:07.607 UTC. Its source revision is sha256:8ebebe4aae0604f47a0201136b552a1ba68dbe2aac95ff3b4aecc84cf18c4f5a. No publication date, last-updated date or required SDK version is stated.

The capture supports the documented behavior at that snapshot; continued availability and unchanged limits are not established. Model support, service tiers, prices and account limits should be confirmed before committing a workload.

actions

Before adopting the feature, confirm that file retention is acceptable, the organization is eligible, the chosen model is supported and the required tools are allowed. Obtain current model and tool prices, then choose explicit output and step budgets.

For an initial implementation, use a small representative batch with stable custom IDs and an idempotency key. Reconcile every input with its result, inspect per-response status and error details, and measure actual turnaround, quality and charges before scaling. This is a proposed validation step; no batch was run.

Download results before expiry and plan for credit pauses, cancellation and partial completion. Any retry process should identify unresolved requests before resubmitting them, since successful requests may already have produced billable work.

Evidence for this report

selected-page.txtselected · checked 2026-11-24