GET
/
v1-preview
/
models
/
commercial-invoice
/
{documentId}
from abbyy_document_ai import DocumentAi
import os


with DocumentAi(
    api_key_auth=os.getenv("DOCUMENTAI_API_KEY_AUTH", ""),
) as document_ai:

    res = document_ai.models.commercial_invoice.get_extracted_fields(document_id="wh23anb5xjf0ntw5taase5qz")

    assert res.commercial_invoice is not None

    # Handle response
    print(res.commercial_invoice)
{
  "meta": {
    "id": "wh23anb5xjf0ntw5taase5qz",
    "name": "document.jpg",
    "createdAt": "2025-02-07T17:44:06.949Z",
    "model": "commercial-invoice",
    "status": "Processed",
    "pageCount": 10,
    "errors": [
      {
        "message": "Total is required"
      }
    ]
  },
  "fields": {
    "consignee": {
      "name": "Global Imports Ltd",
      "taxId": "GB123456789",
      "address": "456 Commerce Street, London, UK EC2A 4PB",
      "consigneeId": "CUST123",
      "postalCode": "EC2A 4PB",
      "street": "456 Commerce Street",
      "city": "London",
      "stateOrProvince": "Greater London",
      "country": "United Kingdom"
    },
    "vendor": {
      "name": "ACME Manufacturing Inc.",
      "taxId": "US123456789",
      "address": "123 Production Ave, Industrial Park, Detroit, MI 48201",
      "vendorId": "VEND456",
      "postalCode": "48201",
      "street": "123 Production Ave",
      "city": "Detroit",
      "stateOrProvince": "Michigan",
      "country": "United States",
      "nationalTaxId": "US123456789",
      "iban": "US12ABCD1234567890123456",
      "bankCode": "123456",
      "bankAccount": "987654321"
    },
    "shipTo": {
      "name": "Global Imports Ltd",
      "address": "456 Commerce Street, London, UK EC2A 4PB"
    },
    "billTo": {
      "name": "Global Imports Ltd",
      "address": "456 Commerce Street, London, UK EC2A 4PB"
    },
    "invoiceNumber": "INV123456",
    "invoiceDate": "2024-01-10",
    "dueDate": "2024-02-10",
    "countryOfOrigin": "United States",
    "countryOfExport": "United States",
    "countryOfDestination": "United Kingdom",
    "incoTerm": "DDP",
    "weight": 2750,
    "weightUom": "kg",
    "totalPallets": 25,
    "total": 50000,
    "currency": "USD",
    "additionalCosts": [
      {
        "type": "Freight",
        "amount": 2500,
        "currency": "USD"
      },
      {
        "type": "Insurance",
        "amount": 500,
        "currency": "USD"
      }
    ],
    "lineItems": [
      {
        "position": 1,
        "countryOfOrigin": "United States",
        "hsCode": "8483.30.51",
        "description": "Industrial machinery parts",
        "quantity": 50,
        "uom": "cartons",
        "unitPrice": 1000,
        "totalPrice": 50000,
        "currency": "USD",
        "netWeight": 2500,
        "netWeightUom": "kg",
        "grossWeight": 2750,
        "grossWeightUom": "kg"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Our API offers authentication via API keys. You can obtain an API key from https://developer.abbyy.com

Path Parameters

documentId
string
required

The id of the document

Response

200
application/json

Extracted Commercial Invoice Data Response

meta
object
required

Represents a document that has been submitted for processing.

Example:
{
  "id": "wh23anb5xjf0ntw5taase5qz",
  "name": "document.jpg",
  "createdAt": "2025-02-07T17:44:06.949Z",
  "model": "image-to-text",
  "status": "Processed",
  "pageCount": 10,
  "errors": [{ "message": "Total is required" }]
}
fields
object

Fields extracted from a commercial invoice

Example:
{
  "consignee": {
    "name": "Global Imports Ltd",
    "taxId": "GB123456789",
    "address": "456 Commerce Street, London, UK EC2A 4PB",
    "consigneeId": "CUST123",
    "postalCode": "EC2A 4PB",
    "street": "456 Commerce Street",
    "city": "London",
    "stateOrProvince": "Greater London",
    "country": "United Kingdom"
  },
  "vendor": {
    "name": "ACME Manufacturing Inc.",
    "taxId": "US123456789",
    "address": "123 Production Ave, Industrial Park, Detroit, MI 48201",
    "vendorId": "VEND456",
    "postalCode": "48201",
    "street": "123 Production Ave",
    "city": "Detroit",
    "stateOrProvince": "Michigan",
    "country": "United States",
    "nationalTaxId": "US123456789",
    "iban": "US12ABCD1234567890123456",
    "bankCode": "123456",
    "bankAccount": "987654321"
  },
  "shipTo": {
    "name": "Global Imports Ltd",
    "address": "456 Commerce Street, London, UK EC2A 4PB"
  },
  "billTo": {
    "name": "Global Imports Ltd",
    "address": "456 Commerce Street, London, UK EC2A 4PB"
  },
  "invoiceNumber": "INV123456",
  "invoiceDate": "2024-01-10",
  "dueDate": "2024-02-10",
  "countryOfOrigin": "United States",
  "countryOfExport": "United States",
  "countryOfDestination": "United Kingdom",
  "incoTerm": "DDP",
  "weight": 2750,
  "weightUom": "kg",
  "totalPallets": 25,
  "total": 50000,
  "currency": "USD",
  "additionalCosts": [
    {
      "type": "Freight",
      "amount": 2500,
      "currency": "USD"
    },
    {
      "type": "Insurance",
      "amount": 500,
      "currency": "USD"
    }
  ],
  "lineItems": [
    {
      "position": 1,
      "countryOfOrigin": "United States",
      "hsCode": "8483.30.51",
      "description": "Industrial machinery parts",
      "quantity": 50,
      "uom": "cartons",
      "unitPrice": 1000,
      "totalPrice": 50000,
      "currency": "USD",
      "netWeight": 2500,
      "netWeightUom": "kg",
      "grossWeight": 2750,
      "grossWeightUom": "kg"
    }
  ]
}
validationErrors
object[]

An array of validation errors that occurred while processing the document. These typically do not prevent field extraction, but rather indicate issues extracting key fields.