Bolt.new Tutorial5 min setupNo-code friendly

Add Our Invoice OCR API to Your Bolt.new App in 5 Minutes

Bolt builds your UI. StructOCR reads the documents. Here's the exact prompt to wire them together. Use the widget below to test our Invoice OCR API live for free.

Steve Harrington | Solutions ConsultantUpdated 2026-06-26
Diagram showing an invoice image uploaded in a Bolt.new app, sent to the StructOCR API, and returned as structured JSON with vendor name, total, and line items.
Upload โ†’ parse โ†’ display: the full flow takes a single API call.

Why Bolt.new + StructOCR is a natural fit

Bolt.new generates full-stack apps instantly from natural language prompts. It handles the UI, backend, and deployment โ€” but extracting structured data from documents like invoices still requires a dedicated invoice OCR API. StructOCR fills exactly that gap: one API call, structured JSON back. Tell Bolt what you want, paste in the fetch code below, and you're done.

The problem: AI builders don't read documents

Tools like Bolt.new are remarkable at generating apps โ€” but they stop at the file boundary. You can build a beautiful invoice upload interface in minutes, yet the actual extraction of vendor names, line items, totals, and dates still requires a dedicated Invoice OCR API. Most teams either skip this feature or spend days integrating a general-purpose vision model that returns unstructured text.

The solution: one API call, structured JSON

StructOCR's /v1/invoice endpoint accepts an image and returns a clean JSON object with every field pre-labeled โ€” no prompting, no parsing, no post-processing. Because it speaks plain HTTP, Bolt.new can wire it up from a single fetch call. You describe what you want, and Bolt writes the code. You can even test our invoice OCR API live for free on this page before writing a single line of code.

Integrate StructOCR in Bolt.new (3 Steps)

  1. Create a Bolt.new project and describe your app

    Open bolt.new and start a new project. In the prompt box, describe the app you want to build โ€” be specific about the invoice fields you need.

    Try this prompt: "Build an invoice upload app. Users can upload an invoice image and see the vendor name, invoice date, due date, and total amount extracted automatically."
  2. Tell Bolt to call the StructOCR API

    Once Bolt scaffolds the UI, paste the follow-up prompt below. Bolt will write the fetch call, handle the file upload, and wire the response to your UI components.

    Follow-up prompt: "When a user uploads an image, send it as a multipart/form-data POST to https://api.structocr.com/v1/invoice with an Authorization header containing my API key stored in VITE_STRUCTOCR_KEY. Display the returned JSON fields in the results panel."
    // Bolt.new generates something like this โ€” you just supply the key const response = await fetch('https://api.structocr.com/v1/invoice', { method: 'POST', headers: { Authorization: `Bearer ${import.meta.env.VITE_STRUCTOCR_KEY}` }, body: formData, });
  3. Add your StructOCR API key and deploy

    Go to Settings โ†’ Environment Variables in your Bolt project and add your StructOCR key. Then click Deploy to publish your invoice parser live.

    Variable name: VITE_STRUCTOCR_KEY โ€” get your free key at structocr.com/dashboard
    VITE_STRUCTOCR_KEY=sk_live_xxxxxxxxxxxxxxxx

What you can build in Bolt.new with this integration

  • Accounts payable dashboard: Let your team upload supplier invoices and automatically populate a tracker with vendor, amount, and due date โ€” no manual data entry. Perfect for building custom accounts payable automation workflows.
  • Freelance invoice manager: Build a personal tool that reads your client invoices, calculates outstanding totals, and exports to CSV โ€” all inside Bolt.new in under an hour.
  • Expense approval workflow: Add an upload step to an approval flow: extract invoice details automatically and route for sign-off without any copy-pasting. This is the foundation of modern expense management automation.
  • Multi-vendor price comparison: Parse invoices from multiple suppliers and compare line-item pricing side by side โ€” a task that previously required a developer and a parsing library.

The prompt and the code

Copy the Bolt.new prompt into your project chat to generate the integration. The JavaScript tab shows what Bolt produces โ€” useful if you want to verify or customize it.

Prerequisite: A free StructOCR account โ€” get your API key at structocr.com/dashboard (no credit card required)

I need to add invoice OCR to this app.

When a user uploads an image:
1. Send it as multipart/form-data to: POST https://api.structocr.com/v1/invoice
2. Include the header: Authorization: Bearer ${VITE_STRUCTOCR_KEY}
3. The response is JSON with fields: vendor_name, invoice_date, due_date, total_amount, currency, line_items[]
4. Display each field in the results panel below the upload button
5. Show a loading spinner while the request is in flight
6. Show an error message if the upload fails

Use the environment variable VITE_STRUCTOCR_KEY for the API key.

What the API returns

Every field is labeled and typed. Your Bolt.new app can render this directly without any transformation.

{
  "invoice_number": "INV-2024-0891",
  "vendor_name": "Acme Supplies Ltd.",
  "vendor_address": "123 Commerce St, Austin TX 78701",
  "invoice_date": "2024-11-14",
  "due_date": "2024-12-14",
  "currency": "USD",
  "subtotal": 2400,
  "tax": 192,
  "total_amount": 2592,
  "line_items": [
    {
      "description": "Widget Pro (12-pack)",
      "quantity": 4,
      "unit_price": 500,
      "amount": 2000
    },
    {
      "description": "Shipping & Handling",
      "quantity": 1,
      "unit_price": 400,
      "amount": 400
    }
  ],
  "confidence": 0.97
}

Technical Specs

  • Formats accepted: PNG, JPG, WEBP โ€” including scanned and photographed invoices
  • Response time: typically 1โ€“3 seconds per page
  • Languages: English, Spanish, French, German, Chinese, Japanese, and 40+ more
  • Max file size: 20 MB per request
  • Confidence scores: each field includes an extraction confidence value

Key Features

  • Structured output: every field is named and typed โ€” no regex, no parsing
  • Line items: products, quantities, unit prices, and subtotals extracted as an array
  • Tax and discount: VAT, GST, and discount rows are detected and labeled separately
  • Multi-page support: invoices spanning multiple pages are handled in a single call
  • Works with photos: blurry or skewed smartphone photos are corrected automatically

Live Demo: Invoice extractor

No registration required. Upload a file to test the extraction.

1
Upload
2
Results
โ†‘

Drop files here or click to browse

JPG ยท PNG ยท WebP ย ยทย  up to 500 files ยท max 4.5 MB each

No files selected

Frequently Asked Questions

Does StructOCR work inside a Bolt.new app?

Yes. StructOCR is a standard REST API that accepts a file and returns JSON โ€” Bolt.new can call it directly from a client-side fetch or through a lightweight backend function if you want to keep the key server-side.

Where should I store the StructOCR API key in Bolt.new?

Click the Settings icon in the Bolt sidebar, then go to Environment Variables and add VITE_STRUCTOCR_KEY. Bolt exposes VITE_-prefixed variables to the browser automatically. If you prefer to keep the key private, create a simple proxy using Bolt's built-in API route support.

Can Bolt.new call StructOCR without any backend?

Yes, for most use cases. The StructOCR API supports CORS, so a browser fetch works out of the box. For production apps where you want to hide the API key, a one-line API route (e.g., a Next.js API handler) is the recommended approach and Bolt can scaffold it for you.

What invoice formats does StructOCR support?

PNG, JPG, and WEBP. Files up to 20 MB are accepted.

How accurate is the invoice extraction?

Accuracy on clean invoice images typically exceeds 97%. Scanned or photographed invoices depend on image quality, but the API includes a confidence score per field. You can verify this live with your own documents using our free invoice extractor tool.

Is there a free tier to test with?

Yes. StructOCR's free plan includes 10 pages per month with no credit card required. Check out our pricing page for full details or sign up at structocr.com/dashboard.

Can I use this with Lovable, v0, or Replit instead of Bolt.new?

Absolutely โ€” the fetch code is identical across all AI builders. The only difference is where you add the environment variable: Lovable's Project Settings, v0's Vercel env vars, or Replit Secrets.

What if my invoice is not in English?

StructOCR supports 40+ languages including Spanish, French, German, Chinese, Japanese, and Arabic. The API auto-detects the document language.

More Tutorials

Precise Data Extraction and Seamless Integration with AI-powered OCR API.

Empower your solutions with automated data extraction by integrating best-in class StructOCR via API seamlessly.

No credit card required โ€ข Full API access included