VI | EN
Message us on Messenger
Developer resources

Địa giới hành chính (tỉnh / quận / phường) — Nhanh.vn API

nhanh.v3.0.shipping.location · call it through Quantri360 with one API key for your own accounts / assets that you connected and authorized — 360 handles request signing and refreshing the authorization you granted.

nhanh.v3.0.shipping.location

POST/v3.0/shipping/locationVia 360: POST https://partner.quantri360.com/v1/nhanh/v3.0/shipping/location
Coming soon. This API already runs in production through 360 and pricing is being finalised — you can read the docs and prepare your integration now.
Description

Địa giới hành chính của Nhanh (tỉnh / quận / phường) — dùng khi đối chiếu địa chỉ đơn. Có 2 bộ: v1 = địa giới cũ 63 tỉnh, 3 cấp; v2 = địa giới mới 34 tỉnh, phường / xã nằm thẳng dưới tỉnh.

  • Mọi tham số nằm trong object filters (không đặt ở cấp gốc body).
  • Danh sách ít đổi — lấy một lần rồi lưu lại, không gọi theo từng đơn.

Request

Endpoint

POST https://partner.quantri360.com/v1/nhanh/v3.0/shipping/location

Authentication & shop

NameInTypeSampleDescription
AuthorizationheaderheaderBearer q360_live_ab12cd34_…Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand.
platform_shop_idquerystring100001Gian hàng (lấy ở GET /v1/platforms → shops[].platform_shop_id). BẮT BUỘC khi brand có > 1 gian hàng trên nền tảng; 360 bỏ tham số này trước khi chuyển tiếp.

Request parameters

NameInTypeRequiredSampleDescription
filters.locationVersionbodystringYesv2v1 (63 tỉnh, tỉnh → quận → phường) · v2 (34 tỉnh, tỉnh → phường / xã). BẮT BUỘC — thiếu thì Nhanh trả code 0 "locationVersion: Chưa truyền giá trị".
filters.typebodystringYesCITYCITY · DISTRICT · WARD.
filters.parentIdbodyintNo254Id cấp trên: v1 — quận cần id tỉnh, phường cần id quận; v2 — phường / xã dùng thẳng id tỉnh.

Request examples

curl -s -X POST "https://partner.quantri360.com/v1/nhanh/v3.0/shipping/location" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"filters":{"locationVersion":"v2","type":"CITY"}}'
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.post(
    "https://partner.quantri360.com/v1/nhanh/v3.0/shipping/location",
    params={},
    json={
        "filters": {
            "locationVersion": "v2",
            "type": "CITY"
        }
    },
    headers={"Authorization": f"Bearer {KEY}"},
    timeout=60,
)
print(r.status_code)
print(r.json())
Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/nhanh/v3.0/shipping/location');
for (const [k, v] of Object.entries({})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'POST',
  headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"filters":{"locationVersion":"v2","type":"CITY"}}),
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/nhanh/v3.0/shipping/location' . '?' . http_build_query([]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key, 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"filters":{"locationVersion":"v2","type":"CITY"}}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Response fields (as returned by Nhanh.vn)

NameTypeSampleDescription
codeint11 = thành công; 0 = lỗi (xem messages).
messagesstring[][]Thông điệp lỗi của Nhanh.
dataobject[]Dữ liệu.
idint254
namestringHà Nội

Response sample

{
    "code": 1,
    "data": [
        {
            "id": "(int) ID địa chỉ 1",
            "name": "Tên địa chỉ",
            "otherName": "Tên khác của địa chỉ"
        },
        {
            "id": "(int) ID địa chỉ 2",
            "name": "Tên địa chỉ"
        }
    ]
}

Get started

  1. Sign up for Partner
  2. Enable a data type of the Basic group on the platform page
  3. Create an API key (tick the Nhanh.vn channel)
  4. Call it as in the examples above