Async API

For async processing of your documents

Asynchronous API for batches and queues of documents

A typical REST API which accepts your documents and returns the photon key needed to access the result in less than a second. Be sure to save that photon key in order to be able to fetch the results later.

No need to wait for the results. You will be notified via email when the document has been processed and the result is ready to be fetched. This ASYNC API allows us to upload multiple documents, one after another with a minimal waiting time. Store the photon_key we send in the response and access it once you receive an email from Photon.

Invoice and receipt capture

POST https://api.photoncommerce.com/api/v4?type=async

Capture invoices and receipts using your Client ID, Client Secret, API Key and Username

Path Parameters

NameTypeDescription

type

string

Type of processing needed- sync or async Please pass type as 'async'

Headers

NameTypeDescription

PASSWORD

string

The password of the account

SECRET-KEY

string

The secret key of the account

AUTHORIZATION

string

Pass your username and unique API key in the form 'apikey <your_username>:<your_api_key>'

CLIENT-ID

string

Unique Client_ID for every user. Incorrect value will lead to an authorization error.

Request Body

NameTypeDescription

pdf

string

The path to the pdf, document, or image needing to be captured.

{'photon_key': 'data/<your_username>/<filename>.json', 'message': 'success', 'status': 'success'}
import requests

headers = {
    'CLIENT-ID': '<client-id>',
    'AUTHORIZATION': 'apikey <username>:<api-key>',
    'PASSWORD':'<Your-valid-password>',
    'SECRET-KEY':'<your-client-secret>'
}
files = {'pdf': open('<path-to-file>', 'rb')}

response = requests.post('https://api.photoncommerce.com/api/v4?type=async', headers=headers, files=files)

Once your document has been processed, you will receive an email from notifications@photoncommerce.com with the subject "Photon API - The document has been processed". Upon receiving this email, you can fetch the result using the photon_key we sent to you when you uploaded the document. In case you missed it, the email we send you will also contain the photon key.

You can use the fetch the json by following the steps mentioned under the section 'Retrieve Data (JSON)" on the "Getting Started with the Photon Commerce API" Page.

Async API Webhook

Please see the Async API Webhook page for instructions to set up a webhook.

Last updated