Quickstart: your first successful job
Sign up, add funds, and run your first job with curl, from request to result.
This page takes you from no account to a finished job. Every command here is plain curl and runs in any shell.
Veralens turns images, PDFs, office files and text into JSON that matches your schema, or into Markdown or plain text. Every request creates a job. You create it, then you fetch the result when it is done (or get a webhook).
Want to see output before you write code? Browse three real documents with their schema, output and cost.
1. Create an account and an API key
- Sign up at veralens.ai.
- Open API Keys in the dashboard and create a key.
- Copy the secret. It starts with
vl_and is shown once. Store it somewhere safe.
2. Add funds
There is no free balance. A job you create with an empty balance is rejected with insufficient_balance, and the response includes a topup_url to add funds.
Open Usage in the dashboard and add funds, from $5, €5 or £5 up to 1,000 at a time. Funds do not expire. A failed job costs nothing. See Pricing & Funds.
3. Set your key and the base URL
Every request sends the key as a Bearer token:
4. Create a job from text
Send one or more sources and a schema that describes the JSON you want back.
You get 201 Created and the job, already in pending. usage.cost is the hold: an estimate kept aside from your balance until the job ends. output and the token counts arrive when it finishes.
Save the id:
5. Or create a job from a PDF
Files go in as a base64 data URL. A whole file is too long for the command line, so write the body to a file first and send it with --data-binary.
On macOS, use base64 -i invoice.pdf instead of base64 -w0 invoice.pdf. The same body works for images (data:image/png;base64,...) and office files. See sources for every accepted type and limit.
6. Get the result
Fetch the job every 2 to 3 seconds until status is completed or failed. Polling faster runs into the rate limit of 30 requests a minute.
A finished job looks like this:
output is always a JSON string, so parse it on your side. This holds for every target: a markdown job gives you the markdown text once you parse it. usage.cost is now the real charge in USD. It can be higher or lower than the hold. A failed job costs nothing: the hold goes back to your balance.
A wait loop in shell (needs jq):
The same flow in Python, with requests:
And in Node 18 or later, with the built-in fetch:
7. Or get a webhook
Add "webhook_url": "https://yourapp.com/hooks/veralens" to the create body and Veralens posts the result to that URL when the job ends. Webhooks need an API key; they don't work from the dashboard. Your handler must:
- check the
x-veralens-signatureheader (below), - reply with a
2xxwithin 10 seconds, then do the work, - skip a
job_idit has already handled, because a retry can send the same event twice.
The signature is t=<unix seconds>,v1=<hex>. v1 is an HMAC SHA-256 of <t>.<raw body>, keyed with the secret of the API key that created the job. In Node:
See Jobs & Queue for the payloads and the retry schedule.
Troubleshooting
Next steps
- API Reference: every endpoint, field, limit and error code.
- Schemas & formats:
formatvalues that check IDs, decode codes and normalize dates. - Jobs & Queue: webhook payloads and retries.
- Playground: try a schema in the dashboard before you write code.