Integrations>Developer Documentation

OCR1 SaaS API Documentation & Developer Portal

Complete plug-and-play REST API reference to connect OCR1 invoice extraction into any POS, CRM, ERP, Odoo, SAP, or custom code.

Manage API Keys
Plug-and-Play Architecture

One API Key connects the full OCR1 Engine into your Software

No need to duplicate OCR models or local machine learning scripts across every app. Simply send any invoice image or PDF to POST /api/v1/ocr with your API Key, and receive full structured 15-header fields, all product rows, and tax totals.

15 Header Fields13-Column Product RowsPre-built POS & ERP Payloads99.4% Uptime SLA
1

Generate & Copy API Key

Go to the API Keys Dashboard, click Generate API Key, choose environment (Production/Staging), and copy your generated secret (sk_live_...).

2

Add to Environment (.env)

Add your secret key to your external application's secure configuration or .env file. Never hardcode keys directly into public repositories or client-side code.

3

Send Invoices & Receive Data

POST images or PDFs to /api/v1/ocr with Authorization: Bearer YOUR_KEY. Receive fully parsed JSON ready to save directly to your database.

Exact API Key Placement in External Software

Place your API key in your external software's environment file or server configuration:

OCR_API_KEY=sk_live_51Msz82jLkP99aXm0998a4421b9cf38e
OCR_API_URL=http://localhost:3000

In HTTP requests, pass it in the header: Authorization: Bearer sk_live_... or x-api-key: sk_live_...

Copy-Paste Client Integration Code
// Node.js / Express / Next.js Integration
// 1. Install or use native fetch (Node 18+)
// 2. Set environment variable: OCR_API_KEY=sk_live_51Msz82jLkP99aXm0998a4421b9cf38e

const fs = require('fs');

async function extractInvoiceData(filePath) {
  // Read invoice file into base64 or FormData
  const fileBuffer = fs.readFileSync(filePath);
  const base64Data = fileBuffer.toString('base64');
  const filename = filePath.split('/').pop();

  const response = await fetch('http://localhost:3000/api/v1/ocr', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.OCR_API_KEY || 'sk_live_51Msz82jLkP99aXm0998a4421b9cf38e'}`,
    },
    body: JSON.stringify({
      image: `data:image/png;base64,${base64Data}`,
      filename: filename,
    }),
  });

  const data = await response.json();

  if (!response.ok || !data.success) {
    throw new Error(`OCR Error [${data.code}]: ${data.error}`);
  }

  // Access all 15 header fields
  console.log('Invoice No:', data.headerFields.invoiceNo);
  console.log('Date:', data.headerFields.date);
  console.log('Grand Total:', data.financials.grandTotal);

  // Access all product rows
  data.lineItems.forEach((item, idx) => {
    console.log(`[${idx + 1}] ${item.desc} | Qty: ${item.qty} | Rate: ${item.price} | Amount: ${item.amount}`);
  });

  // Pre-mapped module payloads ready to plug in:
  const posPayload = data.modulePayloads.pos;
  const accountsPayload = data.modulePayloads.accounts;

  return data;
}

// Run extraction
extractInvoiceData('./invoice_premier.png').catch(console.error);