# Tạo shop qua API

{% hint style="info" %}
Partner sử dụng thông tin API\_KEY mà eTelcom đã cấp trước đó để sử dụng API
{% endhint %}

## 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 'Accept: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--data '{
  "email": "string",
  "fullname": "string",
  "password": "string",
  "phone": "string",
  "shop_name": "string"
}'
```

**Response:**

```json
{
    "shop": {
        "exported_fields": [],
        "inventory_overstock": false,
        "id": "string",
        "name": "string",
        "status": "Z",
        "is_test": false,
        "address": null,
        "phone": "string",
        "bank_account": null,
        "auto_create_ffm": false,
        "website_url": "",
        "image_url": "",
        "email": "string",
        "product_source_id": "0",
        "ship_to_address_id": "0",
        "ship_from_address_id": "0",
        "is_blocked": false,
        "block_reason": "",
        "try_on": "unknown",
        "owner_id": "string",
        "user": null,
        "company_info": null,
        "money_transaction_rrule": "",
        "survey_info": [],
        "shipping_service_select_strategy": [],
        "code": "",
        "is_prior_money_transaction": null,
        "created_at": null,
        "updated_at": null,
        "money_transaction_count": 0
    },
    "api_key": "string",
    "shop_key": "string"
}
```

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

<table><thead><tr><th width="176.259521484375">Tham số</th><th width="175.488037109375">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>email<br><mark style="color:$danger;">require</mark></td><td>string</td><td>Thông tin email</td></tr><tr><td>fullname<br><mark style="color:$danger;">require</mark></td><td>string</td><td>Tên tài khoản</td></tr><tr><td>password<br><mark style="color:$danger;">require</mark></td><td>string</td><td>Mật khẩu đăng nhập trang quản trị cs</td></tr><tr><td>phone<br><mark style="color:$danger;">require</mark></td><td>string</td><td>Số điện thoại tạo tài khoản</td></tr><tr><td>shop_name<br><mark style="color:$danger;">require</mark></td><td>string</td><td>Tên công ty hoặc tên shop</td></tr></tbody></table>

**Cấu trúc thuộc tính dữ liệu trả về:**

<table><thead><tr><th width="176.259521484375">Tham số</th><th width="175.488037109375">Kiểu dữ liệu</th><th>Mô tả</th></tr></thead><tbody><tr><td>shop_key</td><td>string</td><td>Chính là key để sử dụng API ở role shop</td></tr><tr><td>id</td><td>string</td><td>ID của shop đã tạo trên eTelecom</td></tr><tr><td>owner_id</td><td>string</td><td>ID của chủ shop</td></tr></tbody></table>

<br>
