Process Documents v2

Capture an invoice or receipt in real time

A typical REST API POST of a PDF that is less than 1MB is 3-7 seconds to return a structured JSON response. API code in various languages, such as python, node, PHP, JAVA, C#, CURL, etc., are available upon request.

The Photon Commerce API uses an API Key, Client_ID, secret key, and username, password, to authenticate requests. You can view these credentials on the account page.

Your credentials carry many privileges, so be sure to keep them secure! Do not share your credentials in publicly accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Basic Auth. Provide your credentials in the header. You do not need to provide a password.

All API requests must be made over HTTPS. API requests without authentication will also fail.

post
Invoice and receipt capture

https://api.photoncommerce.com/api/v1/process_document
Provide a path to your document and get structured JSON response of extracted fields.
Request
Response
Request
Headers
Authorization
required
string
Pass your email address and unique API key in the form 'api key <your_email>:<your_api_key>'
Client_ID
required
string
Unique Client_ID for every user. Incorrect value will lead to an authorization error.
Form Data Parameters
file
required
string
The path to the pdf, document, or image needing to be captured.
Response
200: OK
{
"File_ID": 373,
"JSON_extracted": "{\"Total\": 0.0, \"Date\": \"2020-10-05\", \"Category\": \"Warehouse\", \"Invoice_Number\": \"7862\", \"Account_Number\": \"\", \"Bill_To_Name\": \"HARTELL\", \"Bill_To_Address\": \"100 E Graham Place\\nBurbank CA 91502\", \"Card_Number\": \"\", \"Currency_Code\": \"USD\", \"Discount\": 0.0, \"Due_Date\": \"\", \"Payment_Display_Name\": \"\", \"Payment_Terms\": \"\", \"Payment_Type\": \"\", \"Phone_Number\": \"585-398-2000\", \"Reference_Number\": \"VBCBB-3659\", \"Shipping\": 0.0, \"Subtotal\": 0.0, \"Tax\": 0.0, \"Tip\": 0.0, \"Tracking_Number\": \"\", \"Vat_Number\": \"\", \"Vendor_Account_Number\": \"\", \"Vendor_Bank_Name\": \"\", \"Vendor_Bank_Number\": \"\", \"Vendor_Name\": \"Global Point Technology USA\", \"Vendor_Address\": \"5815 Co Rd 41, Farmington, NY 14425, USA\", \"Vendor_Recipient\": \"\", \"Vendor_Company\": \"\", \"Vendor_Address_Line\": \"5815 41\", \"Vendor_City\": \"Farmington\", \"Vendor_State\": \"NY\", \"Vendor_Zipcode\": \"14425\", \"Vendor_Phone\": \"585-398-2000\", \"PO_Number\": \"2393905\", \"Line_Items\": [{\"Line\": 1, \"SKU\": \"100445\", \"Description\": \"Sales Order: 38587\", \"QTY\": 1.0, \"Unit\": \"\", \"Price\": 432.0, \"Amount\": 432.0}, {\"Line\": 2, \"SKU\": \"\", \"Description\": \"100445 / MOTOR 208/230VAC\\nSHADED POLE BASED ON\", \"QTY\": 1.0, \"Unit\": \"\", \"Price\": 0.0, \"Amount\": 0.0}, {\"Line\": 3, \"SKU\": \"100220\", \"Description\": \"NEW CONNECTOR\", \"QTY\": 1.0, \"Unit\": \"\", \"Price\": 0.0, \"Amount\": 0.0}, {\"Line\": 4, \"SKU\": \"100445\", \"Description\": \"MADE IN CHINA HTS\\n8501.40.4040\", \"QTY\": 1.0, \"Unit\": \"\", \"Price\": 0.0, \"Amount\": 0.0}], \"Raw_Text\": \"Global Point Technology\\t\\tPhone::\\t585.398.2000\\n5815 County Road 41\\t\\t\\tFax:\\t585.398.2025\\nFarmington NY 14425\\n\\tUSA\\nGLOBAL POINT\\nTECHNOLOGY\\nPack Slip: 7862\\t\\t\\t\\tPacking Slip\\t\\t\\tPage:\\t1 of 1\\nShip To:\\t\\t\\t\\t\\t\\tSold To:\\nHARTELL\\t\\t\\t\\t\\t\\tMilton Roy - Flow Control Division\\n100 E Graham Place\\t\\t\\t\\t\\t201 Ivyland Road\\nBurbank CA 91502\\t\\t\\t\\t\\tIvyland PA 18974 USA\\nUSA\\n\\nPhone:\\t\\t\\t\\t\\t\\tPhone:\\nFax:\\t\\t\\t\\t\\t\\t\\tFax:\\nEmail:\\t\\t\\t\\t\\t\\t\\tEmail:\\nPO:\\t2393905\\tShip Via:\\tRECON LOGISTICS\\tFOB:\\tGlobal Point Tech. USA\\nShip Date: 5/20/2020\\tTracking No:\\t\\t\\tSales Rep: House Account\\n\\nLine\\tPlanned Qty\\tShipped Qty\\tBackorder\\tPart Number\\t\\tRevision\\n\\nSales Order: 38587\\n1\\t432.00\\t432.00\\t0.00 100445\\n\\t100445 / MOTOR 208/230VAC\\n\\tSHADED POLE BASED ON\\n\\t100220 NEW CONNECTOR\\n\\t100445 MADE IN CHINA HTS:\\n\\t8501.40.4040\", \"photon_key\": \"data/app/20201005_142803_PDT_I1.json\"}",
"Upload_Count": 9
}

Field

Type

Description

File_ID

int

Unique file id that can be used to extract this document

JSON_extracted

string

A string representation of the fields extracted from the document with their corresponding values

Upload_Count

int

The number of documents uploaded by the user

Invoice_Number

string

Invoice number

PO_Number

string

Purchase Order number

Date

string <yyyy-MM-dd>

Document date as it appears in the document

Payment_Terms

string

Terms of payment, e.g., Net-30

Due_Date

string <yyyy-MM-dd>

Invoice due date

Currency_Code

string

Currency code, e.g., USD, EUR, CNY, etc.

Discount

decimal

Discount provided on the invoice or receipt

Vat_Number

string

The Value Added Tax number, e.g., 12-3456789

Total

decimal

Total of the invoice or receipt

The follow describes the complete fields and value types. For an example response, please see the above "Response" tab.

{
"File_ID": <unique file id>,
"JSON_extracted": "{
# invoice info
"Invoice_Number": "<invoice number>",
"PO_Number": "<purchase order>",
"Date": "<invoice date yyyy-MM-dd>",
"Payment_Terms": "<interpreted terms, e.g. Net-30>",
"Due_Date": "<invoice due date yyyy-MM-dd>",
"Currency_Code": "<currency code e.g. USD>",
"Discount": < decimal percent discount > ,
"Vat_Number": "<tax number e.g. 12‑3456789>",
# purchase info
"Total": <decimal dollar amount> ,
"Shipping": <decimal dollars found for shipping> ,
"Subtotal": <decimal pretax dollars subtotal>,
"Tax": <decimal dollars found for tax> ,
"Tip": <decimal dollars found for tip> ,
"Line_Items": [{
"Line": <integer incrementing counter> ,
"SKU": <parsed SKU code>,
"Description": <raw description>,
"QTY": <decimal number of units>,
"Unit": <unit of measure>,
"Price": <decimal unit price > ,
"Amount": <decimal total pricing>
}],
"Tracking_Number": "<shipment info>",
# recipient/payer info
"Account_Number": <payer account number>,
"Bill_To_Name": <payer company name>,
"Bill_To_Recipient": <payer name>,
"Bill_To_Address": <payer address>,
"Bill_To_Address_Line": <parsed payer address line 1>,
"Bill_To_City": <parsed payer city>,
"Bill_To_State": <parsed payer state>,
"Bill_To_Zipcode": <parsed payer postal code>,
"Card_Number": <payment credit card number if present>,
"Payment_Display_Name": <fulltext of payment card info if present e.g. ***9999>,
"Payment_Type": <inferred payment method e.g. Visa>,
# vendor info
"Vendor_Account_Number": <bank account number>,
"Vendor_Bank_Name": <Bank name for payment routing>,
"Vendor_Bank_Number": <Bank acct # for payment routing>,
"Vendor_Name": <invoice issuing vendor name>,
"Vendor_Address": <Full unparsed address of vendor company>,
"Vendor_Recipient": <personal name of the vendor>,
"Vendor_Address_Line": <parsed address line 1 and 2>,
"Vendor_City": <parsed city>,
"Vendor_State": <full state e.g. California or state code e.g. CA>,
"Vendor_Zipcode": <parsed postal code>,
"Vendor_Phone": <vendor phone number - raw>,
"Phone_Number": <payer phone number>,
"All_Email_Addresses": <comma-separated list of emails found in invoice>,
# Photon info
"Category": <interpretation of document type>,
"Raw_Text": <full parsed text>,
"Reference_Number": <internal photon ref #>,
"photon_key": <photon file location>
}",
"Upload_Count": <number of documents uploaded by the user>
}