> For the complete documentation index, see [llms.txt](https://developers.accesstrade.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.accesstrade.vn/api-publisher-vietnamese/tich-hop-api-publisher-at-cho-chien-dich-tiktok-shop/version-2-updated-version/create-link-v2.md).

# Create link-v2

#### POST

<https://api.accesstrade.vn/v2/tiktokshop\\_product\\_feeds/create\\_link>

#### Create TikTokShop Product Feed Link

This endpoint allows the creation of a TikTokShop product feed link.

**Request Body**

* product\_url (string): The URL of the product.
* product\_id (string)- optional: The ID of the product.
* utm\_source (string) - optional: tracking param
* publisher put in
* utm\_medium (string) - optional: tracking param
* publisher put in
* utm\_campaign (string) - optional: tracking param
* publisher put in
* utm\_content (string) - optional: tracking param
* publisher put in
* sub\_1 (string) - optional: tracking param publisher put in
* sub\_2 (string) - optional: tracking param publisher put in
* sub\_3 (string) - optional: tracking param publisher put in
* sub\_4 (string) - optional: tracking param publisher put in

#### \[Example] create link

```curl
curl --location -g '{{local}}/v2/tiktokshop_product_feeds/create_link' \
--header 'accept: application/json, text/plain, */*' \
--header 'accept-language: en-US,en;q=0.6' \
--header 'authorization: Token bg1F-zURtCYDWH8KB79fLS5abjIyOg0G' \
--header 'content-type: application/json' \
--header 'origin: https://pub2.accesstrade.vn' \
--header 'priority: u=1, i' \
--header 'referer: https://pub2.accesstrade.vn/' \
--header 'sec-ch-ua: "Chromium";v="136", "Brave";v="136", "Not.A/Brand";v="99"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'sec-fetch-dest: empty' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-site: same-site' \
--header 'sec-gpc: 1' \
--header 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36' \
--data '{
    "product_url": "https://vt.tiktok.com/ZSBKCcJrf/", 
    // "product_id": "1729836100247522192", 
    "utm_source": "huongtest1",
    "utm_medium": "huongtest2",
    "utm_campaign": "huongtest3",
    "utm_content": "huongtest4",
    "sub1": "subhuong1",
    "sub2": "subhuong2",
    "sub3": "subhuong3",
    "sub4": "subhuong4"
}'
```

**Response**

* Status: 200
* Content-Type: application/json

#### Example Response

```json
{
  "data": {
    "aff_short_url": "https://shorten.dev.accesstrade.me/WxmudqdK",
    "aff_url": "https://tracking.dev.accesstrade.me/deep_link/4348611760548105593/6648523843406889655?utm_campaign=huongtest3&sub4=subhuong4&sub3=subhuong3&url=https%3A%2F%2Fwww.tiktok.com%2Ft%2FZSSRJsSvW%2F&utm_content=huongtest4&utm_source=huongtest1&utm_medium=huongtest2",
    "product_commission": {
      "amount": "3.000",
      "currency": "VND",
      "rate": 1500
    },
    "product_id": "1729836100247522192",
    "product_image": "https://p16-oec-sg.ibyteimg.com/tos-alisg-i-aphluv4xwc-sg/3d7083325a3c4221b94b3c25218818e4~tplv-aphluv4xwc-resize-jpeg:800:800.jpeg?dr=15584&from=604555543&idc=my&ps=933b5bde&shcp=32ce9e9e&shp=2408c917&t=555f072d",
    "product_name": "Ghim Tráng Men Hình Mèo, Tranh Sơn Dầu Nghệ Thuật Van Gogh, Ghim Cài Áo Hoa Hướng Dương Đêm Đầy Sao Anime, Huy Hiệu Kim Loại, Trâm Cài Ve Áo, Quà Tặng Trang Sức Cho Bạn Bè",
    "product_price": {
      "amount": "20000",
      "currency": "VND"
    }
  },
  "message": "create link affiliate success",
  "status": true
}
```

**Successful Response**

```json
{
    "data": {
        "aff_short_url": "",
        "aff_url": ""
    },
    "status": true,
    "message": ""
}
```

* `data` (object):
  * `aff_short_url` (string): Shortened affiliate link.
  * `aff_url` (string): Full affiliate link.
* `status` (boolean): Indicates the status of the request.

**Unsuccessful Response**

```json
{
    "data": {
        "aff_short_url": "",
        "aff_url": ""
    },
    "status": false,
    "message": ""
}
```

* `data` (object):
  * `aff_short_url` (string): Shortened affiliate link.
  * `aff_url` (string): Full affiliate link.
* `status` (boolean): Indicates the status of the request.

#### \[Example] Link sản phẩm không có trong chương trình aff

curl

```curl
curl --location -g '{{prod}}/v2/tiktokshop_product_feeds/create_link' \
--header 'accept: application/json, text/plain, */*' \
--header 'accept-language: en-US,en;q=0.6' \
--header 'authorization: Token bg1F-zURtCYDWH8KB79fLS5abjIyOg0G' \
--header 'content-type: application/json' \
--header 'origin: https://pub2.accesstrade.vn' \
--header 'priority: u=1, i' \
--header 'referer: https://pub2.accesstrade.vn/' \
--header 'sec-ch-ua: "Chromium";v="136", "Brave";v="136", "Not.A/Brand";v="99"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'sec-fetch-dest: empty' \
--header 'sec-fetch-mode: cors' \
--header 'sec-fetch-site: same-site' \
--header 'sec-gpc: 1' \
--header 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36' \
--data '{
    "product_url": "https://shop.tiktok.com/view/product/1732294586233555574?region=VN&local=en", 
    // "product_id": "1729836100247522192", 
    "utm_source": "huongtest1",
    "utm_medium": "huongtest2",
    "utm_campaign": "huongtest3",
    "utm_content": "huongtest4",
    "sub1": "subhuong1",
    "sub2": "subhuong2",
    "sub3": "subhuong3",
    "sub4": "subhuong4"
}'
```

Example Response

```javascript
{
  "data": {},
  "message": "The link is not part of the campaign",
  "status": false
}
```

| **Tên Header**         | **Giá trị**                                                                                                             |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **accept**             | application/json, text/plain, */*                                                                                       |
| **accept-language**    | en-US,en;q=0.6                                                                                                          |
| **authorization**      | Token bg1F-zURtCYDWH8KB79fLS5abjlyOg0G                                                                                  |
| **content-type**       | application/json                                                                                                        |
| **origin**             | [https://pub2.accesstrade.vn](https://pub2.accesstrade.vn/)                                                             |
| **priority**           | u=1, i                                                                                                                  |
| **referer**            | <https://pub2.accesstrade.vn/>                                                                                          |
| **sec-ch-ua**          | "Chromium";v="136", "Brave";v="136", "Not.A/Brand";v="99"                                                               |
| **sec-ch-ua-mobile**   | ?0                                                                                                                      |
| **sec-ch-ua-platform** | "macOS"                                                                                                                 |
| **sec-fetch-dest**     | empty                                                                                                                   |
| **sec-fetch-mode**     | cors                                                                                                                    |
| **sec-fetch-site**     | same-site                                                                                                               |
| **sec-gpc**            | 1                                                                                                                       |
| **user-agent**         | Mozilla/5.0 (Macintosh; Intel Mac OS X 10\_15\_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 |

Body&#x20;raw (json)

```json
{
    "product_url": "https://shop.tiktok.com/view/product/1732194463914036099?region=VN&local=en", 
    // "product_id": "1729836100247522192", 
    "utm_source": "huongtest1",
    "utm_medium": "huongtest2",
    "utm_campaign": "huongtest3",
    "utm_content": "huongtest4",
    "sub1": "subhuong1",
    "sub2": "subhuong2",
    "sub3": "subhuong3",
    "sub4": "subhuong4"
}
```

\*Để tối ưu thời gian tạo link, vui lòng tham khảo sử dụng:

**Query Params**

* minify: true (When this parameter is used, the API will return only affiliate link information and exclude product details to reduce the API’s response time.)

<https://api.accesstrade.vn/v2/tiktokshop_product_feeds/create_link?minify=true>
