# Vietnamese SIM Number Patterns API

> Classify Vietnamese mobile numbers like SIM shops: tứ quý, tam hoa, taxi, lộc phát, thần tài, năm sinh…, with original network, score and phong thuỷ view.

- Endpoint: `GET | POST https://apibox.io.vn/v1/vn-sim-numbers`
- Category: Data & JSON
- HTML docs: https://apibox.io.vn/docs/vn-sim-numbers/ (Vietnamese: https://apibox.io.vn/vi/docs/vn-sim-numbers/)
- Online tool: https://apibox.io.vn/tools/vn-sim-numbers/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

Send one number or a list (up to 1,000; 5,000 for `action=filter`) in any common format (`0981.236.868`, `+84 98 123 6868`). Each number is normalised and checked against the 10-digit mobile prefixes; `network` is the network the prefix was assigned to (a number may have been ported since 2018, which the response says).

The classifier knows the patterns used in SIM shop price lists: lục / ngũ / tứ quý, tam hoa and tam hoa kép, taxi AB.AB.AB, ABC.ABC and ABCD.ABCD, kép AABB / AABBCC, soi gương ABC.CBA, gánh ABBA / ABA, số tiến / lùi, năm sinh (1950 to this year), ngày sinh ddmmyy, lộc phát (68 / 86), thần tài (39 / 79), ông địa (38 / 78), song lộc / song phát, tứ quý giữa, đầu số cổ and few distinct digits. Patterns implied by a stronger one are not repeated. `score` (0-100) is the strongest pattern weight plus a quarter of the others; change any weight with `weights`, e.g. `{"nam_sinh":60}`. `action=patterns` lists ids and default weights.

`action=filter` keeps the numbers of a stock list that match `patterns`, `network`, `ends_with`, `contains`, `avoid_digits`, `min_score` or `nut_min`, sorted by score. With `phong_thuy=1` or `birth_year`, the answer adds the sum of digits, nút, the ngũ hành of the digits and how they relate to the owner's mệnh (nạp âm of the lunar year): a folk belief, given as reference only. Numbers are never stored.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `number` | body|query | string | no |  | One mobile number (any format). |
| `numbers` | body|query | array | no |  | Several numbers: array or comma / newline separated. |
| `action` | body|query | string | no | `classify` | `classify`, `filter` or `patterns`. |
| `weights` | body|query | object | no |  | Pattern weights, e.g. `{"tu_quy":80}`. |
| `birth_year` | body|query | number | no |  | Owner's lunar birth year: adds the phong thuỷ view. |
| `phong_thuy` | body|query | boolean | no |  | `1`: add sum of digits, nút and digit elements. |
| `patterns` | body|query | string | no |  | filter: pattern ids to keep (any of them). |
| `network` | body|query | string | no |  | filter: networks, e.g. `viettel,vinaphone`. |
| `ends_with` | body|query | string | no |  | filter: required ending digits. |
| `avoid_digits` | body|query | string | no |  | filter: digits that must not appear (e.g. `47`). |
| `min_score` | body|query | number | no |  | filter: minimum score. |
| `limit` | body|query | number | no | `100` | filter: maximum items returned. |

## Example request

```bash
curl "https://apibox.io.vn/v1/vn-sim-numbers?number=0981.236.868&birth_year=1990" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Example response

```json
{
  "input": "0981.236.868",
  "valid": true,
  "national": "0981236868",
  "e164": "+84981236868",
  "display": "0981.236.868",
  "prefix": "098",
  "network": "Viettel",
  "network_note": "original network of the prefix; the number may have been ported (chuyển mạng giữ số)",
  "patterns": [
    {
      "id": "loc_phat",
      "vi": "Lộc phát",
      "en": "Ends with 68 / 86 (lộc phát, phát lộc)",
      "weight": 30,
      "part": "6868"
    },
    {
      "id": "lap_abab",
      "vi": "Số lặp AB.AB",
      "en": "Pair repeated (AB.AB)",
      "weight": 25,
      "part": "6868"
    },
    {
      "id": "dau_so_co",
      "vi": "Đầu số cổ",
      "en": "Old premium prefix (090, 091, 098…)",
      "weight": 10,
      "part": "098"
    }
  ],
  "score": 39,
  "tier": "kha",
  "tier_vi": "Sim khá",
  "phong_thuy": {
    "sum": 51,
    "nut": 1,
    "nut_label_vi": "thấp",
    "digit_elements": {
      "Kim": 1,
      "Mộc": 4,
      "Thủy": 3,
      "Hỏa": 1,
      "Thổ": 0
    },
    "method": "digits mapped to ngũ hành by Hà Đồ numbers (1,6 Thủy; 2,7 Hỏa; 3,8 Mộc; 4,9 Kim; 0,5 Thổ); nút = sum of the 10 digits mod 10",
    "owner": {
      "lunar_year": 1990,
      "can_chi": "Canh Ngọ",
      "menh": "Thổ"
    },
    "supporting_digits": 1,
    "clashing_digits": 4,
    "harmony_vi": "khắc mệnh",
    "note": "birth_year is the lunar year (people born before Tết belong to the previous year)"
  },
  "disclaimer": "Phong thuỷ is a folk belief: reference only."
}
```

## Use cases

- Tag and price the stock of a SIM shop website automatically
- Filter a Google Sheets SIM list by pattern, network and score
- Show "why this number is nice" on a product page
- Suggest numbers matching a customer's birth year or lucky endings

## FAQ

### Is the network always right?

It is the network that owns the prefix. Since 2018 numbers can be ported (chuyển mạng giữ số), so the real network can differ.

### Can I change how the score is computed?

Yes. Send weights as a JSON object of pattern id to weight; the score is the strongest weight plus 25 % of the others, capped at 100.

### Is the phong thuỷ part reliable?

It follows the common convention of SIM sites (Hà Đồ digits, nạp âm of the lunar year) and is a belief, not a fact. It is only computed when you ask for it.
