Getting Started
This getting started to UniAI guide will show how to get started working with uniai
. UniAI is a PDF to structured data converter.
By the end of this introduction tutorial, you will be familiar with the process of converting PDF to structured data as JSON format.
UniAI supports document type of invoice and CV (resume). Unlike traditional PDF parsers, UniAI leverages advanced AI models to accurately extract and structure data from complex documents.
Prerequisites
- A Linux, macOS or Windows machine with internet connection.
- UniCLOUD API Key.
- Familiarity with using CURL or REST API request.
Create a UniCloud account
To use UniAI, you need to sign up for a UniCloud account to get your API key.
Make CURL request to UniAI
Set your UNIDOC_LICENSE_API_KEY
environment variable to your API key.
export UNIDOC_LICENSE_API_KEY="your_api_key_here"
You can use CURL to make a request to the UniAI endpoint. Below is an example of how to do this.
curl -X POST https://cloud.unidoc.io/api/uniai/extract/invoice \
-H "X-API-KEY: $UNIDOC_LICENSE_API_KEY" \
-F "file=@/Users/Documents/2025-02-unidoc-invoice.pdf"
Example Response
The response will be in JSON format containing the extracted structured data.
{
"invoice_number": "506617438",
"invoice_date": "2025-03-01",
"due_date": "2025-03-01",
"seller": {
"name": "DigitalOcean LLC",
"address": "105 Edgeview Drive, Suite 425\nBroomfield, CO, 80021",
"vat_id": "136267",
"id_number": "621119-9900"
},
"customer": {
"name": "UniDoc do:team:6ebf86a1ef50a0fac7508fff481469a",
"email": "[email protected]",
"address": "Bardastadir 71\nReykjavik, Reykjavik, 112\nICELAND"
},
"line_items": [
{
"category": "Product Usage Charges",
"description": "Droplets Hours Start End",
"amount": 108.00
},
{
"category": "Product Usage Charges",
"description": "db-01.com",
"quantity": 672,
"amount": 24.00
},
{
"category": "Product Usage Charges",
"description": "u01.unidoc.io",
"quantity": 672,
"amount": 12.00
},
{
"category": "Product Usage Charges",
"description": "db.unidoc.io",
"quantity": 672,
"amount": 24.00
},
{
"category": "Product Usage Charges",
"description": "uni.unidoc.io)",
"quantity": 672,
"amount": 48.00
},
{
"category": "Product Usage Charges",
"description": "Kubernetes Clusters Hours Start End",
"amount": 120.00
},
{
"category": "Product Usage Charges",
"description": "cluster",
"quantity": 672,
"amount": 60.00
},
{
"category": "Product Usage Charges",
"description": "cloud-cluster",
"quantity": 672,
"amount": 60.00
},
{
"category": "Product Usage Charges",
"description": "Spaces Hours Start End",
"amount": 5.00
},
{
"category": "Product Usage Charges",
"description": "Spaces (250GiB storage & 1TiB bandwidth)",
"quantity": 672,
"amount": 5.00
},
{
"category": "Product Usage Charges",
"description": "Volumes Hours Start End",
"amount": 30.00
},
{
"category": "Product Usage Charges",
"description": "foxydb-db (nyc1) - 100.00GB Volume",
"quantity": 672,
"amount": 10.00
},
{
"category": "Product Usage Charges",
"description": "foxydb-nfs (nyc1) - 100.00GB Volume",
"quantity": 672,
"amount": 10.00
},
{
"category": "Product Usage Charges",
"description": "volume-nyc1-01 (nyc1) - 100.00GB Volume",
"quantity": 672,
"amount": 10.00
},
{
"category": "Product Usage Charges",
"description": "Droplet Backups Hours Start End",
"amount": 21.60
},
{
"category": "Product Usage Charges",
"description": "db.foxyutils.com (Weekly Backup Services)",
"quantity": 4,
"amount": 4.80
},
{
"category": "Product Usage Charges",
"description": "db.unidoc.io (Weekly Backup Services)",
"quantity": 4,
"amount": 4.80
},
{
"category": "Product Usage Charges",
"description": "uni.unidoc.io (Weekly Backup Services)",
"quantity": 4,
"amount": 9.60
},
{
"category": "Product Usage Charges",
"description": "uni01.unidoc.io (Weekly Backup Services)",
"quantity": 4,
"amount": 2.40
}
],
"subtotal": {
"amount": 284.60,
"currency": "USD"
},
"taxes": [
{
"type": "VAT Iceland",
"amount": 68.30,
"currency": "USD",
"rate": "24.00%"
}
],
"total": {
"amount": 352.90,
"currency": "USD"
},
"notes": "Final invoice for the February 2025 billing period"
}