Receipt Scan AI Documentation

Quicky Start Guide

Easily scan receipts using Generative AI and extract data in JSON format.

1. Test by Scanning Receipts on the landing page

a. Go to http://receipt-scan-ai.web.app/#cta b. Upload a receipt image by dropping it in the box that says "Drop Image Here" c. Select model and enter its API key (Gemini or OpenAI) d. Finally, click submit and you will get the response Output

2. Get API Key for integration in your own website

a. Go to https://receipt-scan-ai.web.app b. Sign up with Google c. Navigate to the settings page d. Click on Generate API Key e. After generating API key, click on subscribe button to activate your subscription New users can avail a first month free trial. IMPORTANT: API Requests will fail if user is not subscribed.

API Integration in Web

URL: https://extractinvoicedatahttp-loshywauza-uc.a.run.app

Method: POST

Headers

{
  "Content-Type": "application/json"
}

Request Body

{
  "apiKey": "<YOUR_SUBSCRIPTION_API_KEY>",
  "modelKey": "<OPENAI_OR_GEMINI_API_KEY>",
  "model_type": "openai" | "gemini",
  "image": "<BASE64_ENCODED_IMAGE_STRING>"
}

cURL Command

curl -X POST https://extractinvoicedatahttp-loshywauza-uc.a.run.app \
  -H "Content-Type: application/json" \
  -d '{
    "apiKey": "YOUR_USER_API_KEY",
    "modelKey": "YOUR_MODEL_API_KEY",
    "model_type": "openai",
    "image": "BASE64_ENCODED_IMAGE_HERE"
  }'

Responses

Response for a valid Receipt Image

Provided Receipt Image:

Status: 200

Response Body

{"items": [
    "COKE ZERO 6X355ML",
    "LEBANESE MARGOOK",
    "SUNBULAH S POTATO",
    "PEPPERONI BEEF",
    "OREO MLK&CHO 36.8G",
    "ALMARAI BT UNS100G",
    "BARB LOIN CHOPKG",
    "MEHRAN ACHAR G 50G",
    "ALMR SOUR Y FF 1KG",
    "MEHRAN GIN/GAR750G",
    "ALMARAI BUTTER GHE"
    ],
    "invoice_date":"2021-04-26",
    "total_price":194.62,"tax":26.37,
    "isAiImageAReceipt":true
}

Response for a Non-Receipt Image

Status: 200

Response Body

{
  "items": null,
  "invoice_date": null,
  "total_price": null,
  "tax": null,
  "isAiImageAReceipt": false
}

Response when User is not subscribed or API Key is Invalid

Status: 400

Response Body

{"error":"Inactive or missing subscription."}

Response when some unexpected error occurs

Status: 500

Response Body

{"error": "Internal Server Error"}

Last updated