# Sử dụng

## Cấu hình <a href="#cau-hinh" id="cau-hinh"></a>

Sử dụng `api_key` được cung cấp và cấu hình như sau:

```
export API_KEY=<AuthToken>
export API_HOST=<base_url>
```

Hướng dẫn sử dụng các lệnh `export` và `curl` được cung cấp sẵn khi chạy bằng terminal trên hệ điều hành Linux hoặc Mac. Trong trường hợp bạn sử dụng môi trường khác, vui lòng thay thế bằng các thao tác tương đương.

## Cấu trúc API <a href="#cau-truc-api" id="cau-truc-api"></a>

**Request**

Một lời gọi API tiêu biểu như sau:

```json
curl --location '$BASE_URL.Misc/CurrentAccount \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{}'
```

Tất cả request sử dụng giao thức HTTPS, method POST và truyền giá trị bằng body sử dụng định dạng dữ liệu `application/json`. Các header bắt buộc là `Content-Type` và `Authorization`.

**Response**

Response sử dụng định dạng dữ liệu `application/json` được set trong header `Content-Type`. Nếu request thành công, HTTP status code là `200`. Nếu request lỗi, HTTP status code có thể là `4xx` hoặc `5xx` với cấu trúc tương tự như sau:

```json
{
  "code": "invalid_argument",
  "msg": "..."
}
```

## Tạo tài khoản shop <a href="#ket-noi-tai-khoan-shop" id="ket-noi-tai-khoan-shop"></a>

Hiện eTelecom đang có hai cách tạo tài khoản shop:

* Cách 1: [Tạo theo mô hình redirect](/tich-hop-api/partner/su-dung/tao-shop-theo-mo-hinh-redirect.md)
* Cách 2: [Tạo qua API bỏ qua bước xác thực email](/tich-hop-api/partner/su-dung/tao-shop-qua-api.md)

## Lấy danh sách shop <a href="#cac-loi-thuong-gap" id="cac-loi-thuong-gap"></a>

API này hỗ trợ Partner lấy thông tin danh sách shop mà Partner đã tạo trước đó.

## POST $BASE\_URL.Shop/GetShops

> GetShops

```json
{"openapi":"3.1.1","info":{"title":"API Document","version":"v1"},"tags":[{"name":"Shop"}],"paths":{"$BASE_URL.Shop/GetShops":{"post":{"tags":["Shop"],"summary":"GetShops","operationId":"partner.Shop-GetShops","responses":{"200":{"description":"A successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/iqGetShopsResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/iqGetShopsRequest"}}},"required":true}}}},"components":{"schemas":{"iqGetShopsResponse":{"type":"object","properties":{"paging":{"$ref":"#/components/schemas/ktCursorPageInfo"},"shops":{"type":"array","items":{"$ref":"#/components/schemas/baShop"}}}},"ktCursorPageInfo":{"type":"object","properties":{"after":{"type":"string"},"before":{"type":"string"},"limit":{"type":"integer"},"next":{"type":"string"},"prev":{"type":"string"},"sort":{"type":"string"}}},"baShop":{"type":"object","properties":{"address":{"$ref":"#/components/schemas/baAddress"},"auto_create_ffm":{"type":"boolean"},"bank_account":{"$ref":"#/components/schemas/baBankAccount"},"block_reason":{"type":"string"},"code":{"type":"string"},"company_info":{"$ref":"#/components/schemas/baCompanyInfo"},"created_at":{"type":"string","format":"date-time"},"email":{"type":"string"},"exported_fields":{"type":"array","items":{"type":"string"}},"ghn_note_code":{"allOf":[{"description":"**Deprecated:** use try_on instead\n"},{"$ref":"#/components/schemas/pjGHNNoteCode"}]},"id":{"type":"string","format":"int64"},"image_url":{"type":"string"},"inventory_overstock":{"type":"boolean"},"is_blocked":{"type":"boolean"},"is_prior_money_transaction":{"type":"boolean"},"is_test":{"type":"boolean"},"money_transaction_count":{"type":"integer"},"money_transaction_rrule":{"description":"referrence: https://icalendar.org/rrule-tool.html\n","type":"string"},"name":{"type":"string"},"owner_id":{"type":"string","format":"int64"},"phone":{"type":"string"},"product_source_id":{"type":"string","format":"int64"},"ship_from_address_id":{"type":"string","format":"int64"},"ship_to_address_id":{"type":"string","format":"int64"},"shipping_service_select_strategy":{"type":"array","items":{"$ref":"#/components/schemas/baShippingServiceSelectStrategyItem"}},"status":{"$ref":"#/components/schemas/blStatus"},"survey_info":{"type":"array","items":{"$ref":"#/components/schemas/baSurveyInfo"}},"try_on":{"$ref":"#/components/schemas/csTryOnCode"},"updated_at":{"type":"string","format":"date-time"},"user":{"$ref":"#/components/schemas/baUser"},"website_url":{"type":"string"}}},"baAddress":{"type":"object","properties":{"address1":{"type":"string"},"address2":{"type":"string"},"coordinates":{"$ref":"#/components/schemas/baCoordinates"},"country":{"type":"string"},"district":{"type":"string"},"district_code":{"type":"string"},"email":{"type":"string"},"exported_fields":{"type":"array","items":{"type":"string"}},"first_name":{"description":"**Deprecated:** use full_name instead\n","type":"string"},"full_name":{"type":"string"},"id":{"type":"string","format":"int64"},"last_name":{"description":"**Deprecated:** use full_name instead\n","type":"string"},"notes":{"$ref":"#/components/schemas/baAddressNote"},"phone":{"type":"string"},"position":{"type":"string"},"province":{"type":"string"},"province_code":{"type":"string"},"type":{"$ref":"#/components/schemas/adAddressType"},"ward":{"type":"string"},"ward_code":{"type":"string"},"zip":{"type":"string"}}},"baCoordinates":{"type":"object","properties":{"latitude":{"type":"integer","format":"float32"},"longitude":{"type":"integer","format":"float32"}}},"baAddressNote":{"type":"object","properties":{"lunch_break":{"type":"string"},"note":{"type":"string"},"open_time":{"type":"string"},"other":{"type":"string"}}},"adAddressType":{"type":"string","enum":["unknown","general","warehouse","shipto","shipfrom"]},"baBankAccount":{"type":"object","properties":{"account_name":{"type":"string"},"account_number":{"type":"string"},"branch":{"type":"string"},"name":{"type":"string"},"province":{"type":"string"}}},"baCompanyInfo":{"type":"object","properties":{"address":{"type":"string"},"legal_representative":{"$ref":"#/components/schemas/baContactPerson"},"name":{"type":"string"},"tax_code":{"type":"string"},"website":{"type":"string"}}},"baContactPerson":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"},"position":{"type":"string"}}},"pjGHNNoteCode":{"type":"string","enum":["unknown","CHOTHUHANG","CHOXEMHANGKHONGTHU","KHONGCHOXEMHANG"]},"baShippingServiceSelectStrategyItem":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}},"blStatus":{"type":"string","enum":["Z","P","N"]},"baSurveyInfo":{"type":"object","properties":{"answer":{"type":"string"},"key":{"type":"string"},"question":{"type":"string"}}},"csTryOnCode":{"type":"string","enum":["unknown","none","open","try"]},"baUser":{"description":"Represents a user in eTop system. The user may or may not have associated accounts.\n","type":"object","required":["id","full_name","short_name","phone","email","created_at","updated_at"],"properties":{"block_reason":{"type":"string"},"blocked_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"email":{"type":"string"},"email_verification_sent_at":{"type":"string","format":"date-time"},"email_verified_at":{"type":"string","format":"date-time"},"full_name":{"type":"string"},"id":{"type":"string","format":"int64"},"is_blocked":{"type":"boolean"},"phone":{"type":"string"},"phone_verification_sent_at":{"type":"string","format":"date-time"},"phone_verified_at":{"type":"string","format":"date-time"},"ref_aff":{"type":"string"},"ref_sale":{"type":"string"},"short_name":{"type":"string"},"source":{"$ref":"#/components/schemas/djUserSource"},"total_shop":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"}}},"djUserSource":{"type":"string","enum":["unknown","psx","etop","topship","ts_app_android","ts_app_ios","ts_app_web","partner","etop_app_ios","etop_app_android","telecom","admin"]},"iqGetShopsRequest":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/iqFilterShopRequest"},"paging":{"$ref":"#/components/schemas/ktPaging"}}},"iqFilterShopRequest":{"type":"object","properties":{"date_from":{"type":"string","format":"date-time"},"date_to":{"type":"string","format":"date-time"},"name":{"$ref":"#/components/schemas/kfFullTextSearch"},"owner_id":{"type":"string","format":"int64"},"shop_codes":{"type":"array","items":{"type":"string"}},"shop_ids":{"type":"array","items":{"type":"string","format":"int64"}}}},"kfFullTextSearch":{"type":"string"},"ktPaging":{"type":"object","properties":{"limit":{"type":"integer"},"offset":{"type":"integer"},"sort":{"type":"string"}}}}}}
```

**Request:**

```json
curl --location '$BASE_URL.Shop/GetShops' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--data '{
    "filter": {
      "date_from": "2025-10-15T17:06:11.911Z",
      "date_to": "2025-10-15T17:06:11.911Z",
      "name": "text",
      "owner_id": "text",
      "shop_codes": [
        "text"
      ],
      "shop_ids": [
        "text"
      ]
    },
    "paging": {
      "limit": 1,
      "offset": 1,
      "sort": "text"
    }
  }'
```

**Response:**

```json
{
    "paging": {
        "before": "",
        "after": "",
        "limit": 100,
        "sort": "",
        "prev": "",
        "next": ""
    },
    "shops": [
        {
            "exported_fields": [],
            "inventory_overstock": true,
            "id": "string",
            "name": "string",
            "status": "P",
            "is_test": false,
            "address": null,
            "phone": "string",
            "bank_account": null,
            "auto_create_ffm": true,
            "website_url": "",
            "image_url": "",
            "email": "string",
            "product_source_id": "string",
            "ship_to_address_id": "0",
            "ship_from_address_id": "0",
            "is_blocked": false,
            "block_reason": "",
            "try_on": "open",
            "owner_id": "string",
            "user": {
                "id": "string",
                "full_name": "string",
                "short_name": "eB2B",
                "phone": "string",
                "email": "string",
                "created_at": "2025-04-08T03:12:56Z",
                "updated_at": "2025-10-15T06:08:17Z",
                "email_verified_at": "2025-04-08T03:12:56Z",
                "phone_verified_at": null,
                "email_verification_sent_at": null,
                "phone_verification_sent_at": null,
                "source": "partner",
                "total_shop": 0,
                "is_blocked": false,
                "block_reason": "string",
                "blocked_at": null,
                "ref_sale": "",
                "ref_aff": ""
            },
            "company_info": null,
            "money_transaction_rrule": "FREQ=WEEKLY;BYDAY=TU,TH",
            "survey_info": [],
            "shipping_service_select_strategy": [],
            "code": "string",
            "is_prior_money_transaction": true,
            "created_at": "2025-04-08T03:13:00Z",
            "updated_at": "2025-10-15T06:59:39Z",
            "money_transaction_count": 0
        }
    ]
}
```

**Cấu trúc body của request:**

<table><thead><tr><th width="191">Tham số</th><th width="162">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>name</td><td>string</td><td>Tên của shop</td></tr><tr><td>owner_id</td><td>string</td><td>ID của chủ shop</td></tr><tr><td>shop_codes</td><td>string</td><td>Mã shop</td></tr><tr><td>shop_ids</td><td>string</td><td>ID của shop</td></tr></tbody></table>

## **CreateShop**

## POST $BASE\_URL.Shop/CreateShopAccount

> CreateShopAccount

```json
{"openapi":"3.1.1","info":{"title":"API Document","version":"v1"},"tags":[{"name":"Shop"}],"paths":{"$BASE_URL.Shop/CreateShopAccount":{"post":{"tags":["Shop"],"summary":"CreateShopAccount","operationId":"partner.Shop-CreateShopAccount","responses":{"200":{"description":"A successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/mcCreateShopAccountResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/mcCreateShopAccountRequest"}}},"required":true}}}},"components":{"schemas":{"mcCreateShopAccountResponse":{"type":"object","properties":{"api_key":{"type":"string"},"shop":{"$ref":"#/components/schemas/baShop"},"shop_key":{"type":"string"}}},"baShop":{"type":"object","properties":{"address":{"$ref":"#/components/schemas/baAddress"},"auto_create_ffm":{"type":"boolean"},"bank_account":{"$ref":"#/components/schemas/baBankAccount"},"block_reason":{"type":"string"},"code":{"type":"string"},"company_info":{"$ref":"#/components/schemas/baCompanyInfo"},"created_at":{"type":"string","format":"date-time"},"email":{"type":"string"},"exported_fields":{"type":"array","items":{"type":"string"}},"ghn_note_code":{"allOf":[{"description":"**Deprecated:** use try_on instead\n"},{"$ref":"#/components/schemas/pjGHNNoteCode"}]},"id":{"type":"string","format":"int64"},"image_url":{"type":"string"},"inventory_overstock":{"type":"boolean"},"is_blocked":{"type":"boolean"},"is_prior_money_transaction":{"type":"boolean"},"is_test":{"type":"boolean"},"money_transaction_count":{"type":"integer"},"money_transaction_rrule":{"description":"referrence: https://icalendar.org/rrule-tool.html\n","type":"string"},"name":{"type":"string"},"owner_id":{"type":"string","format":"int64"},"phone":{"type":"string"},"product_source_id":{"type":"string","format":"int64"},"ship_from_address_id":{"type":"string","format":"int64"},"ship_to_address_id":{"type":"string","format":"int64"},"shipping_service_select_strategy":{"type":"array","items":{"$ref":"#/components/schemas/baShippingServiceSelectStrategyItem"}},"status":{"$ref":"#/components/schemas/blStatus"},"survey_info":{"type":"array","items":{"$ref":"#/components/schemas/baSurveyInfo"}},"try_on":{"$ref":"#/components/schemas/csTryOnCode"},"updated_at":{"type":"string","format":"date-time"},"user":{"$ref":"#/components/schemas/baUser"},"website_url":{"type":"string"}}},"baAddress":{"type":"object","properties":{"address1":{"type":"string"},"address2":{"type":"string"},"coordinates":{"$ref":"#/components/schemas/baCoordinates"},"country":{"type":"string"},"district":{"type":"string"},"district_code":{"type":"string"},"email":{"type":"string"},"exported_fields":{"type":"array","items":{"type":"string"}},"first_name":{"description":"**Deprecated:** use full_name instead\n","type":"string"},"full_name":{"type":"string"},"id":{"type":"string","format":"int64"},"last_name":{"description":"**Deprecated:** use full_name instead\n","type":"string"},"notes":{"$ref":"#/components/schemas/baAddressNote"},"phone":{"type":"string"},"position":{"type":"string"},"province":{"type":"string"},"province_code":{"type":"string"},"type":{"$ref":"#/components/schemas/adAddressType"},"ward":{"type":"string"},"ward_code":{"type":"string"},"zip":{"type":"string"}}},"baCoordinates":{"type":"object","properties":{"latitude":{"type":"integer","format":"float32"},"longitude":{"type":"integer","format":"float32"}}},"baAddressNote":{"type":"object","properties":{"lunch_break":{"type":"string"},"note":{"type":"string"},"open_time":{"type":"string"},"other":{"type":"string"}}},"adAddressType":{"type":"string","enum":["unknown","general","warehouse","shipto","shipfrom"]},"baBankAccount":{"type":"object","properties":{"account_name":{"type":"string"},"account_number":{"type":"string"},"branch":{"type":"string"},"name":{"type":"string"},"province":{"type":"string"}}},"baCompanyInfo":{"type":"object","properties":{"address":{"type":"string"},"legal_representative":{"$ref":"#/components/schemas/baContactPerson"},"name":{"type":"string"},"tax_code":{"type":"string"},"website":{"type":"string"}}},"baContactPerson":{"type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"},"phone":{"type":"string"},"position":{"type":"string"}}},"pjGHNNoteCode":{"type":"string","enum":["unknown","CHOTHUHANG","CHOXEMHANGKHONGTHU","KHONGCHOXEMHANG"]},"baShippingServiceSelectStrategyItem":{"type":"object","properties":{"key":{"type":"string"},"value":{"type":"string"}}},"blStatus":{"type":"string","enum":["Z","P","N"]},"baSurveyInfo":{"type":"object","properties":{"answer":{"type":"string"},"key":{"type":"string"},"question":{"type":"string"}}},"csTryOnCode":{"type":"string","enum":["unknown","none","open","try"]},"baUser":{"description":"Represents a user in eTop system. The user may or may not have associated accounts.\n","type":"object","required":["id","full_name","short_name","phone","email","created_at","updated_at"],"properties":{"block_reason":{"type":"string"},"blocked_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"email":{"type":"string"},"email_verification_sent_at":{"type":"string","format":"date-time"},"email_verified_at":{"type":"string","format":"date-time"},"full_name":{"type":"string"},"id":{"type":"string","format":"int64"},"is_blocked":{"type":"boolean"},"phone":{"type":"string"},"phone_verification_sent_at":{"type":"string","format":"date-time"},"phone_verified_at":{"type":"string","format":"date-time"},"ref_aff":{"type":"string"},"ref_sale":{"type":"string"},"short_name":{"type":"string"},"source":{"$ref":"#/components/schemas/djUserSource"},"total_shop":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"}}},"djUserSource":{"type":"string","enum":["unknown","psx","etop","topship","ts_app_android","ts_app_ios","ts_app_web","partner","etop_app_ios","etop_app_android","telecom","admin"]},"mcCreateShopAccountRequest":{"type":"object","properties":{"email":{"type":"string"},"fullname":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"shop_name":{"type":"string"}}}}}}
```

**Request**

```json
curl --location '$BASE_URL.Shop/CreateShopAccount' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--data '{
  "email": "string",
  "fullname": "string",
  "password": "string",
  "phone": "string",
  "shop_name": "string"
}'
```

**Cấu trúc body của request**<br>

<table><thead><tr><th width="136.6793212890625">Tham số</th><th width="125.38763427734375">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>email</td><td>string</td><td>Email tài khoản shop</td></tr><tr><td>fullname</td><td>string</td><td>Tên user chủ shop</td></tr><tr><td>password</td><td>string</td><td>Mật khẩu của shop</td></tr><tr><td>phone</td><td>string</td><td>SDT của shop</td></tr><tr><td>shop_name</td><td>string</td><td>Tên shop</td></tr></tbody></table>

```json
{
  "api_key": "string",
  "shop": {
    "address": {
      "address1": "string",
      "address2": "string",
      "coordinates": {
        "latitude": 0,
        "longitude": 0
      },
      "country": "string",
      "district": "string",
      "district_code": "string",
      "email": "string",
      "exported_fields": [
        "string"
      ],
      "first_name": "string",
      "full_name": "string",
      "id": "string",
      "last_name": "string",
      "notes": {
        "lunch_break": "string",
        "note": "string",
        "open_time": "string",
        "other": "string"
      },
      "phone": "string",
      "position": "string",
      "province": "string",
      "province_code": "string",
      "type": "unknown",
      "ward": "string",
      "ward_code": "string",
      "zip": "string"
    },
    "auto_create_ffm": true,
    "bank_account": {
      "account_name": "string",
      "account_number": "string",
      "branch": "string",
      "name": "string",
      "province": "string"
    },
    "block_reason": "string",
    "code": "string",
    "company_info": {
      "address": "string",
      "legal_representative": {
        "email": "string",
        "name": "string",
        "phone": "string",
        "position": "string"
      },
      "name": "string",
      "tax_code": "string",
      "website": "string"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "email": "string",
    "exported_fields": [
      "string"
    ],
    "ghn_note_code": "unknown",
    "id": "string",
    "image_url": "string",
    "inventory_overstock": true,
    "is_blocked": true,
    "is_prior_money_transaction": true,
    "is_test": true,
    "money_transaction_count": 0,
    "money_transaction_rrule": "string",
    "name": "string",
    "owner_id": "string",
    "phone": "string",
    "product_source_id": "string",
    "ship_from_address_id": "string",
    "ship_to_address_id": "string",
    "shipping_service_select_strategy": [
      {
        "key": "string",
        "value": "string"
      }
    ],
    "status": "Z",
    "survey_info": [
      {
        "answer": "string",
        "key": "string",
        "question": "string"
      }
    ],
    "try_on": "unknown",
    "updated_at": "2019-08-24T14:15:22Z",
    "user": {
      "block_reason": "string",
      "blocked_at": "2019-08-24T14:15:22Z",
      "created_at": "2019-08-24T14:15:22Z",
      "email": "string",
      "email_verification_sent_at": "2019-08-24T14:15:22Z",
      "email_verified_at": "2019-08-24T14:15:22Z",
      "full_name": "string",
      "id": "string",
      "is_blocked": true,
      "phone": "string",
      "phone_verification_sent_at": "2019-08-24T14:15:22Z",
      "phone_verified_at": "2019-08-24T14:15:22Z",
      "ref_aff": "string",
      "ref_sale": "string",
      "short_name": "string",
      "source": "unknown",
      "total_shop": 0,
      "updated_at": "2019-08-24T14:15:22Z"
    },
    "website_url": "string"
  },
  "shop_key": "string"
}
```

## **BlockUser**

## POST $BASE\_URL.User/BlockUser

> BlockUser

```json
{"openapi":"3.1.1","info":{"title":"API Document","version":"v1"},"tags":[{"name":"User"}],"paths":{"$BASE_URL.User/BlockUser":{"post":{"tags":["User"],"summary":"BlockUser","operationId":"partner.User-BlockUser","responses":{"200":{"description":"A successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/baUser"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/mcBlockUserRequest"}}},"required":true}}}},"components":{"schemas":{"baUser":{"description":"Represents a user in eTop system. The user may or may not have associated accounts.\n","type":"object","required":["id","full_name","short_name","phone","email","created_at","updated_at"],"properties":{"block_reason":{"type":"string"},"blocked_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"email":{"type":"string"},"email_verification_sent_at":{"type":"string","format":"date-time"},"email_verified_at":{"type":"string","format":"date-time"},"full_name":{"type":"string"},"id":{"type":"string","format":"int64"},"is_blocked":{"type":"boolean"},"phone":{"type":"string"},"phone_verification_sent_at":{"type":"string","format":"date-time"},"phone_verified_at":{"type":"string","format":"date-time"},"ref_aff":{"type":"string"},"ref_sale":{"type":"string"},"short_name":{"type":"string"},"source":{"$ref":"#/components/schemas/djUserSource"},"total_shop":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"}}},"djUserSource":{"type":"string","enum":["unknown","psx","etop","topship","ts_app_android","ts_app_ios","ts_app_web","partner","etop_app_ios","etop_app_android","telecom","admin"]},"mcBlockUserRequest":{"type":"object","required":["block_reason","user_id"],"properties":{"block_reason":{"type":"string"},"user_id":{"type":"string","format":"int64"}}}}}}
```

**Request**

```json
curl --location '$BASE_URL.User/BlockUser' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--data '{
  "block_reason": "string",
  "user_id": "string"
}'
```

**Cấu trúc body của request:**

<table><thead><tr><th width="136.6793212890625">Tham số</th><th width="125.38763427734375">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>block_reason<br><mark style="color:red;">required</mark></td><td>string</td><td>Lý do chặn</td></tr><tr><td>user_id<br><mark style="color:red;">required</mark></td><td>string</td><td>ID của người dùng muốn chặn<br>Lưu ý: Nếu muốn chặn shop bạn có thể truyền thông tin owner_id có được khi gọi API lấy danh sách shop </td></tr></tbody></table>

**Response**

```json
{
    "id": "string",
    "full_name": "string",
    "short_name": "string",
    "phone": "string",
    "email": "string",
    "created_at": "2025-04-08T03:12:56Z",
    "updated_at": "2025-10-15T02:08:47Z",
    "email_verified_at": "2025-04-08T03:12:56Z",
    "phone_verified_at": null,
    "email_verification_sent_at": null,
    "phone_verification_sent_at": null,
    "source": "partner",
    "total_shop": 0,
    "is_blocked": true,
    "block_reason": "string",
    "blocked_at": null,
    "ref_sale": "",
    "ref_aff": ""
}
```

## UnblockUser <a href="#cac-loi-thuong-gap" id="cac-loi-thuong-gap"></a>

## POST $BASE\_URL.User/UnblockUser

> UnblockUser

```json
{"openapi":"3.1.1","info":{"title":"API Document","version":"v1"},"tags":[{"name":"User"}],"paths":{"$BASE_URL.User/UnblockUser":{"post":{"tags":["User"],"summary":"UnblockUser","operationId":"partner.User-UnblockUser","responses":{"200":{"description":"A successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/baUser"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/mcUnblockUserRequest"}}},"required":true}}}},"components":{"schemas":{"baUser":{"description":"Represents a user in eTop system. The user may or may not have associated accounts.\n","type":"object","required":["id","full_name","short_name","phone","email","created_at","updated_at"],"properties":{"block_reason":{"type":"string"},"blocked_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"email":{"type":"string"},"email_verification_sent_at":{"type":"string","format":"date-time"},"email_verified_at":{"type":"string","format":"date-time"},"full_name":{"type":"string"},"id":{"type":"string","format":"int64"},"is_blocked":{"type":"boolean"},"phone":{"type":"string"},"phone_verification_sent_at":{"type":"string","format":"date-time"},"phone_verified_at":{"type":"string","format":"date-time"},"ref_aff":{"type":"string"},"ref_sale":{"type":"string"},"short_name":{"type":"string"},"source":{"$ref":"#/components/schemas/djUserSource"},"total_shop":{"type":"integer"},"updated_at":{"type":"string","format":"date-time"}}},"djUserSource":{"type":"string","enum":["unknown","psx","etop","topship","ts_app_android","ts_app_ios","ts_app_web","partner","etop_app_ios","etop_app_android","telecom","admin"]},"mcUnblockUserRequest":{"type":"object","required":["user_id"],"properties":{"user_id":{"type":"string","format":"int64"}}}}}}
```

**Request**

```json
curl --location '$BASE_URL.User/UnblockUser' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--data '{
  "user_id": "string"
}'
```

**Cấu trúc body của request:**

<table><thead><tr><th width="136.6793212890625">Tham số</th><th width="125.38763427734375">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>user_id<br><mark style="color:red;">required</mark></td><td>string</td><td>ID của người dùng bạn muốn bỏ chặn</td></tr></tbody></table>

**Response**

```json
{
    "id": "string",
    "full_name": "string",
    "short_name": "string",
    "phone": "string",
    "email": "string",
    "created_at": "2025-04-08T03:12:56Z",
    "updated_at": "2025-10-15T02:08:47Z",
    "email_verified_at": "2025-04-08T03:12:56Z",
    "phone_verified_at": null,
    "email_verification_sent_at": null,
    "phone_verification_sent_at": null,
    "source": "partner",
    "total_shop": 0,
    "is_blocked": false,
    "block_reason": "string",
    "blocked_at": null,
    "ref_sale": "",
    "ref_aff": ""
}
```

## Các lỗi thường gặp <a href="#cac-loi-thuong-gap" id="cac-loi-thuong-gap"></a>

**400 Bad Request**

```json
{
  "code": "invalid_argument",
  "msg": "..."
}
```

Vui lòng kiểm tra lại các giá trị cung cấp.

**401 Unauthorized**

```json
{
  "code": "unauthenticated",
  "msg": "..."
}
```

Vui lòng kiểm tra lại request đã bao gồm header `Authorization: <api_key>` đúng.

**403 Forbidden**

```json
{
    "code": "permission_denied",
    "msg": "...",
    "meta": {
        "reason": "Chỉ có thể sử dụng shop_id nếu shop đã từng đăng nhập qua hệ thống của đối tác."
    }
}
```

Shop chưa bao giờ đăng nhập vào eTelecom thông qua hệ thống của đối tác. Hãy thử lại với request mà không bao gồm `shop_id`.

**Lưu ý**: trong trường hợp shop từng đăng nhập vào eTelecom thông qua hệ thống của đối tác, sau đó gỡ liên kết với đối tác, kết quả trả về vẫn là `200 OK` với yêu cầu shop đăng nhập và cấp quyền lại. Nên lỗi `permission_denied` chỉ xảy ra khi `shop_id` được cung cấp không chính xác.

**404 Not Found**

```json
{
    "code": "bad_route",
    "msg": "unexpected Content-Type: \"\""
}
```

Vui lòng kiểm tra lại path và header `Content-Type: application/json`.


---

# Agent Instructions: 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:

```
GET https://docs.etelecom.vn/tich-hop-api/partner/su-dung.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
