RecognizeCarInvoice

Updated at:

Supports structured recognition and output of key fields including invoice code, invoice number, invoice date, invoice amount, VAT tax amount, certificate number, purchaser name, and purchaser ID number/code.

Operation description

Applicable scenarios

  • Alibaba Cloud motor vehicle sales invoice recognition is an officially self-developed OCR text recognition product. It is applicable to scenarios where you need to recognize key information on vehicle purchase invoices, such as invoice amount, purchaser name, vehicle type, brand model, and seller name.

  • Alibaba Cloud OCR products are built on the powerful AI technology and massive data resources of Alibaba DAMO Academy. After years of development and refinement, they offer high service stability, easy operation, real-time performance, and comprehensive capabilities.

  • Sample image for this API

Core capabilities

CategorizationDescription
Image formatsSupports PNG, JPG, JPEG, BMP, GIF, TIFF, and WebP.
Image enhancementImage enhancement is enabled by default, including automatic image rotate, automatic distortion correction, and automatic enhancement of blurry images.
Multiple type coverageSupports image recognition of low-quality images with blur, uneven lighting, perspective distortion, and arbitrary backgrounds.
High accuracyThe overall recognition accuracy can reach 98%.

How to use this API

StepDescription
1Activate the Invoice and Certificate Recognition service. Before or after activation, you can try the recognition feature for free in the Experience Center.
2Purchase a Motor Vehicle Sales Invoice Recognition resource plan. This API provides a free quota for testing. You can also skip purchasing a resource plan, and the system will automatically deduct fees based on actual usage through the "pay-as-you-go" billing method.
3Refer to the code samples provided on the debug page to complete API integration. After integration, invoke the API to obtain recognition results. If you use a RAM user to invoke the API, the Alibaba Cloud account must grant authorization to the Resource Access Management (RAM) users. For information about how to create a RAM user, see Create a RAM user. The OCR service provides a system policy named AliyunOCRFullAccess. For information about how to grant permissions, see Grant permissions to a RAM user on the Users page.

Important notes

TypeDescription
Image formats
  • This API supports PNG, JPG, JPEG, BMP, GIF, TIFF, and WebP. PDF format is not supported.

Image dimensions
  • The image width and height must be greater than 15 pixels and less than 8192 pixels.

  • The aspect ratio must be less than 50.

  • For optimal recognition results, both width and height should be greater than 500 px.

Image size
  • The image binary file cannot exceed 10 MB.

  • Large images affect API response speed. Use images smaller than 1.5 MB for recognition and invoke the API by passing the image URL.

Related capabilities

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ocr:RecognizeCarInvoice

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Url

string

No

  • Either this field or the body field must be specified. You cannot specify both or leave both empty.

  • The URL of the image (up to 2048 bytes, base64 not supported).

https://img.alicdn.com/tfs/TB1hC7bXCzqK1RjSZPcXXbTepXa-832-616.jpg

body

string

No

  • Either this field or the URL field must be specified. You cannot specify both or leave both empty.

  • The image binary file, up to 10 MB.

  • When using HTTP, place the image binary file in the HTTP body for upload.

  • When using the SDK, place the image in the SDK body.

Image binary file

Response elements

Element

Type

Description

Example

object

Schema of Response

Code

string

The fault code. This field is not returned if the recognition is successful.

noPermission

Data

string

The returned data.

{ "data": { "taxCode": "0492725/*+0/法55337*<56-24/*184-/*<94 16-6+9*-897+98546/<>74*++16<43800*>+-< 116*丰1<4201/*18+-/74*++16<43800*>+-< 116*丰1<4201/*18+-/

Message

string

The fault message. This field is not returned if the recognition is successful.

You are not authorized to perform this operation.

RequestId

string

The unique request ID.

43A29C77-405E-4CC0-BC55-EE694AD00655

Metric description of response elements


FieldTypeDescription
dataobjectThe structured information.
sliceRectlistThe coordinate information of detected sub-images.
prism_keyValueInfolistThe coordinate information of structured fields.
ftypeintIndicates whether the document is a photocopy (1: yes, 0: no).
heightintThe height of the image after algorithm correction.
widthintThe width of the image after algorithm correction.
orgHeightintThe height of the original image.
orgWidthintThe width of the original image.

Recognition results (data field)

FieldTypeDescription
taxCodestringThe tax control code.
invoiceDatestringThe invoice date.
invoiceCodestringThe invoice code.
invoiceNumberstringThe invoice number.
machineCodestringThe machine code.
purchaserNamestringThe purchaser name.
purchaseCodestringThe purchaser ID number/organization code.
vehicleTypestringThe vehicle type.
brandModestringThe brand model.
originstringThe place of origin.
certificateNumberstringThe certificate number.
importCertificateNumberstringThe import certificate number.
commodityInspectionNumberstringThe commodity inspection number.
engineNumberstringThe engine number.
vinCodestringThe vehicle identification number (VIN)/frame number.
invoiceAmountCnstringThe total amount including tax (in Chinese characters).
invoiceAmountstringThe total amount including tax (in digits).
sellerNamestringThe seller name.
sellerContactstringThe seller phone number.
sellerTaxNumberstringThe seller taxpayer identification number.
sellerBankAccountstringThe seller bank account number.
sellerAddressstringThe seller address.
sellerDepositaryBankstringThe seller depositary bank.
taxRatestringThe VAT rate or levy rate.
taxstringThe VAT amount.
taxAuthoritiesInfostringThe tax authority name and code.
taxAuthoritiesNamestringThe tax authority name.
taxAuthoritiesCodestringThe tax authority code.
preTaxAmountstringThe pre-tax amount.
passengerLimitNumberstringThe passenger limit.
issuerstringThe invoice issuer.
tonnagestringThe tonnage.
purchaserTaxNumberstringThe purchaser taxpayer identification number.
taxPaymentNumberstringThe tax payment certificate number.

Structured coordinate information (prism_keyValueInfo field)

FieldTypeDescription
keystringThe recognized field name.
keyProbintThe confidence score of the field name.
valuestringThe value corresponding to the recognized field name.
valueProbintThe


Examples

Success response

JSON format

{
  "Code": "noPermission",
  "Data": "{\n      \"data\": {\n            \"taxCode\": \"0492725/*+0/法55337*<56-24/*184-/*<94 16-6+9*-897+98546/<>74*++16<43800*>+-< 116*丰1<4201/*18+-/74*++16<43800*>+-< 116*丰1<4201/*18+-/                  \"valuePos\": [\n                        {\n                              \"x\": 203,\n                              \"y\": 510\n                        },\n                        {\n                              \"x\": 203,\n                              \"y\": 524\n                        },\n                        {\n                              \"x\": 176,\n                              \"y\": 524\n                        },\n                        {\n                              \"x\": 176,\n                              \"y\": 510\n                        }\n                  ],\n                  \"valueProb\": 99\n            },\n            {\n                  \"key\": \"tax\",\n                  \"keyProb\": 100,\n                  \"value\": \"14384.62\",\n                  \"valuePos\": [\n                        {\n                              \"x\": 413,\n                              \"y\": 509\n                        },\n                        {\n                              \"x\": 413,\n                              \"y\": 524\n                        },\n                        {\n                              \"x\": 323,\n                              \"y\": 524\n                        },\n                        {\n                              \"x\": 323,\n                              \"y\": 509\n                        }\n                  ],\n                  \"valueProb\": 100\n            },\n            {\n                  \"key\": \"taxAuthoritiesInfo\",\n                  \"keyProb\": 100,\n                  \"value\": \"安阳县国家税务局341052200\",\n                  \"valuePos\": [\n                        {\n                              \"x\": 633,\n                              \"y\": 498\n                        },\n                        {\n                              \"x\": 633,\n                              \"y\": 525\n                        },\n                        {\n                              \"x\": 537,\n                              \"y\": 525\n                        },\n                        {\n                              \"x\": 537,\n                              \"y\": 498\n                        }\n                  ],\n                  \"valueProb\": 99\n            },\n            {\n                  \"key\": \"taxAuthoritiesName\",\n                  \"keyProb\": 100,\n                  \"value\": \"安阳县国家税务局\",\n                  \"valuePos\": [\n                        {\n                              \"x\": 633,\n                              \"y\": 498\n                        },\n                        {\n                              \"x\": 633,\n                              \"y\": 525\n                        },\n                        {\n                              \"x\": 537,\n                              \"y\": 525\n                        },\n                        {\n                              \"x\": 537,\n                              \"y\": 498\n                        }\n                  ],\n                  \"valueProb\": 99\n            },\n            {\n                  \"key\": \"taxAuthoritiesCode\",\n                  \"keyProb\": 100,\n                  \"value\": \"341052200\",\n                  \"valuePos\": [\n                        {\n                              \"x\": 633,\n                              \"y\": 498\n                        },\n                        {\n                              \"x\": 633,\n                              \"y\": 525\n                        },\n                        {\n                              \"x\": 537,\n                              \"y\": 525\n                        },\n                        {\n                              \"x\": 537,\n                              \"y\": 498\n                        }\n                  ],\n                  \"valueProb\": 99\n            },\n            {\n                  \"key\": \"preTaxAmount\",\n                  \"keyProb\": 97,\n                  \"value\": \"84615.38\",\n                  \"valuePos\": [\n                        {\n                              \"x\": 216,\n                              \"y\": 557\n                        },\n                        {\n                              \"x\": 216,\n                              \"y\": 543\n                        },\n                        {\n                              \"x\": 305,\n                              \"y\": 544\n                        },\n                        {\n                              \"x\": 305,\n                              \"y\": 559\n                        }\n                  ],\n                  \"valueProb\": 97\n            },\n            {\n                  \"key\": \"passengerLimitNumber\",\n                  \"keyProb\": 100,\n                  \"value\": \"5\",\n                  \"valuePos\": [\n                        {\n                              \"x\": 723,\n                              \"y\": 545\n                        },\n                        {\n                              \"x\": 723,\n                              \"y\": 557\n                        },\n                        {\n                              \"x\": 714,\n                              \"y\": 557\n                        },\n                        {\n                              \"x\": 714,\n                              \"y\": 545\n                        }\n                  ],\n                  \"valueProb\": 100\n            },\n            {\n                  \"key\": \"issuer\",\n                  \"keyProb\": 100,\n                  \"value\": \"赵迪\",\n                  \"valuePos\": [\n                        {\n                              \"x\": 437,\n                              \"y\": 573\n                        },\n                        {\n                              \"x\": 437,\n                              \"y\": 588\n                        },\n                        {\n                              \"x\": 410,\n                              \"y\": 588\n                        },\n                        {\n                              \"x\": 410,\n                              \"y\": 573\n                        }\n                  ],\n                  \"valueProb\": 100\n            },\n            {\n                  \"key\": \"tonnage\",\n                  \"keyProb\": 100,\n                  \"value\": \"\",\n                  \"valueProb\": 100\n            },\n            {\n                  \"key\": \"purchaserTaxNumber\",\n                  \"keyProb\": 100,\n                  \"value\": \"410523197206046072\",\n                  \"valuePos\": [\n                        {\n                              \"x\": 730,\n                              \"y\": 240\n                        },\n                        {\n                              \"x\": 730,\n                              \"y\": 253\n                        },\n                        {\n                              \"x\": 569,\n                              \"y\": 253\n                        },\n                        {\n                              \"x\": 569,\n                              \"y\": 240\n                        }\n                  ],\n                  \"valueProb\": 100\n            },\n            {\n                  \"key\": \"taxPaymentNumber\",\n                  \"keyProb\": 100,\n                  \"value\": \"\",\n                  \"valueProb\": 100\n            }\n      ],\n      \"width\": 832\n}",
  "Message": "You are not authorized to perform this operation.",
  "RequestId": "43A29C77-405E-4CC0-BC55-EE694AD00655"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.