Skip to content
Getting Started

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.

  1. Navigate to UniCloud and create an account.

  2. Check your inbox for an activation email from UniDoc, then activate the account.

  3. 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}
StatusMessageCause
400file is requiredNo file part in the form
400unsupported structured type: xType is not invoice or resume
400only up to 3 pages are supported for extractionPDF has four or more pages
403available credits exceeded for organizationOut of credits
429More than five requests per second on one key
500failed to read PDF file: ...The upload is not a readable PDF

Next steps

Last updated on