The receipt upload feature is table stakes for any expense tracking app. Users photograph or upload a receipt; the app reads it and creates an expense entry automatically — no typing required. Here's how to build that feature from scratch using DocuParseAPI.
What We're Building
A backend route that:
- Accepts a receipt file uploaded by a user
- Sends it to DocuParseAPI
- Creates an expense record from the extracted data
- Returns the expense to the client
The same pattern works whether you're building a mobile app backend, a web app, or an internal tool.
Architecture Overview
The important thing: your API key never reaches the client. It stays on your server.
Frontend: Receipt Upload Component (React)
Preventing Duplicate Expenses
A user might accidentally upload the same receipt twice. Use the document_id field from the API response — it's unique per document — to detect and prevent duplicates:
// Before creating the expense record, check for duplicates
const existing = await db.expenses.findOne({
where: { documentId: extractedData.document_id, userId }
});
if (existing) {
return res.status(409).json({
error: "This receipt has already been uploaded",
expenseId: existing.id
});
}What to Show the User During Extraction
Receipt extraction typically completes in under 5 seconds. Use that time well:
- Immediately on upload: Show a progress indicator. "Reading your receipt..."
- On success: Pre-fill all form fields with extracted data. Let the user correct anything before saving.
- On failure: Give a specific, actionable error. "This image is too blurry — try taking the photo in better lighting, or upload a PDF." Not "something went wrong."
Pre-filling the form rather than silently saving is good UX — it builds trust by showing the user what was extracted and letting them verify it.
Pricing
The receipt upload feature costs $0.005 per receipt on the Starter plan ($14.99/month for 3,000 receipts). For most expense tracking apps, that's months of receipts covered at a price that rounds to noise.