|
| 1 | +--- |
| 2 | +weight: 20 |
| 3 | +date: "2023-11-02" |
| 4 | +author: "Vladimir Lapin" |
| 5 | +type: docs |
| 6 | +url: /fetch-invoice-recognition-result/ |
| 7 | +feedback: OCRCLOUD |
| 8 | +title: Fetching invoice processing result |
| 9 | +description: How to get the parsed invoice data from the Aspose.OCR Cloud queue. |
| 10 | +keywords: |
| 11 | +- OCR |
| 12 | +- recognize |
| 13 | +- queue |
| 14 | +- get |
| 15 | +- obtain |
| 16 | +- fetch |
| 17 | +- result |
| 18 | +- invoice |
| 19 | +--- |
| 20 | + |
| 21 | +When an invoice is [submitted](/ocr/send-invoice-for-recognition/) for processing, it is [queued](/ocr/recognition-workflow/) to ensure a stable response even under high load. To obtain the result, send a **GET** request to the `https://api.aspose.cloud/v5.0/ocr/RecognizeAndParseInvoice` Aspose.OCR Cloud REST API endpoint. To authorize the request, pass the [access token](/ocr/authorization/) in **Authorization** header (_Bearer authentication_). |
| 22 | + |
| 23 | +Provide the [unique identifier](/ocr/send-invoice-for-recognition/#return-value) of the invoice processing task in `id` parameter: |
| 24 | + |
| 25 | +```bash |
| 26 | +curl --request GET --location 'https://api.aspose.cloud/v5.0/ocr/RecognizeAndParseInvoice?id=39b37b24-86e8-4e91-9a99-6c2574853eb5' \ |
| 27 | +--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...HaRYOxBcCRCPLnrFCVXpw7UA' \ |
| 28 | +``` |
| 29 | + |
| 30 | +## Processing results |
| 31 | + |
| 32 | +The processing result is returned in JSON format in the response body. |
| 33 | + |
| 34 | +```json |
| 35 | +{ |
| 36 | + "id": "39b37b24-86e8-4e91-9a99-6c2574853eb5", |
| 37 | + "responseStatusCode": "Ok", |
| 38 | + "taskStatus": "Completed", |
| 39 | + "results": [ |
| 40 | + { |
| 41 | + "type": "Text", |
| 42 | + "data": "eyJpc3N1ZV9kYXRlIjogIjIwMTctMTEtMjciL...sICJhY2NvdW50IjogIjJ4eHh4MG9veGsifQ==" |
| 43 | + } |
| 44 | + ], |
| 45 | + "error": null |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +{{% alert color="primary" %}} |
| 50 | +Processing results are stored in the Aspose cloud and can be obtained by the task ID within **24 hours** after the invoice was sent to Aspose.OCR Cloud. |
| 51 | +{{% /alert %}} |
| 52 | + |
| 53 | +Property | Type | Description |
| 54 | +--------- | ---- | ----------- |
| 55 | +`id` | string | Unique identifier of the invoice processing task. Equals to the value of the `id` request property. |
| 56 | +`taskStatus` | string | [Current state](#task-statuses) of the invoice processing task in the queue. |
| 57 | +`responseStatusCode` | string | Processing response status. |
| 58 | +`results` | Base64 encoded JSON | [Invoice details](#invoice-details) in JSON format.<br />The data is returned as Base64 encoded string. You must decode it to deserialize into an object, display on the screen or save to a file. |
| 59 | +`error/messages` | string[] | Processing error messages, if any.<br />Even if the invoice was processed, you can still get notifications and warnings about non-fatal processing errors. |
| 60 | + |
| 61 | +## Invoice details |
| 62 | + |
| 63 | +The parsed invoice contents are returned in JSON format: |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "issue_date": "2017-11-27", |
| 68 | + "due_date": "", |
| 69 | + "supplier_name": "abc exports", |
| 70 | + "supplier_address": "4300 longbeach blvd longbeach california 90807 united states", |
| 71 | + "supplier_email": "", |
| 72 | + "supplier_phone": "15627349957", |
| 73 | + "supplier_tax_id": "", |
| 74 | + "receiver_name": "abc imports", |
| 75 | + "receiver_address": "140 wecker road manstield brisbane queensland 4122 australia", |
| 76 | + "receiver_tax_id": "", |
| 77 | + "currency": "usd", |
| 78 | + "total_amount": 43550.0, |
| 79 | + "vat": -1, |
| 80 | + "net_amount": 43550.0, |
| 81 | + "bank_name": "bank of america", |
| 82 | + "bic": "", |
| 83 | + "account": "2xxxx0ooxk" |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +At the moment, Aspose.OCR API recognizes the following invoice data: |
| 88 | + |
| 89 | +Property | Format | Description |
| 90 | +-------- | ------ | ----------- |
| 91 | +"issue_date" | string | Invoice issue date in _YYYY-MM-dd_ format. |
| 92 | +"due_date" | string | Invoice due date in _YYYY-MM-dd_ format. |
| 93 | +"supplier_name" | string | Supplier or service provider name. |
| 94 | +"supplier_address" | string | Supplier or service provider address (as one string). |
| 95 | +"supplier_email" | string | Supplier or service provider email address. |
| 96 | +"supplier_phone" | string | Supplier or service provider phone number (as provided in the invoice, without conversion to international format). |
| 97 | +"supplier_tax_id" | string | Supplier or service provider TIN or similar ID. |
| 98 | +"receiver_name" | string | Receiver name. |
| 99 | +"receiver_address" | string | Receiver address (as one string). |
| 100 | +"receiver_tax_id" | string | Receiver TIN or similar ID. |
| 101 | +"currency" | string | Invoice currency. |
| 102 | +"total_amount" | number | Total (raw) amount due. |
| 103 | +"vat" | number | VAT, percent. `-1` if the value is missing in the invoice. |
| 104 | +"net_amount" | number | Net amount due. |
| 105 | +"bank_name" | string | Supplier's bank name. |
| 106 | +"bic" | string | Supplier's SWIFT or similar code. |
| 107 | +"account" | string | Supplier's account number. |
| 108 | + |
| 109 | +{{% alert color="primary" %}} |
| 110 | +The availability of the properties above depends on the invoice text and structure. |
| 111 | +{{% /alert %}} |
| 112 | + |
| 113 | +## Task statuses |
| 114 | + |
| 115 | +Processing may take up to several seconds depending on the Aspose.OCR cloud load and the size of the original scan or photo. The status of the processing task is indicated in the `taskStatus` property of the processing result. |
| 116 | + |
| 117 | +Status code | Description | To do |
| 118 | +----------- | ----------- | ------ |
| 119 | +Pending | The invoice is queued for processing, but not yet processed. | Try fetching the result in a couple of seconds using the same ID. |
| 120 | +Processing | The invoice is currently being processed. | Fetch the result again using the same ID. |
| 121 | +Completed | The invoice is processed. | Read the result from `results` property. |
| 122 | +Error | An error occurred during processing. | Check messages in the `error` property for more information. |
| 123 | +NotExist | The request with the specified ID does not exist, or the result has already been deleted from the cloud storage. | Check the ID or [send the invoice for processing](/ocr/send-invoice-for-recognition/) again with the same parameters. |
0 commit comments