# Getting Started with the Photon Commerce API

![](https://4161106631-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0zMiNy2MBXFrlb14q6%2F-M3bfRC2_p0TuVoKqZNe%2F-M3bgtX37hPvljMQP3EP%2F656167_Make%20data%20graphic_V1_022620.png?alt=media\&token=c2b23768-c5af-45a5-a6e3-576ec957ad92)

Welcome and thank you for checking out [Photon Commerce](https://www.photoncommerce.com)'s APIs!&#x20;

For POSTMAN API documentation, please visit: [this](http://apidocs.photoncommerce.com)

Photon Commerce can analyze and extract information from invoices using a powerful combination of Artificial Intelligence (AI) and Optical Character Recognition (OCR). Our API enables customers to take invoices in various formats and return structured data to automate invoice processing. It extracts key information from invoices like text, total amount, balance due, tax, vendor name, vendor address, invoice date, invoice due date, invoice number, ship to, bill to, line items and more.

The API returns key information in an organized structured JSON response. Documents can be from various formats and quality, including phone-captured images, scanned documents, Excel or Word documents, and digital PDFs.

The Photon Commerce API is organized around [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer). Our API has predictable resource-oriented URLs, accepts [form-encoded](https://en.wikipedia.org/wiki/POST_\(HTTP\)#Use_for_submitting_web_forms) request bodies, returns [JSON-encoded](http://www.json.org/) responses, and uses standard HTTP response codes, authentication, and verbs.

Replace any places in the snippets having <*your\_api*\_*key>* with your provisioned api key.

Photon Commerce's various AI APIs may or may not be powered in part by its own proprietary pipelines, OpenAI, Microsoft, AWS, Nvidia, UIPath, and/or other cutting edge automation technologies.

What languages does Photon's API support?

Arabic \
Chinese \
Danish \
Dutch \
English\
Filipino \
French \
German \
Greek \
Hebrew \
Hindi \
Indonesian \
Italian \
Japanese \
Korean \
Portuguese \
Russian \
Spanish

If you have any questions, you are welcome to contact [Photon Commerce](https://www.photoncommerce.com) at api @ photoncommerce.com to be set up with an account, or you can register for api keys and credentials by providing your email address and password. The details are provided in the next section.

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](http://en.wikipedia.org/wiki/Basic_access_authentication). Provide your credentials in the header. All API requests must be made over [HTTPS](http://en.wikipedia.org/wiki/HTTP_Secure). API requests without authentication will also fail.

## Call the API on sample documents instantly without having to sign up for credentials

To enable users to test our API without having to sign up for credentials, here are the sample documents and document-specific credentials.&#x20;

Document 1 - An Invoice (PDF): <https://photon-api-demo.s3.us-west-1.amazonaws.com/demo_docs/02-02-2021_-_TuneGO_2.0.pdf>

{% tabs %}
{% tab title="cURL" %}
`curl -H "CLIENT-ID:`*`8z-AyFQ8LRPrg" -H "AUTHORIZATION:apikey apiphotoncommerce.com:example_test_api_key_1" -H 'PASSWORD:`*`wAIz0y1oyAdKmQ`*`' -H "SECRET-KEY:yz3YLXyPApmWv_srfGMu" -X POST "https://api.photoncommerce.com/api/v4?`*`url=https://photon-api-demo.s3.us-west-1.amazonaws.com/demo_docs/02-02-2021_-_TuneGO_2.0.pdf"`
{% endtab %}

{% tab title="Python" %}

```python
import requests

def test_demo_invoice():
    URL = 'https://api.photoncommerce.com/api/v4?url=https://photon-api-demo.s3.us-west-1.amazonaws.com/demo_docs/02-02-2021_-_TuneGO_2.0.pdf'
    headers = {
        'CLIENT-ID': '_8z-AyFQ8LRPrg',
        'AUTHORIZATION': 'apikey apiphotoncommerce.com:example_test_api_key_1',
        'PASSWORD':'wAIz0y1oyAdKmQ',
        'SECRET-KEY':'yz3YLXyPApmWv_srfGMu'
    }

    r = requests.post(URL, headers=headers)
    return r.json()
    
r = test_demo_invoice()
print(r)
```

{% endtab %}
{% endtabs %}

Document 2 - A receipt (PNG): <https://photon-api-demo.s3.us-west-1.amazonaws.com/demo_docs/lineitem_receipt.png>

{% tabs %}
{% tab title="cURL" %}
`curl -H "CLIENT-ID:_8z-AyFQ8LRPrg" -H "AUTHORIZATION:apikey`` `*`apiphotoncommerce.com`*`:example_test_api_key_2" -H 'PASSWORD:wAIz0y1oyAdKmQ' -H "SECRET-KEY:yz3YLXyPApmWv_srfGMu" -X POST "`*`https://api.photoncommerce.com`*`/api/v4?url=https://photon-api-demo.s3.us-west-1.amazonaws.com/demo_docs/lineitem_receipt.png"`
{% endtab %}

{% tab title="Python" %}

```python
import requests

def test_demo_receipt():
    URL = 'https://api.photoncommerce.com/api/v4?url=https://photon-api-demo.s3.us-west-1.amazonaws.com/demo_docs/lineitem_receipt.png'
    headers = {
        'CLIENT-ID': '_8z-AyFQ8LRPrg',
        'AUTHORIZATION': 'apikey apiphotoncommerce.com:example_test_api_key_2',
        'PASSWORD':'wAIz0y1oyAdKmQ',
        'SECRET-KEY':'yz3YLXyPApmWv_srfGMu'
    }

    r = requests.post(URL, headers=headers)
    return r.json()

r = test_demo_receipt()
print(r)
```

{% endtab %}
{% endtabs %}

\*Note: The credentials being used in this section will only work on these 2 sample documents.

Next, you can register your own account, analyze your own files, and receive confidence scores on our analysis:

* [Register a new account](https://photon-commerce.gitbook.io/photon-commerce-api/master/register-a-new-account)
* [Analyze your own files](https://photon-commerce.gitbook.io/photon-commerce-api/master/capture-an-invoice-or-receipt-in-real-time)
* [Receive confidence scores](https://photon-commerce.gitbook.io/photon-commerce-api/master/confidence-scores-and-coordinates)
