Bolt.new Tutorial5 min setupNo-code friendly

Add Receipt OCR to Your Bolt.new App in 5 Minutes

Bolt.new scaffolds your full-stack UI. StructOCR reads the receipts. Here's the exact prompt and API call to wire them together — right in your browser.

Diagram showing a receipt image uploaded in a Bolt.new app, sent to the StructOCR API, and returned as structured JSON with merchant name, total, and items.
Upload → parse → display: the full flow takes a single API call.

Why Bolt.new + StructOCR is a natural fit

Bolt.new generates and runs full-stack web applications directly in your browser. It handles the UI, components, and package management automatically — but document parsing is still something you have to wire up yourself. 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 crumpled receipts

Tools like Bolt.new are remarkable at generating apps instantly — but they stop at the file boundary. You can build a beautiful expense upload interface in minutes, yet the actual extraction of merchant names, purchased items, taxes, and totals from faded thermal paper requires a dedicated Receipt OCR API. Most teams either skip this feature or spend days trying to force a general-purpose vision model to format line items correctly.

The solution: one API call, structured JSON

StructOCR's /v1/receipt endpoint accepts a photo 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 without heavy backend dependencies.

Integrate StructOCR in Bolt.new (3 Steps)

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

    Open bolt.new and start a new prompt. Describe the app you want to build — be specific about the receipt fields you need.

    Try this prompt: "Build a receipt scanner app. Users can upload a photo of a receipt and see the merchant name, date, time, 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 in its in-browser editor.

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

    In the Bolt.new file explorer, create or open the .env file to securely add your StructOCR key. The app will automatically reload with your live scanner.

    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

  • Corporate expense tracker: Let employees snap photos of their lunch or travel receipts and automatically populate a reimbursement tracker. Perfect for building custom expense management automation workflows.
  • Loyalty & rewards scanning: Build a consumer app where users upload grocery receipts to prove purchase of specific brands and earn reward points automatically.
  • Personal budgeting dashboard: Create a financial tool that reads your daily coffee and retail receipts, categorizes the spending, and calculates monthly totals — all inside Bolt.new.
  • Tax preparation assistant: Parse hundreds of receipts to separate tax amounts and deductible expenses without manual data entry.

The prompt and the code

Copy the follow-up prompt into your Bolt.new chat to generate the integration. The code block shows what Bolt typically produces — useful if you want to verify or tweak it.

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

I need to add receipt OCR to this app.

When a user uploads an image:
1. Send it as multipart/form-data to: POST https://api.structocr.com/v1/receipt
2. Include the header: Authorization: Bearer ${VITE_STRUCTOCR_KEY}
3. The response is JSON with fields: merchant_name, date, time, total_amount, tax_amount, currency, 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.

{
  "success": true,
  "data": {
    "is_valid": true,
    "confidence": "high",
    "merchant_name": "Blue Bottle Coffee",
    "date": "2026-04-22",
    "time": "08:45 AM",
    "currency": "USD",
    "total_amount": 14.5,
    "tax_amount": 1.25,
    "items": [
      {
        "name": "Caffe Latte - Large",
        "quantity": 2,
        "price": "11.00"
      },
      {
        "name": "Butter Croissant",
        "quantity": 1,
        "price": "3.50"
      }
    ],
    "validation_error": null
  }
}

Technical Specs

  • Formats accepted: PNG, JPG, WEBP — optimized for smartphone photos
  • Response time: typically 1–2 seconds per receipt
  • Condition handling: robust against crumpled paper, low lighting, and faded thermal ink
  • Max file size: 20 MB per request
  • Data validation: built-in checks to ensure total amounts match line-item sums

Key Features

  • Structured output: every field is named and typed — no regex required
  • Line items: individual products, quantities, and prices extracted as a clean array
  • Tax and tip: separate fields for tax, tip/gratuity, and the final total amount
  • Merchant detection: automatically identifies the store or restaurant name
  • Global currencies: recognizes symbols and formats for USD, EUR, GBP, JPY, and more

Live Demo: Receipt scanner

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 in its in-browser WebContainer environment.

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

For testing within Bolt, you can create a `.env` file in the browser's file explorer and add `VITE_STRUCTOCR_KEY`. For production applications where you want to hide the API key, proxying through a secure backend is the recommended approach.

Can it read crumpled or faded receipts?

Yes. Our receipt model is specifically trained on smartphone photos of thermal paper, including crumpled, shadowed, and faded receipts.

How accurate is the receipt extraction?

Accuracy for standard retail and restaurant receipts typically exceeds 96%. You can verify this live with your own photos using our free receipt scanner 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.

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