Vietnamese amounts to numbers API

Turn Vietnamese written or colloquial amounts into numbers: “hai triệu rưỡi”, “2tr5”, “500k”, “1 tỷ 2”, “2 củ”; batch mode and amount extraction from text.

GETPOSThttps://apibox.io.vn/v1/vn-number-parse

The reverse of number-to-words for Vietnamese. The parser understands standard reading (hai nghìn không trăm hai mươi sáu, một trăm lẻ năm, ba mươi mốt, mười lăm nghìn), colloquial shortcuts (hai triệu rưỡi, trăm rưỡi, một tỷ hai = 1.2 billion, hai lăm nghìn, nửa triệu), shop and chat slang (500k, 2tr5, 1k2, 2 củ, 1 tỏi, 2 lít), Vietnamese decimal and thousands separators (1,5 triệu, 1.500.000đ) and text typed without accents (hai trieu ruoi).

Each result has the value, the currency when one is written (đồng, đ, VNĐ, $, USD) or implied by slang, the amount read back in words, a confidence score and the alternative reading when the text is ambiguous (2tr5 could literally be 2,000,005; 1.500 could be 1.5). mode=extract finds every amount inside a sentence with its character positions, handy for chat orders or bank transfer notes; texts parses up to 1,000 strings at once.

Ranges such as “2-3 triệu” are returned as two amounts, and digit sequences like “hai ba” are rejected as ambiguous instead of guessed.

Parameters

NameInTypeRequiredDefault
textquery|bodystringyesThe amount (or a sentence with mode=extract).
modequery|bodystringnoparseparse: the whole text is one amount; extract: find amounts inside the text.
textsbodyarraynoUp to 1,000 strings (batch).
money_onlyquery|bodybooleannofalseExtract: keep only amounts with a currency, slang or a scale (nghìn, triệu…).

Example

curl "https://apibox.io.vn/v1/vn-number-parse?mode=extract&text=C%E1%BB%8Dc%202tr5%2C%20c%C3%B2n%20l%E1%BA%A1i%20m%E1%BB%99t%20tri%E1%BB%87u%20hai%20tr%C4%83m%20ngh%C3%ACn%20%C4%91%E1%BB%93ng%2C%20ship%2030k" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "mode": "extract",
  "text": "Cọc 2tr5, còn lại một triệu hai trăm nghìn đồng, ship 30k",
  "count": 3,
  "amounts": [
    {
      "text": "2tr5",
      "value": 2500000,
      "currency": "VND",
      "is_money": true,
      "in_words": "Hai triệu năm trăm nghìn đồng",
      "confidence": 0.85,
      "alternatives": [
        {
          "value": 2000005,
          "reading": "literal (the trailing number as units)"
        }
      ],
      "start": 4,
      "end": 8
    },
    {
      "text": "một triệu hai trăm nghìn đồng",
      "value": 1200000,
      "currency": "VND",
      "is_money": true,
      "in_words": "Một triệu hai trăm nghìn đồng",
      "confidence": 1,
      "alternatives": [],
      "start": 18,
      "end": 47
    },
    {
      "text": "30k",
      "value": 30000,
      "currency": "VND",
      "is_money": true,
      "in_words": "Ba mươi nghìn đồng",
      "confidence": 1,
      "alternatives": [],
      "start": 54,
      "end": 57
    }
  ],
  "total": 3730000
}

Use cases

  • Read prices typed by customers in a sales chatbot
  • Parse amounts in bank transfer descriptions
  • Normalise free-text budgets in real-estate search (“dưới 3 tỷ”)
  • Convert speech-to-text output to numbers

FAQ

How is “2tr5” read?

As 2,500,000: digits after a unit are the next fraction (like “2 triệu 5 trăm nghìn”). The literal reading 2,000,005 is returned as an alternative.

Does it work without accents?

Yes for single amounts (“hai trieu ruoi”). In extraction mode unaccented words need a unit (trieu, nghin…) to avoid false matches.

Which slang is supported?

k / nghìn / ngàn, tr / triệu / củ, tỷ / tỉ / tỏi, lít and xị (100,000), chục, rưỡi and nửa.

Related APIs

Start with 1,000 free requests every month. Get free API key →