Getting Started
UniAI is a hosted endpoint, so there is nothing to install. Once you have an API key you can
extract structured data from a PDF with a single curl command. This takes a couple of
minutes.
What you’ll learn
- Get a UniCloud API key
- Extract data from an invoice
- Read the response
- Extract data from a resume
Prerequisites
- A machine with an internet connection, running Linux, macOS or Windows.
- A UniCloud API key.
curl, or any HTTP client that can post a file.
Create a UniCloud account
Sign up for a UniCloud account to get your API key.
Navigate to UniCloud and create an account.
Check your inbox for an activation email from UniDoc, then activate the account.
Sign in, select API Key, and click +Add API Key. Give it a name and save. Copy the key straight away, because it is shown only once.
The same key works across UniDoc products. UniAI reads it from the X-API-KEY header rather
than from a license call in code, since there is no library involved.
Put it in an environment variable so it stays out of your shell history and your source:
export UNIDOC_LICENSE_API_KEY="your_api_key_here"Extract your first invoice
Point it at a PDF invoice:
curl -X POST https://cloud.unidoc.io/api/uniai/extract/invoice \
-H "X-API-KEY: $UNIDOC_LICENSE_API_KEY" \
-F "[email protected]"Three things about that request. The type is in the path, invoice here. The file goes as
multipart/form-data, which is what -F does. And the key goes in X-API-KEY, not in an
Authorization header.
Read the response
The body is a JSON object holding the fields the model found. A short invoice comes back like this:
{
"invoice_number": "2026-014",
"customer": {
"name": "Acme Corp."
},
"seller": {
"name": "unidoc.io"
},
"total": {
"amount": 1240.00,
"currency": "USD"
}
}Notice what is not there. That invoice had no due date, no tax line and nothing the model
recognized as itemized rows, so those keys are absent rather than null. A richer invoice
returns line_items, taxes, subtotal, invoice_date, due_date and notes as well.
Extract an invoice lists every field.
Always check a key exists before reading it. Fields are omitted whenever the model does not find them, including ones the schema calls required.
One wrinkle if you are writing a client rather than reading output by eye: a successful
response carries Content-Type: text/plain; charset=utf-8 even though the body is JSON.
Parse the body as JSON and ignore the header.
Extract a resume
Same request, different type in the path:
curl -X POST https://cloud.unidoc.io/api/uniai/extract/resume \
-H "X-API-KEY: $UNIDOC_LICENSE_API_KEY" \
-F "[email protected]"The path segment is resume. cv is not a valid type and returns:
{"success":false,"message":"unsupported structured type: cv","errors":null}The response shape is completely different from an invoice: name and contact details, then arrays for education, work history, skills and the rest. Extract a resume has the full list.
Scanned PDFs need a flag
If the PDF is a scan, there is no text to extract and the response comes back nearly empty.
Add is_scanned=true so the pages are rendered and read as images:
curl -X POST https://cloud.unidoc.io/api/uniai/extract/invoice \
-H "X-API-KEY: $UNIDOC_LICENSE_API_KEY" \
-F "[email protected]" \
-F "is_scanned=true"See scanned documents for how to tell whether you need it.
When it fails
Errors come back as a JSON envelope with the status in the HTTP code:
{"success":false,"message":"file is required","errors":null}| Status | Message | Cause |
|---|---|---|
| 400 | file is required | No file part in the form |
| 400 | unsupported structured type: x | Type is not invoice or resume |
| 400 | only up to 3 pages are supported for extraction | PDF has four or more pages |
| 403 | available credits exceeded for organization | Out of credits |
| 429 | More than five requests per second on one key | |
| 500 | failed to read PDF file: ... | The upload is not a readable PDF |
Next steps
Extract an invoice for the invoice schema field by field.
Extract a resume for the resume schema.
Scanned documents for image-based PDFs.
FAQ for limits, missing fields, and what happens to your documents.