Order Extractor (chat / comments) API
Turn a chat or livestream comment ("chốt 2 áo đen size M, ship 12 Lê Lợi…, 0909…") into an order: phone, name, address, items, payment, notes.
Send the text of a Facebook / Zalo / livestream comment or chat message and get a structured order: the customer phone (normalised, E.164, network), name (after "tên:", "người nhận", or a title such as chị / anh), the delivery address resolved to the current ward and province by the same engine as /v1/address-parse (old 3-level addresses are converted to the post-07/2025 units), the items with quantity, size and colour, the payment method (COD, bank transfer, already paid) and delivery notes ("giao giờ hành chính", "gọi trước").
Without a catalog the API reads product codes (A12 x2, MS05 sl 3, #23) and free text ("2 áo đen size M"). With catalog ([{"sku", "name", "aliases"?, "price"?}], up to 500) it matches SKUs, names and aliases (accents and case ignored, partial names allowed) and computes line totals. Every field carries a confidence; is_order tells whether the message looks like an order.
Rule-based, no AI model and no storage: results are fast and predictable, but messy text can be misread, so keep a human check for low-confidence fields. Normalise teencode first with /v1/vn-teencode for very informal messages. Batch up to 100 messages with messages.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
text | body|query | string | yes | The message or comment (max 3,000 characters). Or messages: array of up to 100. | |
catalog | body | array | no | Your products [{"sku", "name", "aliases"?: [...], "price"?}] (max 500) for SKU / name matching and totals. |
Example
curl -X POST "https://apibox.io.vn/v1/vn-order-extract" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"chốt 2 áo đen size M + 1 quần L, ship 12 Lê Lợi P. Bến Thành, Q1, TPHCM, 0909 123 456, COD"}'const res = await fetch('https://apibox.io.vn/v1/vn-order-extract', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": "chốt 2 áo đen size M + 1 quần L, ship 12 Lê Lợi P. Bến Thành, Q1, TPHCM, 0909 123 456, COD"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/vn-order-extract",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"text": "chốt 2 áo đen size M + 1 quần L, ship 12 Lê Lợi P. Bến Thành, Q1, TPHCM, 0909 123 456, COD"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/vn-order-extract');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"text":"chốt 2 áo đen size M + 1 quần L, ship 12 Lê Lợi P. Bến Thành, Q1, TPHCM, 0909 123 456, COD"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"is_order": true,
"customer": {
"name": null,
"phone": {
"number": "0909123456",
"e164": "+84909123456",
"network": "MobiFone",
"type": "mobile"
},
"other_phones": []
},
"address": {
"text": "12 Lê Lợi P. Bến Thành, Q1, TPHCM",
"matched": true,
"ambiguous": false,
"format": "old (before 07/2025)",
"ward": "Phường Bến Thành",
"ward_code": "26743",
"province": "Thành phố Hồ Chí Minh",
"province_code": "79",
"postal_code": "71009",
"full_address": "12 Lê Lợi, Phường Bến Thành, Thành phố Hồ Chí Minh",
"converted_from": {
"code": "26743",
"name": "Phường Bến Thành",
"change": "Nhập toàn bộ",
"district": "Quận 1",
"district_code": "760",
"province": "Thành phố Hồ Chí Minh",
"province_code": "79"
}
},
"items": [
{
"sku": null,
"name": "áo đen",
"text": "2 áo đen size M",
"quantity": 2,
"size": "M",
"color": "đen",
"unit_price": null,
"line_total": null,
"matched": "free_text",
"confidence": 0.45
},
{
"sku": null,
"name": "quần",
"text": "1 quần L",
"quantity": 1,
"size": "L",
"color": null,
"unit_price": null,
"line_total": null,
"matched": "free_text",
"confidence": 0.45
}
],
"total": null,
"payment": "cod",
"notes": [],
"confidence": {
"phone": 0.95,
"payment": 0.85,
"address": 0.9,
"items": 0.45
}
}
Use cases
- Turn livestream comments into draft orders
- Fill the order form of a chatbot from one message
- Pre-fill phone and new-format address in an OMS from Zalo chats
- Count orders per product from a comment export
FAQ
Does it use AI?
No. It is a rule-based extractor (phone patterns, address keywords, the address-parse engine, product code and quantity patterns), so the same input always gives the same output.
Are old addresses converted?
Yes: an address with a district (quận / huyện) is converted to the current phường / xã and province through the official conversion table, as in /v1/address-parse.
How do I match my products?
Pass catalog with your SKUs, names and aliases; matches are accent- and case-insensitive, and prices give line totals and an order total.
Related APIs
Text Diff
Compare two texts by lines, words, characters, sentences or JSON and get the changes, a similarity score and a unified diff patch.
a-bSlugify
Turn titles into clean URL slugs: accents removed (Vietnamese đ included), custom separator, optional case keeping and maximum length.
123Text Statistics
Count words, characters, sentences, paragraphs and lines, estimate reading and speaking time, and list the most frequent words of a text.