Skip to main content

Invoice Processing

1 API call in this section.

Extract Invoice Data

Express Shipping / Order / Invoice Processing
POST/express-shipping/order/extract?language=en

API: Extract Invoice Data Endpoint: POST /express-shipping/order/extract Authentication: - Use X-EXPRESS-KEY: {{express_access_token}} from OTP verification response. - Do not send customer_id; it is read from token claims. Form Fields: - invoice_file (file, required) Business Logic: 1. Validate tenant has active express shipping service 2. Validate file format and size 3. Process document using AI extraction service 4. Extract order details, items, and pricing information 5. Return structured data for customer review Error Responses: 400 - Missing Required Fields: 400 - Invalid File Format: 400 - File Too Large: 404 - Customer Not Found: 500 - Extraction Failed:

Most OnDi APIs require an authenticated session or service token. Public endpoints are marked by their path and module context.
Request
curl
1curl --request POST "$ONDI_BASE_URL/express-shipping/order/extract?language=en" \2  --header "X-EXPRESS-KEY: {{express_access_token}}" \3  --header "Content-Type: application/json" \4  --data '{5  "invoice_file": ""6}'
Request body
json
1{2  "invoice_file": ""3}

Query parameters

languageOptional
query string

en

Preferred language for response messages (en, ar, ku)

Request body fields

invoice_fileOptional
form file

Invoice file (PDF, JPEG, PNG)

Headers

X-EXPRESS-KEYOptional
header string

{{express_access_token}}

Short-lived JWT from OTP verification (required)

Responses

Success Response - Data Extracted200OK
Response body
json
1{2  "success": true,3  "data": {4    "order_number": "TREND-ORD-98765",5    "store_name": "Trendyol",6    "total_amount": 125.5,7    "currency": "USD",8    "order_date": "2024-01-15",9    "items": [10      {11        "name": "Wireless Bluetooth Headphones",12        "quantity": 1,13        "unit_price": 75,14        "total_price": 7515      },16      {17        "name": "Phone Case",18        "quantity": 2,19        "unit_price": 25.25,20        "total_price": 50.521      }22    ],23    "tax_amount": 22.59,24    "customer_name": "John Doe",25    "customer_email": "john@example.com",26    "customer_address": "123 Main St, City",27    "invoice_number": "INV-2024-001",28    "invoice_file_url": "express/invoice/GAL1704067200000/1704067300000-invoice.pdf"29  },30  "message": "Invoice data extracted successfully. Please review and confirm."31}
Error - Invalid File Format400Bad Request
Response body
json
1{2  "success": false,3  "message": "Unsupported file type. Supported types: pdf, image, jpeg, jpg, png"4}
Error - Customer Not Found404Not Found
Response body
json
1{2  "success": false,3  "message": "Customer not found with ID: INVALID123"4}
400 - Missing Required Fields400
Response body
json
1{2  "success": false,3  "message": "Missing required fields: customer_id, invoice_file"4}
400 - File Too Large400
Response body
json
1{2  "success": false,3  "message": "File size exceeds maximum limit of 10MB"4}
404 - Customer Not Found404
Response body
json
1{2  "success": false,3  "message": "Customer not found with ID: GAL1704067200000"4}
500 - Extraction Failed500
Response body
json
1{2  "success": false,3  "message": "Failed to extract data from document. Please try again or contact support."4}