> For the complete documentation index, see [llms.txt](https://api.vietqr.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.vietqr.vn/korea/vietqr-xin-chao/api-vietqr-callback/dong-bo-thong-tin/dong-bo-tong-dai-ly.md).

# Đồng bộ tổng đại lý

{% hint style="success" %}
Khách hàng và đối tác không thuộc diện tổng đại lý có thể bỏ qua bước này.
{% endhint %}

<mark style="color:green;">**`POST`**</mark> API Sync MID

```
https://<vietqr-host>/<basepath>/api/mid/synchronize/v1
```

**Headers**

<table><thead><tr><th width="283">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>Authorization</td><td><code>Bearer &#x3C;token></code></td></tr></tbody></table>

**Body**

<table data-full-width="false"><thead><tr><th width="211">Name</th><th width="111">Type</th><th width="98">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>merchants</code></td><td>List object</td><td>Yes</td><td>Danh sách đại lý cần đồng bộ.</td></tr><tr><td><code>merchantId</code></td><td>String</td><td>Yes</td><td>ID của đại lý. <mark style="background-color:yellow;">(Để null nếu là đồng bộ mới)</mark></td></tr><tr><td><code>merchantFullName</code></td><td>String</td><td>Yes</td><td>Tên đại lý.</td></tr><tr><td><code>merchantName</code></td><td>String</td><td>Yes</td><td>Tên rút gọn đại lý. Không chứa dấu tiếng Việt, không khoảng trắng, không ký tự đặc biệt.</td></tr><tr><td><code>merchantAddress</code></td><td>String</td><td>Yes</td><td>Địa chỉ đăng ký kinh doanh.</td></tr><tr><td><code>merchantIdentity</code></td><td>String</td><td>Yes</td><td>MST/CCCD/ĐKKD</td></tr><tr><td><code>checkSum</code></td><td>String</td><td>Yes</td><td><p>Chuỗi mã hóa MD5 của tổ hợp:</p><p>(<code>password</code>+ <code>merchantName</code>+<code>merchantIdentity</code>)</p></td></tr><tr><td><code>contactEmail</code></td><td>String</td><td>Optional</td><td>Địa chỉ email liên hệ của đại lý.</td></tr><tr><td><code>contactPhone</code></td><td>String</td><td>Optional</td><td>Số điện thoại liên hệ của đại lý.</td></tr><tr><td><code>career</code></td><td>String</td><td>Optional</td><td>Ngành nghề đăng ký kinh doanh.</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "status": "SUCCESS",
    "data": [
        {
            "mid": "ID_đại_lý",
            "merchantName": "tên_rút_gọn_đại_lý"
        }
    ]
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "status": "FAILED",
    "message": "mã_lỗi_và_mô_tả_lỗi"
}
```

{% endtab %}
{% endtabs %}

***

### Code mẫu

{% tabs %}
{% tab title="cURL" %}

```
curl --location 'https://api.vietqr.org/vqr/api/mid/synchronize/v1' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwidXNlciI6IlkzVnpkRzl0WlhJdGJtZDFlV1Z1TFhWelpYSXlORGt5IiwiaWF0IjoxNzIxMzc1MzUzLCJleHAiOjE3MjEzNzU2NTN9.Wi5BTmJ63f7h_p7rimfaycfGIs4TNBkzVGlCUSkOxzWU-QaYZF3rCNndlgPjO89LpRmU3VliSYcf5iHHNrnC7A' \
--header 'Cookie: JSESSIONID=068E5AFD023BFA9AAFBA841C0BF00B62' \
--data-raw '{
    "merchants": [ // DANH SÁCH CỬA HÀNG CẦN ĐỒNG BỘ
        {
            "merchantFullName": "tên_đầy_đủ_của_đại_lý",
            "merchantName": "tên_viết_tắt",
            "merchantAddress": "địa_chỉ_của_đại_lý",
            "merchantIdentity": "Mã_số_thuế",
            "contactEmail": "Email_liên_hệ",
            "contactPhone": "SĐT_liên_hệ",
            "checkSum": "HASHMD5 128bit của: mật_khẩu_get_token + merchant_name + merchantIdentity"
        }
    ]
}'
```

{% endtab %}
{% endtabs %}

***

### Các câu hỏi thường gặp


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api.vietqr.vn/korea/vietqr-xin-chao/api-vietqr-callback/dong-bo-thong-tin/dong-bo-tong-dai-ly.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
