Mindee just released API Invoice V4 which now also reads line items from invoices … really cool!
I suspect that the Mindee node does not (yet) support this, and I therefore tried the HTTP Request node, but I can not get it to work.
I got it to work in Postman via Mindee’s open_api.json, but when I copy the cURL Code snippet to the HTTP Request Node, some things are lost in translation.
Does anybody have a suggestion on how to get this working? Thanks in advance.
cURL code snippet from Postman:
curl --location --request POST 'https://api.mindee.net/v1/products/mindee/invoices/v4/predict' \
--header 'Content-Type: multipart/form-data' \
--header 'Accept: application/json' \
--header 'Authorization: Token <my-api-key>' \
--form 'document=@"/Users/dick/Desktop/92470_202211301555.pdf"'
openApi-invoice-4.json:
{"components":{"requestBodies":{"Predict":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONPredict"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/FormDataPredict"}}},"required":true}},"responses":{"Error":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorPredictResponse"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ErrorPredictResponse"}}},"description":"Error"},"OK":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessPredictResponse"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/SuccessPredictResponse"}}},"description":"OK"}},"schemas":{"Confidence":{"description":"Confidence score","example":0.99,"format":"float","maximum":1,"minimum":0,"type":"number"},"ErrorPredictResponse":{"properties":{"api_request":{"description":"Information about your API request","properties":{"error":{"properties":{"code":{"description":"Error code","type":"string"},"details":{"description":"Detailed description of the error","type":"string"},"message":{"description":"Brief description of the error","type":"string"}},"type":"object"},"resources":{"example":[],"items":{"type":"string"},"type":"array"},"status":{"enum":["failure"],"example":"failure","type":"string"},"status_code":{"description":"HTTP status code","type":"integer"},"url":{"example":"https://api.mindee.net/v1/products/mindee/invoices/v4/predict","type":"string"}},"type":"object"}},"type":"object"},"FormDataPredict":{"properties":{"document":{"format":"binary","type":"string"}},"required":["document"],"type":"object"},"JSONPredict":{"properties":{"document":{"description":"can be a base64 or a HTTPS URL","example":"<base64 or URL>","type":"string"}},"required":["document"],"type":"object"},"MindeeInvoices4DocPrediction":{"properties":{"customer_address":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"Address of supplier.","example":"548 Market St, Suite 98568 San Francisco, California 94104-5401","type":"string"}},"type":"object"},"customer_company_registrations":{"items":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"type":{"description":"Generic: VAT NUMBER, TAX ID, COMPANY REGISTRATION NUMBER or country specific: TIN (United States), GST/HST (Canada), SIREN/SIRET (France), UEN (Singapore), STNR (Germany), KVK (NL), CIF (Spain), NIF (Portugal), CVR (Denmark), CF (Italy), DIC (Czech Republic), RFC (Mexico), GSTIN (India) ...etc ","example":null,"type":"string"},"value":{"example":null,"type":"string"}},"type":"object"},"type":"array"},"customer_name":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"Name of customer.","example":"MyCompany","type":"string"}},"type":"object"},"date":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"ISO date yyyy-mm-dd. Works both for European and US dates.","example":"2019-08-25","type":"string"}},"type":"object"},"document_type":{"properties":{"value":{"description":"Beta field: works only for 'INVOICE' and 'CREDIT NOTE'.","enum":["INVOICE","CREDIT NOTE"],"example":"INVOICE","type":"string"}},"type":"object"},"due_date":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"ISO date yyyy-mm-dd. Works both for European and US dates.","example":"2017-05-12","type":"string"}},"type":"object"},"invoice_number":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"example":"INV-645/2020","type":"string"}},"type":"object"},"line_items":{"items":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"description":{"description":"The item description.","example":"string","type":"string"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"product_code":{"description":"The product code refering to the item.","example":"string","type":"string"},"quantity":{"description":"The item quantity","example":10,"type":"number"},"tax_amount":{"description":"The item tax amount.","example":10,"type":"number"},"tax_rate":{"description":"The item tax rate in percentage.","example":10,"type":"number"},"total_amount":{"description":"The item total amount.","example":10,"type":"number"},"unit_price":{"description":"The item unit price.","example":10,"type":"number"}},"type":"object"},"type":"array"},"locale":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"currency":{"description":"ISO 4217 code among 22 predefined currencies.","enum":["AED","AUD","BRL","CAD","CHF","CNY","COP","CZK","DKK","EUR","GBP","GNF","HKD","HUF","JPY","NOK","NZD","PLN","SEK","SGD","USD","XPF"],"example":"EUR","type":"string"},"language":{"description":"ISO 639-1 code, works best with ca, de, en, es, fr, it, nl and pt.","example":"fr","type":"string"}},"type":"object"},"supplier_address":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"Address of supplier.","example":"548 Market St, Suite 98568 San Francisco, California 94104-5401","type":"string"}},"type":"object"},"supplier_company_registrations":{"items":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"type":{"description":"Generic: VAT NUMBER, TAX ID, COMPANY REGISTRATION NUMBER or country specific: TIN (United States), GST/HST (Canada), SIREN/SIRET (France), UEN (Singapore), STNR (Germany), KVK (NL), CIF (Spain), NIF (Portugal), CVR (Denmark), CF (Italy), DIC (Czech Republic), RFC (Mexico), GSTIN (India) ...etc ","example":"UEN","type":"string"},"value":{"example":"201705844H","type":"string"}},"type":"object"},"type":"array"},"supplier_name":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"Name of supplier.","example":"MICROSOFT","type":"string"}},"type":"object"},"supplier_payment_details":{"items":{"properties":{"account_number":{"example":"string","type":"string"},"confidence":{"$ref":"#/components/schemas/Confidence"},"iban":{"example":"string","type":"string"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"routing_number":{"example":"string","type":"string"},"swift":{"example":"string","type":"string"}},"type":"object"},"type":"array"},"taxes":{"items":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"rate":{"description":"The tax rate in percentage.","example":null,"type":"number"},"value":{"description":"The tax amount.","example":null,"type":"number"}},"type":"object"},"type":"array"},"total_amount":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"The total amount paid.","example":871.78,"type":"number"}},"type":"object"},"total_net":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"page_id":{"example":0,"type":"integer"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"The total amount paid without the taxes.","example":987.64,"type":"number"}},"type":"object"}},"type":"object"},"MindeeInvoices4PagePrediction":{"properties":{"customer_address":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"Address of supplier.","example":"548 Market St, Suite 98568 San Francisco, California 94104-5401","type":"string"}},"type":"object"},"customer_company_registrations":{"items":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"type":{"description":"Generic: VAT NUMBER, TAX ID, COMPANY REGISTRATION NUMBER or country specific: TIN (United States), GST/HST (Canada), SIREN/SIRET (France), UEN (Singapore), STNR (Germany), KVK (NL), CIF (Spain), NIF (Portugal), CVR (Denmark), CF (Italy), DIC (Czech Republic), RFC (Mexico), GSTIN (India) ...etc ","example":null,"type":"string"},"value":{"example":null,"type":"string"}},"type":"object"},"type":"array"},"customer_name":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"Name of customer.","example":"MyCompany","type":"string"}},"type":"object"},"date":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"ISO date yyyy-mm-dd. Works both for European and US dates.","example":"2019-08-25","type":"string"}},"type":"object"},"document_type":{"properties":{"value":{"description":"Beta field: works only for 'INVOICE' and 'CREDIT NOTE'.","enum":["INVOICE","CREDIT NOTE"],"example":"INVOICE","type":"string"}},"type":"object"},"due_date":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"ISO date yyyy-mm-dd. Works both for European and US dates.","example":"2017-05-12","type":"string"}},"type":"object"},"invoice_number":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"example":"INV-645/2020","type":"string"}},"type":"object"},"line_items":{"items":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"description":{"description":"The item description.","example":"string","type":"string"},"polygon":{"$ref":"#/components/schemas/Polygon"},"product_code":{"description":"The product code refering to the item.","example":"string","type":"string"},"quantity":{"description":"The item quantity","example":10,"type":"number"},"tax_amount":{"description":"The item tax amount.","example":10,"type":"number"},"tax_rate":{"description":"The item tax rate in percentage.","example":10,"type":"number"},"total_amount":{"description":"The item total amount.","example":10,"type":"number"},"unit_price":{"description":"The item unit price.","example":10,"type":"number"}},"type":"object"},"type":"array"},"locale":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"currency":{"description":"ISO 4217 code among 22 predefined currencies.","enum":["AED","AUD","BRL","CAD","CHF","CNY","COP","CZK","DKK","EUR","GBP","GNF","HKD","HUF","JPY","NOK","NZD","PLN","SEK","SGD","USD","XPF"],"example":"EUR","type":"string"},"language":{"description":"ISO 639-1 code, works best with ca, de, en, es, fr, it, nl and pt.","example":"fr","type":"string"}},"type":"object"},"orientation":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"degrees":{"description":"The clockwise rotation to apply in degrees to get the page/image upright.","enum":[0,90,270],"example":0,"type":"number"}},"type":"object"},"supplier_address":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"Address of supplier.","example":"548 Market St, Suite 98568 San Francisco, California 94104-5401","type":"string"}},"type":"object"},"supplier_company_registrations":{"items":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"type":{"description":"Generic: VAT NUMBER, TAX ID, COMPANY REGISTRATION NUMBER or country specific: TIN (United States), GST/HST (Canada), SIREN/SIRET (France), UEN (Singapore), STNR (Germany), KVK (NL), CIF (Spain), NIF (Portugal), CVR (Denmark), CF (Italy), DIC (Czech Republic), RFC (Mexico), GSTIN (India) ...etc ","example":"UEN","type":"string"},"value":{"example":"201705844H","type":"string"}},"type":"object"},"type":"array"},"supplier_name":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"Name of supplier.","example":"MICROSOFT","type":"string"}},"type":"object"},"supplier_payment_details":{"items":{"properties":{"account_number":{"example":"string","type":"string"},"confidence":{"$ref":"#/components/schemas/Confidence"},"iban":{"example":"string","type":"string"},"polygon":{"$ref":"#/components/schemas/Polygon"},"routing_number":{"example":"string","type":"string"},"swift":{"example":"string","type":"string"}},"type":"object"},"type":"array"},"taxes":{"items":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"rate":{"description":"The tax rate in percentage.","example":null,"type":"number"},"value":{"description":"The tax amount.","example":null,"type":"number"}},"type":"object"},"type":"array"},"total_amount":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"The total amount paid.","example":230.86,"type":"number"}},"type":"object"},"total_net":{"properties":{"confidence":{"$ref":"#/components/schemas/Confidence"},"polygon":{"$ref":"#/components/schemas/Polygon"},"value":{"description":"The total amount paid without the taxes.","example":648.14,"type":"number"}},"type":"object"}},"type":"object"},"Point":{"description":"Point using (X, Y) coordinates","example":[0.0912,0.463],"items":{"format":"float","maxItems":2,"type":"number"},"type":"array"},"Polygon":{"description":"Polygon using a sequence of (X, Y) coordinates","items":{"$ref":"#/components/schemas/Point"},"type":"array"},"SuccessPredictResponse":{"properties":{"api_request":{"description":"Information about your API request","properties":{"error":{"example":{},"type":"object"},"resources":{"example":["document"],"items":{"type":"string"},"type":"array"},"status":{"enum":["success"],"example":"success","type":"string"},"status_code":{"description":"HTTP status code","example":201,"maximum":399,"minimum":200,"type":"integer"},"url":{"example":"https://api.mindee.net/v1/products/mindee/invoices/v4/predict","type":"string"}},"type":"object"},"document":{"properties":{"annotations":{"example":{"labels":[]},"type":"object"},"id":{"description":"Document identifier, generated on each API call","example":"964521f5-ea52-442b-a365-715e53f227ed","format":"uuid","type":"string"},"inference":{"properties":{"extras":{"example":{},"type":"object"},"finished_at":{"example":"2022-12-03T08:18:14+00:00","type":"string"},"pages":{"items":{"properties":{"extras":{"example":{},"type":"object"},"id":{"example":0,"minimum":0,"type":"integer"},"prediction":{"$ref":"#/components/schemas/MindeeInvoices4PagePrediction"}},"type":"object"},"type":"array"},"prediction":{"$ref":"#/components/schemas/MindeeInvoices4DocPrediction"},"processing_time":{"example":1.861,"type":"integer"},"product":{"properties":{"features":{"example":["locale","invoice_number","date","due_date","total_net","total_amount","taxes","supplier_payment_details","supplier_name","supplier_company_registrations","supplier_address","customer_name","customer_company_registrations","customer_address","document_type","orientation","line_items"],"items":{"type":"string"},"type":"array"},"name":{"example":"mindee/Invoice","type":"string"},"version":{"example":"4.0","type":"string"}},"type":"object"},"started_at":{"example":"2022-12-03T08:18:12+00:00","type":"string"}},"type":"object"},"n_pages":{"description":"Number of pages in the document","example":1,"minimum":1,"type":"integer"},"name":{"description":"Name of the document","example":"myfile.jpg","type":"string"},"ocr":{"example":{},"type":"object"}},"type":"object"}},"type":"object"}},"securitySchemes":{"apiKey":{"description":"Token <your_api_key>","in":"header","name":"Authorization","type":"apiKey"}}},"info":{"description":"Invoice endpoints","title":"Invoice","version":"1.0.0"},"openapi":"3.0.3","paths":{"/products/mindee/invoices/{version}/predict":{"post":{"description":"Extract your fields from a document","parameters":[{"description":"API version","in":"path","name":"version","required":true,"schema":{"enum":["v4"],"type":"string"}}],"requestBody":{"$ref":"#/components/requestBodies/Predict"},"responses":{"201":{"$ref":"#/components/responses/OK"},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"},"504":{"$ref":"#/components/responses/Error"}},"summary":"Prediction endpoint","tags":["Predict"]}}},"security":[{"apiKey":[]}],"servers":[{"url":"https://api.mindee.net/v1"}]}