Skip to main content
Parse many documents concurrently by submitting each one as a Parse Job and polling all of them at the same time. Use this pattern in applications and services that already run asynchronous code, or when you have more documents than you want to wait on one at a time. For a plain script that works through a folder in order, see Parse a Directory of Documents. The scripts save each document’s Markdown to an output folder as <name>_<extension>.md (such as invoice_pdf.md), so files that share a name, like invoice.pdf and invoice.png, don’t overwrite each other. A Parse Job returns its job_id as soon as the upload finishes, and the server queues the parsing. Concurrency in your code controls how many documents upload and poll at the same time, not how fast the server parses them. The scripts submit jobs on the standard tier, which consumes half the credits of the priority tier and of synchronous requests, with a slower turnaround. standard jobs count against your plan’s hourly page limit. When you exceed a rate limit, the API returns a 429 error. See Rate Limits.
These examples require the Python or TypeScript client library. Before running a script, set your API key and install the library and any required dependencies.

Python

Use AsyncLandingAIADE with asyncio.gather() and a semaphore

TypeScript

Use Promise.allSettled() with p-limit

Python

The AsyncLandingAIADE client exposes the same client.v2.parse_jobs methods as the synchronous client, as coroutines. The script runs one task per document with asyncio.gather(), and an asyncio.Semaphore caps how many uploads run at the same time. A failed document is reported at the end and doesn’t stop the others.

TypeScript

The TypeScript library’s methods already return promises. The script starts one task per document and waits for all of them with Promise.allSettled(), so a failed document doesn’t stop the others. The p-limit library caps how many uploads run at the same time: