Skip to navigation

Start a document parse

View as Markdown

Relays to https://api.cloud.llamaindex.ai/api/v2/parse, injecting the Authorization: Bearer credential. Starts an asynchronous parse of the document at source_url and answers with the job id to poll. This and GET /llamaparse/v2/parse/{job_id} are the only mounted LlamaParse routes — every other LlamaParse path answers the gateway’s own 404, this one included under any other method.

The body is a closed allow-set of exactly four fields and at most 8,192 bytes, and the request forwarded upstream is rebuilt from it:

  • source_url is a credential-free https URL on any public host — a signed object-storage link, a document on your own site, or any public PDF. LlamaCloud fetches the document itself, from its own network. The body cap is also why an inline data: document is never an option: send a URL.
  • tier is one of fast, cost_effective, agentic, agentic_plus and sets the per-page rate for the whole job.
  • version is latest or a past YYYY-MM-DD calendar version.
  • page_ranges is required and carries exactly one of max_pages (1–100) or target_pages (a 1-based selection, as an integer array or a start-end range string). At most 100 unique pages, no page number above 10000. It is the cost basis, which is why the route asks for it up front instead of defaulting to the whole document.

Query parameters are not accepted, and any field the policy doesn’t recognize is a 400 before LlamaCloud is reached. The job is registered to the calling account, which is the only account that can read it afterwards.

Before the upstream call, the selected-page ceiling at the tier’s rate is reserved against your balance; a job that doesn’t fit answers 402 and is never forwarded, and a create that produces no reachable job releases the reservation in full. Once the job finishes and LlamaCloud reports what it used, the reservation settles to that exact figure plus the gateway’s 5.5% fee; while the figure is outstanding the reservation stands, and if it never arrives the reservation is the charge.

There is no retry. If a create times out ambiguously the job may already exist, so don’t resend it blind — persist the id a create returns and poll the status route.

Authentication

AuthorizationBearer

Your per-client bearer token — the API key the gateway issued to you. Present it in Authorization: Bearer <token> form. A token that is missing, unknown, or revoked draws a 401. Before the call is sent upstream the token is removed (stripped, or swapped for the upstream’s own credential); it never makes it past the gateway.

Request

The parse request. A closed allow-set: all four fields are required, and anything not listed is rejected with a 400 before LlamaCloud is called.

source_urlstringRequiredformat: "uri"<=2048 characters

An https URL to the document, carrying no embedded credentials, on any public host — a signed object-storage link, a document on your own site, or any public PDF. Refused: any other scheme (http and inline data: included), an embedded user:password, an IP-literal host in any spelling, and a single-label or .localhost/.local/.internal hostname. LlamaCloud fetches the document itself, from its own network, so the URL must be reachable without your credentials.

tierenumRequired

The parse tier — it sets the per-page rate for the whole job. Listed in ascending cost order, with the higher tiers being the more capable parsers; see LlamaParse’s own documentation for what each does with a page. fast produces no markdown, so expand=markdown is unavailable on a fast job.

Allowed values:
versionstringRequiredformat: "^(latest|\d{4}-\d{2}-\d{2})$"

latest, or a past YYYY-MM-DD calendar version to pin the parser behaviour to. A future date is refused. Pinning is what keeps output stable across a parser update; latest follows it.

page_rangesobjectRequired

The page selection — required, and the basis for both the create-time reservation and the final charge. Exactly one of max_pages or target_pages: supplying both is refused as an ambiguous cost basis rather than resolved by a precedence rule you can’t see.

Response

The parse job was created and registered to your account. The gateway re-serializes the answer down to the three fields you need — the job id to poll, its current status, and the tier it will be billed at — so LlamaCloud’s shared-account identifiers never reach you. The upstream’s own success status is preserved, so treat any 2xx here as “the job exists”.

Poll GET /llamaparse/v2/parse/{id} from here. Persist id before doing anything else: it is the only handle to the job, and to the work already reserved against your balance.

idstringOptional

The job id. Poll GET /llamaparse/v2/parse/{id} with it, and persist it — it is the only handle to the job.

statusenumOptional

Where the job is. PENDING and RUNNING mean keep polling; COMPLETED, FAILED, and CANCELLED are terminal, and a terminal job’s charge is reconciled to LlamaCloud’s own exact reported usage, plus the gateway’s 5.5% fee, once that usage is reported — until then, the create-time reservation stands.

Allowed values:
tierenumOptional

The tier the job runs at, and the per-page rate it bills at.

Allowed values:

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
404
Not Found Error
500
Internal Server Error
502
Bad Gateway Error