Authentication Setup

1

Sign up for an Invaro account

Sign up for an Invaro account

2

Navigate to the API Keys section

Navigate to the API Keys section

3

Create a new API key

Create a new API key

4

Store your API key securely

Store your API key securely - you’ll need it for all API requests

Include your API key in all API requests using the Bearer token format:

Authorization: Bearer your_api_key_here

API Workflow Overview

Here’s how to process documents using our API:

1

Upload Documents

First, upload your documents to our API:

curl -X POST "https://api.invaro.ai/api/v1/parse/upload" \
  -H "Authorization: Bearer your_api_key" \
  -F "files=@document.pdf"
2

Start Processing

After upload, start processing based on document type:

curl -X POST "https://api.invaro.ai/api/v1/parse/invoices" \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "document_id": "your_document_id"
  }'
JavaScript
const response = await fetch('https://api.invaro.ai/api/v1/parse/invoices', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    document_id: document_id
  })
});

const data = await response.json();
const job_id = data.data.job_id;
3

Check Processing Status

Monitor the processing status using the job ID:

curl "https://api.invaro.ai/api/v1/parse/invoices/{job_id}" \
  -H "Authorization: Bearer your_api_key"
JavaScript
const response = await fetch(`https://api.invaro.ai/api/v1/parse/invoices/${job_id}`, {
  headers: {
    'Authorization': 'Bearer your_api_key'
  }
});

const data = await response.json();
const status = data.data.status;
4

Get Results

Once processing is complete, you’ll receive structured data:

Complete Code Example

Here’s a complete Python example showing the entire workflow:

import requests
import time

class InvaroAPI:
    def __init__(self, api_key):
        self.base_url = "https://api.invaro.ai/api/v1"
        self.headers = {"Authorization": f"Bearer {api_key}"}

    def upload_document(self, file_path):
        url = f"{self.base_url}/parse/upload"
        with open(file_path, "rb") as f:
            files = {"files": f}
            response = requests.post(url, headers=self.headers, files=files)
            return response.json()["data"]["files"][0]["doc_id"]

    def process_document(self, document_id, doc_type="statements"):
        url = f"{self.base_url}/parse/{doc_type}"
        data = {"document_id": document_id}
        response = requests.post(url, headers=self.headers, json=data)
        return response.json()["data"]["job_id"]

    def check_status(self, job_id, doc_type="statements"):
        url = f"{self.base_url}/parse/{doc_type}/{job_id}"
        response = requests.get(url, headers=self.headers)
        return response.json()

    def process_with_polling(self, file_path, doc_type="statements"):
        # Upload
        document_id = self.upload_document(file_path)
        print(f"Document uploaded: {document_id}")

        # Start processing
        job_id = self.process_document(document_id, doc_type)
        print(f"Processing started: {job_id}")

        # Poll for results
        while True:
            result = self.check_status(job_id, doc_type)
            status = result["data"]["status"]
            print(f"Status: {status}")

            if status == "completed":
                return result
            elif status == "failed":
                raise Exception("Processing failed")

            time.sleep(5)  # Wait 5 seconds before next check

  # Usage example
  api = InvaroAPI("your_api_key")
  result = api.process_with_polling("statement.pdf", "statements")
  print("Final result:", result)

Next Steps

Support

Need help? Contact our support team: