# Retrieve Data

## Access extracted JSON of uploaded files

Fetch the JSON content of already processed files without needing to re-upload the document.

```
curl -H "CLIENT-ID:<your-client-id>" \
  -H "AUTHORIZATION:apikey <your-username>:<your-api-key>" \
  -H 'PASSWORD:<your-password>' \
  -H "SECRET-KEY:<your-secret-key" \ 
  "https://api.photoncommerce.com/api/v2/scanapis/json?photon_key=<photon_key>"
```

## Fetch JSON content

<mark style="color:blue;">`GET`</mark> `https://api.photoncommerce.com/api/v1/json`

Fetch JSON content of a specific file by passing the file id as a query parameter. Send a GET request using the same authentication technique(using username, password, api key, client id and secret key) to fetch the json data for previously uploaded invoices/receipts using the photon\_key.

#### Query Parameters

| Name        | Type   | Description                                                |
| ----------- | ------ | ---------------------------------------------------------- |
| photon\_key | string | The photon\_key of the uploaded file to fetch the JSON of. |

#### Headers

| Name          | Type   | Description                                                                                       |
| ------------- | ------ | ------------------------------------------------------------------------------------------------- |
| Secret key    | string | The secret key of your account                                                                    |
| Password      | string | The password to your account                                                                      |
| Authorization | string | Pass your email address and unique API key  in the form 'apikey \<your\_email>:\<your\_api\_key>' |
| Client\_ID    | string | Unique Client\_ID for every user. Incorrect value will lead to an authorization error.            |

{% tabs %}
{% tab title="200 " %}

```
[
  {
    "Account_Number": "", 
    "Bill_To_Address": "100 E Graham Place\nBurbank CA 91502", 
    "Bill_To_Name": "HARTELL", 
    "Card_Number": "", 
    "Category": "Warehouse", 
    "Currency_Code": "USD", 
    "Date": "2020-10-05", 
    "Discount": 0.0, 
    "Due_Date": "", 
    "Invoice_Number": "7862", 
    "Line_Items": [
      {
        "Amount": 432.0, 
        "Description": "Sales Order: 38587", 
        "Line": 1, 
        "Price": 432.0, 
        "QTY": 1.0, 
        "SKU": "100445", 
        "Unit": ""
      }, 
      {
        "Amount": 0.0, 
        "Description": "100445 / MOTOR 208/230VAC\nSHADED POLE BASED ON", 
        "Line": 2, 
        "Price": 0.0, 
        "QTY": 1.0, 
        "SKU": "", 
        "Unit": ""
      }, 
      {
        "Amount": 0.0, 
        "Description": "NEW CONNECTOR", 
        "Line": 3, 
        "Price": 0.0, 
        "QTY": 1.0, 
        "SKU": "100220", 
        "Unit": ""
      }, 
      {
        "Amount": 0.0, 
        "Description": "MADE IN CHINA HTS\n8501.40.4040", 
        "Line": 4, 
        "Price": 0.0, 
        "QTY": 1.0, 
        "SKU": "100445", 
        "Unit": ""
      }
    ], 
    "PO_Number": "2393905", 
    "Payment_Display_Name": "", 
    "Payment_Terms": "", 
    "Payment_Type": "", 
    "Phone_Number": "585-398-2000", 
    "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", 
    "Reference_Number": "VBCBB-3659", 
    "Shipping": 0.0, 
    "Subtotal": 0.0, 
    "Tax": 0.0, 
    "Tip": 0.0, 
    "Total": 0.0, 
    "Tracking_Number": "", 
    "Vat_Number": "", 
    "Vendor_Account_Number": "", 
    "Vendor_Address": "5815 Co Rd 41, Farmington, NY 14425, USA", 
    "Vendor_Address_Line": "5815 41", 
    "Vendor_Bank_Name": "", 
    "Vendor_Bank_Number": "", 
    "Vendor_City": "Farmington", 
    "Vendor_Company": "", 
    "Vendor_Name": "Global Point Technology USA", 
    "Vendor_Phone": "585-398-2000", 
    "Vendor_Recipient": "", 
    "Vendor_State": "NY", 
    "Vendor_Zipcode": "14425", 
    "photon_key": "data/app/20201005_142803_PDT_I1.json"
  }
]


```

{% endtab %}
{% endtabs %}

| Field           | Type                 | Description                                  |
| --------------- | -------------------- | -------------------------------------------- |
| 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.

```
[
	{
		# 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>
	}
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://photon-commerce.gitbook.io/photon-commerce-api/photon-retrieve-extracted-text.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
