# ExtractDocument

Extracting documents using this method requires 4 parameters including document type, which you can get by using the GetDocumentTypesByCategoryUUID method. If these parameters are valid, after 10 to 15 seconds later, a relatively big JSON/XML file be output as the result.

## ExtractDocument

<mark style="color:green;">`POST`</mark> `https://testapi.onvision.ai/wsservice.asmx`

Use this method to extract your files into a JSON format.

#### Path Parameters

| Name         | Type   | Description                            |
| ------------ | ------ | -------------------------------------- |
| TOKEN        | string | Token                                  |
| Filename     | string | File name                              |
| byteArray    | array  | Byte array (base64Binary)              |
| DocumentType | string | Document type (Invoice, Contract etc.) |

{% tabs %}
{% tab title="200 Response when the credentials are valid." %}

```javascript
{
  "Envelope": {
    "Success": "1",
    "Message": "",
    "Info": {
      "Version": "1.0.0",
      "Run_Date": "20211006210223",
      "Executed_ms": "4458.4009"
    },
    "Result": {
      "document": {
        "system_info": {
          "version": "1.0",
          "UUID": "adbfc21d-3c5b-4b42-a4fb-9267da64c78c",
          "filename": "7400218220.pdf",
          "pagecount": "4",
          "templateid": "88a76c3d-b8ab-49c0-a8ce-e1773a109263",
          "templatename": "BP_Swzrlnd_Sam",
          "decimalseperator": ",",
          "thousandseperator": ".",
          "dateformat": "dd sss yyyy",
          "category": "Accounting",
          "documenttype": "Invoice",
          "result": "success"
        },
        "data": {
          "Custom_Fields": {
            "CustomField2": "Location of Delivery: ZRH/LSZH - ZURICH AIRPORT",
            "CustomField1": "Country of Delivery: Switzerland"
          },
          "Due_Date": "07 OCT 2021",
          "Invoice_Date": "30 SEP 2021",
          "Invoice_Number": "7400218220",
          "Sender": {
            "Sender_VAT": "VAT No.: CHE-354.852.968 MWST",
            "Sender_Address3": "CH-6300 ZUG",
            "Sender_Address2": "Baarerstrasse 139",
            "Sender_Address1": "Zweigniederlassung BP (Switzerland) Zug",
            "Sender_Company": "BP Europa SE, Hamburg,"
          },
          "Receiver": {
            "Receiver_VAT": "VAT No.: TR7230047085",
            "Receiver_Address3": "KURTKOY PENDICK",
            "Receiver_Address2": "OSMANLI BULVARI NO 101",
            "Receiver_Address1": "AEROPARK YENISEHIR MAH",
            "Receiver_Company": "XYZ AIRLINES"
          },
          "Currency": "USD",
          "Invoice_Total": "14,532.59",
          "Line_Items": {
            "Line_Item": [
              {
                "Line_Info_1": "0.00",
                "Line_Total": "4,304.34",
                "Quantity": "7,234.000 L",
                "Item_Description": "PC948",
                "Item_Name": "28 SEP 21",
                "Item_No": "1",
                "Unit_Price": "4,076.30",
                "Line_Info_2": "JET A-1"
              },
              {
                "Line_Info_1": "0.00",
                "Line_Total": "5,240.13",
                "Quantity": "8,829.000 L",
                "Item_Description": "PC948",
                "Item_Name": "2",
                "Item_No": "2",
                "Unit_Price": "4,975.06",
                "Line_Info_2": "JET A-1"
              },
              {
                "Line_Info_1": "0.00",
                "Line_Total": "4,944.44",
                "Quantity": "8,325.000 L",
                "Item_Description": "PC948",
                "Item_Name": "3",
                "Item_No": "3",
                "Unit_Price": "4,691.06",
                "Line_Info_2": "JET A-1"
              },
              {
                "Line_Info_1": "",
                "Line_Total": "",
                "Quantity": "1.000 EA",
                "Item_Description": "PC5304",
                "Item_Name": "29 SEP 21",
                "Item_No": "4",
                "Unit_Price": "43.68",
                "Line_Info_2": "No Fuel Fee"
              }
            ]
          }
        }
      }
    }
  }
}
```

{% endtab %}
{% endtabs %}

## ExtractDocument

<mark style="color:green;">`POST`</mark> `https://testapi.onvision.ai/wsserviceNet.asmx`

Use this method to extract your files into a XML format.

#### Path Parameters

| Name         | Type   | Description                            |
| ------------ | ------ | -------------------------------------- |
| TOKEN        | string | Token                                  |
| Filename     | string | File name                              |
| byteArray    | array  | Byte array (base64Binary)              |
| DocumentType | string | Document type (Invoice, Contract etc.) |

{% tabs %}
{% tab title="200 Response when credentials are valid." %}

```markup
<Envelope debug="true">
	<script id="FirebugLiteCSPTest" firebugIgnore="true" extension="Chrome" extension-id="ehemiojjcpldeipjhjkepfdaohajpbdo"/>
	<Success>1</Success>
	<Message></Message>
	<Info>
		<Version>1.0.0</Version>
		<Run_Date>20211008074516</Run_Date>
		<Executed_ms>1907.0122</Executed_ms>
	</Info>
	<Result>
		<document>
			<system_info>
				<version>1.0</version>
				<UUID>adbfc21d-3c5b-4b42-a4fb-9267da64c78c</UUID>
				<filename>7400218220.pdf</filename>
				<pagecount>4</pagecount>
				<templateid>88a76c3d-b8ab-49c0-a8ce-e1773a109263</templateid>
				<templatename>BP_Swzrlnd_Sam</templatename>
				<decimalseperator>,</decimalseperator>
				<thousandseperator>.</thousandseperator>
				<dateformat>dd sss yyyy</dateformat>
				<category>Accounting</category>
				<documenttype>Invoice</documenttype>
				<result>success</result>
			</system_info>
			<data>
				<Custom_Fields>
					<CustomField2>Location of Delivery: ZRH/LSZH - ZURICH AIRPORT</CustomField2>
					<CustomField1>Country of Delivery: Switzerland</CustomField1>
				</Custom_Fields>
				<Due_Date>07 OCT 2021</Due_Date>
				<Invoice_Date>30 SEP 2021</Invoice_Date>
				<Invoice_Number>7400218220</Invoice_Number>
				<Sender>
					<Sender_VAT>VAT No.: CHE-354.852.968 MWST</Sender_VAT>
					<Sender_Address3>CH-6300 ZUG</Sender_Address3>
					<Sender_Address2>Baarerstrasse 139</Sender_Address2>
					<Sender_Address1>Zweigniederlassung BP (Switzerland) Zug</Sender_Address1>
					<Sender_Company>BP Europa SE, Hamburg,</Sender_Company>
				</Sender>
				<Receiver>
					<Receiver_VAT>VAT No.: TR7230047085</Receiver_VAT>
					<Receiver_Address3>KURTKOY PENDICK</Receiver_Address3>
					<Receiver_Address2>OSMANLI BULVARI NO 11</Receiver_Address2>
					<Receiver_Address1>AEROPARK YENISEHIR MAH</Receiver_Address1>
					<Receiver_Company>PEGASUS AIRLINES</Receiver_Company>
				</Receiver>
				<Currency>USD</Currency>
				<Invoice_Total>14,532.59</Invoice_Total>
				<Line_Items>
					<Line_Item>
						<Line_Info_1>0.00</Line_Info_1>
						<Line_Total>4,304.34</Line_Total>
						<Quantity>7,234.000 L</Quantity>
						<Item_Description>PC948</Item_Description>
						<Item_Name>28 SEP 21</Item_Name>
						<Item_No>1</Item_No>
						<Unit_Price>4,076.30</Unit_Price>
						<Line_Info_2>JET A-1</Line_Info_2>
					</Line_Item>
					<Line_Item>
						<Line_Info_1>0.00</Line_Info_1>
						<Line_Total>5,240.13</Line_Total>
						<Quantity>8,829.000 L</Quantity>
						<Item_Description>PC948</Item_Description>
						<Item_Name>2</Item_Name>
						<Item_No>2</Item_No>
						<Unit_Price>4,975.06</Unit_Price>
						<Line_Info_2>JET A-1</Line_Info_2>
					</Line_Item>
					<Line_Item>
						<Line_Info_1>0.00</Line_Info_1>
						<Line_Total>4,944.44</Line_Total>
						<Quantity>8,325.000 L</Quantity>
						<Item_Description>PC948</Item_Description>
						<Item_Name>3</Item_Name>
						<Item_No>3</Item_No>
						<Unit_Price>4,691.06</Unit_Price>
						<Line_Info_2>JET A-1</Line_Info_2>
					</Line_Item>
					<Line_Item>
						<Line_Info_1></Line_Info_1>
						<Line_Total></Line_Total>
						<Quantity>1.000 EA</Quantity>
						<Item_Description>PC5304</Item_Description>
						<Item_Name>29 SEP 21</Item_Name>
						<Item_No>4</Item_No>
						<Unit_Price>43.68</Unit_Price>
						<Line_Info_2>No Fuel Fee</Line_Info_2>
					</Line_Item>
				</Line_Items>
			</data>
		</document>
	</Result>
</Envelope>
```

{% endtab %}
{% endtabs %}


---

# 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://docs.onvision.ai/api-book/api/extractdocument.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.
