> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nekt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TikTok Shop Affiliates as a data source

> Bring your TikTok Shop affiliate (creator) data to your Lakehouse: affiliate orders and commissions, collaborations and sample requests.

TikTok Shop Affiliates covers the creator side of a TikTok Shop: the orders creators and affiliate partners generated for your shop, with the creator, the video or LIVE behind each sale and the commission; the open and targeted collaborations you offer creators; and the free samples creators request. It uses the TikTok Shop Affiliate Seller API.

> [!NOTE]
>
> This is a separate connector from [TikTok Shop](https://docs.nekt.com/sources/tiktok-shop.md), which brings orders, products, finance and LIVE analytics. TikTok Shop only grants the affiliate permission to a different kind of app, so the affiliate data needs its own source and its own authorization. You can use both at the same time.

## Configuring TikTok Shop Affiliates as a Source

In the [Sources](https://app.nekt.ai/sources) tab, click on the "Add source" button located on the top right of your screen. Then, select the TikTok Shop Affiliates option from the list of connectors.

Click **Next** and you'll be prompted to add your access.

### 1. Add account access

You'll need to authorize Nekt to read your shop's affiliate data. You don't need to register anything in the TikTok Shop Partner Center: Nekt has its own app there, and you simply grant it access to your shop.

Click on the **Authorization** button. You'll be redirected to TikTok Shop, where you need to be signed in to the Seller Center account that owns the shop (the main account, or a sub-account with permission to manage affiliates). There you'll:

1. Confirm the **shop** the authorization applies to, choose the **access duration** (we recommend *Unlimited*, so the connection doesn't stop working on a fixed date) and enter a **contact email**, then click **Confirm installation**.
2. Review the permissions Nekt is requesting (affiliate collaboration information and shop information), accept the acknowledgement, and click **Authorize**.

You'll be redirected back to Nekt with the connection filled in automatically. If you ever need to reconnect the shop, use the **Refresh** button next to the field.

The following configuration is also available:

* **Initial sync date**: The earliest order creation date read by the **Affiliate Orders** table on the first sync and on every full sync. If not provided, all the history TikTok Shop keeps is read.

The following advanced settings are also available:

* **Affiliate orders lookback (days)**: (Default: `7`) How many days before the last synced order the **Affiliate Orders** table re-reads on each sync, to catch orders TikTok Shop attributes to a creator a few days late.
* **Settlement tracking (days)**: (Default: `90`) How many days after its creation an affiliate order that is not settled yet keeps being re-read, so its settlement status and actual commission are updated.
* **Shop cipher**: The encrypted identifier of a single shop. Leave it empty to sync every shop the authorization covers: the connector finds the shops automatically.
* **Shop ID**: The shop identifier written in the rows. Only used when a shop cipher is set manually.

> [!NOTE]
>
> Don't have access to the TikTok Shop account yourself? Use the **Share link** option at the top of this step to send the authorization to whoever manages the shop: they complete it without needing a Nekt account.

Once you're done, click **Next**.

### 2. Select streams

Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis.

> Tip: The stream can be found more easily by typing its name.

Select the streams and click **Next**.

### 3. Configure data streams

Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.

* **Layer**: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
* **Folder**: a folder can be created inside the selected layer to group all tables being created from this new data source.
* **Table name**: we suggest a name, but feel free to customize it. You have the option to add a **prefix** to all tables at once and make this process faster!
* **Sync Type**: you can choose between INCREMENTAL and FULL\_TABLE.
  * Incremental: every time the extraction happens, we'll get only the new data, which is good if, for example, you want to keep every record ever fetched.
  * Full table: every time the extraction happens, we'll get the current state of the data, which is good if, for example, you don't want to have deleted data in your catalog.

Once you are done configuring, click **Next**.

### 4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters.

To define your [Trigger](https://docs.nekt.com/runs/scheduling-and-triggers.md), consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times).

Optionally, you can define some additional settings:

* Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource [here](https://docs.nekt.com/get-started/core-concepts/resource-control).
* Determine when to execute an **Additional [Full Sync](https://docs.nekt.com/get-started/core-concepts/types-of-sync#additional-full-sync)**. This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while.

Once you are ready, click **Next** to finalize the setup.

### 5. Check your new source

You can view your new source on the [Sources](https://app.nekt.ai/sources) page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.

> [!WARNING]
>
> For you to be able to see it on your [Catalog](https://app.nekt.ai/catalog), you need at least one successful source run.

# Streams and Fields

## Available streams

The table below lists every stream, its **slug** (the exact identifier to pass when creating the source via API) and a short description. Every stream needs the affiliate collaboration permission that the authorization above grants.

| Stream | Slug | Description |
| - | - | - |
| Affiliate Orders | `affiliate_orders` | One row per order item sold through a creator or affiliate partner, with the creator, the content and the commission. |
| Open Collaborations | `open_collaborations` | Products offered to every creator, with the commission rate. |
| Open Collaboration Creators | `open_collaboration_creators` | Creators promoting each product of an open collaboration, with how many videos and LIVEs they posted. |
| Target Collaborations | `target_collaborations` | Invitations sent to selected creators, in every status. |
| Target Collaboration Products | `target_collaboration_products` | Products of each target collaboration and the commission offered. |
| Target Collaboration Creators | `target_collaboration_creators` | Creators invited to each target collaboration. |
| Sample Applications | `sample_applications` | Free-sample requests from creators, with their status and the creator's profile. |

## Fields by stream

> [accordion] Affiliate Orders
>
> One row per order item (SKU) attributed to a creator or an affiliate partner. Synced incrementally by `create_time`; orders that are not settled yet are read again on every sync until they are (see Implementation Notes).
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `shop_id` | String | Shop the order belongs to |
> | `order_id` | String | TikTok Shop order ID |
> | `sku_id` | String | SKU of the order item |
> | `product_id` | String | Product of the SKU |
> | `sku_name` | String | SKU name as standardized by TikTok Shop |
> | `seller_sku` | String | Your own SKU code |
> | `create_time` | Datetime | When the order was created (UTC); incremental replication key |
> | `delivery_time` | Datetime | When the order was delivered (UTC) |
> | `settlement_status` | String | Commission settlement: Unknown, AWAITING PAYMENT and To-SETTLE (only the estimated commission exists yet), SETTLED, or INELIGIBLE (returned, refunded or cancelled, no commission) |
> | `creator_username` | String | TikTok username (@) of the creator the sale is attributed to; empty for affiliate partner campaign orders |
> | `content_type` | String | What generated the sale: SHOP (showcase), VIDEO, LIVE, PRE\_LIVE, PROMOTION\_PAGE or LINKSHARE |
> | `content_id` | String | ID of the video, LIVE or other content |
> | `open_collaboration_id` | String | Open collaboration the product was in |
> | `target_collaboration_id` | String | Target collaboration the product was in |
> | `campaign_id` | String | Affiliate partner campaign the product was in |
> | `commission_model` | String | Fixed commission or Tiered commission |
> | `commission_tier_setting` | String | For tiered commission, the rates (percent) by threshold, separated by OR |
> | `commission_rate` | Number | Creator commission rate, in percent (15.5 = 15.5%) |
> | `partner_commission_rate` | Number | Affiliate partner commission rate, in percent |
> | `shop_ads_commission_rate` | Number | Shop Ads commission rate, in percent |
> | `quantity` | Integer | Units in the order, including units refunded later |
> | `fully_returned` | Boolean | True when the whole item was returned or refunded |
> | `is_carousel` | Boolean | True when the sale came from carousel content |
> | `price_amount`, `price_currency` | Number, String | Selling price of the SKU |
> | `estimated_commission_base_amount`, `_currency` | Number, String | Price x quantity, before refunds |
> | `estimated_commission_amount`, `_currency` | Number, String | Estimated commission you pay the creator |
> | `estimated_partner_commission_amount`, `_currency` | Number, String | Estimated commission you pay the affiliate partner |
> | `estimated_shop_ads_commission_amount`, `_currency` | Number, String | Estimated Shop Ads commission |
> | `actual_commission_base_amount`, `_currency` | Number, String | Price x (quantity - returned), the base after refunds |
> | `actual_commission_amount`, `_currency` | Number, String | Actual commission you pay the creator |
> | `actual_partner_commission_amount`, `_currency` | Number, String | Actual commission you pay the affiliate partner |
> | `actual_shop_ads_commission_amount`, `_currency` | Number, String | Actual Shop Ads commission |
> | `estimated_cofunded_creator_bonus_amount`, `_currency` | Number, String | Estimated part of a creator bonus you co-fund in a commission boost |
> | `actual_cofunded_creator_bonus_amount`, `_currency` | Number, String | Actual part of a creator bonus you co-fund |

> [accordion] Open Collaborations
>
> Products in an open collaboration: any creator can promote them for the commission shown. Read in full on every sync. Collaborations you removed and that already expired are not returned.
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `shop_id` | String | Shop of the collaboration |
> | `id` | String | Open collaboration ID |
> | `status` | String | NORMAL, or TERMINATING (removed, expires at `commission_end_time`) |
> | `commission_rate` | Number | Commission rate, in percent |
> | `commission_start_time`, `commission_end_time` | Datetime | Period in which this commission rate applies (UTC) |
> | `showcase_creator_count` | Integer | Creators who added the product to their showcase |
> | `content_creator_count` | Integer | Creators who posted a video or LIVE with the product |
> | `product_id`, `product_title`, `product_main_image_url` | String | The product |
> | `product_status` | String | LIVE, OUT\_OF\_STOCK, SELLER\_DEACTIVATE, PLATFORM\_DEACTIVATE, GNE\_REJECT, DELETE or OTHER |
> | `product_inventory` | Integer | Product stock |
> | `product_original_price_currency`, `product_original_price_min_amount`, `product_original_price_max_amount` | String, Number | Original price range of the product's SKUs |

> [accordion] Open Collaboration Creators
>
> Creators promoting each product of an open collaboration. Read in full on every sync (one request per product).
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `shop_id` | String | Shop of the collaboration |
> | `open_collaboration_id` | String | Open collaboration |
> | `product_id` | String | Product the creator promotes |
> | `creator_key` | String | Creator identifier: the Creator Open ID, or `username:<username>` when TikTok Shop sends none |
> | `creator_open_id` | String | Creator Open ID (not returned in every market) |
> | `creator_username`, `creator_nickname` | String | Creator's TikTok username and nickname |
> | `creator_follower_count` | Integer | Followers |
> | `creator_avatar_url` | String | Avatar URL |
> | `video_count`, `live_count` | Integer | Videos and LIVEs the creator posted for the product |
> | `promotion_status` | String | NORMAL, or TERMINATING (you asked the creator to stop) |
> | `promotion_end_time` | Datetime | When the creator's promotion ends (UTC) |

> [accordion] Target Collaborations
>
> Invitations you sent to selected creators. Read in full on every sync, in every status.
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `shop_id` | String | Shop of the collaboration |
> | `id` | String | Target collaboration ID |
> | `name` | String | Name |
> | `message` | String | Message sent to the creators |
> | `type` | String | STANDARD or TOP\_CREATOR\_PROGRAM |
> | `status` | String | ONGOING (more than 7 days left), EXPIRING (less than 7 days left), VALID, CANCELING or COMPLETED (expired or cancelled) |
> | `start_time`, `end_time` | Datetime | Period of the collaboration (UTC) |
> | `create_time`, `update_time` | Datetime | Creation and last change (UTC) |
> | `creator_invited_count` | Integer | Creators invited |
> | `showcase_creator_count` | Integer | Creators who added at least one product to their showcase |
> | `content_creator_count` | Integer | Creators who posted content with the products |
> | `product_count` | Integer | Products in the collaboration |
> | `has_free_sample` | Boolean | Whether invited creators get free samples |
> | `is_sample_approval_exempt` | Boolean | Whether their sample requests are approved automatically |
> | `use_product_sample_setting` | Boolean | Whether the product-level sample rules apply |

> [accordion] Target Collaboration Products
>
> Products of each target collaboration, with the commission offered. Read in full on every sync.
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `shop_id` | String | Shop of the collaboration |
> | `target_collaboration_id` | String | Target collaboration |
> | `product_id`, `product_title`, `product_main_image_url` | String | The product |
> | `product_status` | String | Product status (LIVE, OUT\_OF\_STOCK, …) |
> | `collaboration_status` | String | NORMAL, DELETING or DELETED in this collaboration |
> | `commission_rate` | Number | Commission rate offered, in percent |
> | `shop_ads_commission_rate` | Number | Commission rate for orders from ads using the creator's content, in percent |
> | `commission_effective_time` | Datetime | When the commission takes effect (UTC) |
> | `commission_effective_status` | String | EFFECTIVE\_ALL, EFFECTIVE\_PARTIALLY or EFFECTIVE\_NONE |
> | `commission_currency`, `commission_min_amount`, `commission_max_amount` | String, Number | Estimated commission range of the product's SKUs |
> | `original_price_currency`, `original_price_min_amount`, `original_price_max_amount` | String, Number | Original price range |

> [accordion] Target Collaboration Creators
>
> Creators invited to each target collaboration. Read in full on every sync.
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `shop_id` | String | Shop of the collaboration |
> | `target_collaboration_id` | String | Target collaboration |
> | `creator_key` | String | Creator identifier: the Creator Open ID, or `username:<username>` |
> | `creator_open_id` | String | Creator Open ID (not returned in every market) |
> | `creator_username`, `creator_nickname` | String | Creator's TikTok username and nickname |
> | `creator_avatar_url` | String | Avatar URL |
> | `selection_region` | String | Region where the creator may promote products |
> | `collaboration_status` | String | NORMAL, DELETING or DELETED |
> | `product_effective_status` | String | EFFECTIVE\_ALL, EFFECTIVE\_PARTIALLY or EFFECTIVE\_NONE |
> | `showcase_product_count` | Integer | Products of the collaboration in the creator's showcase |
> | `content_product_count` | Integer | Products the creator posted a video or LIVE about |

> [accordion] Sample Applications
>
> Free-sample requests from creators. Read in full on every sync.
>
> | Field | Type | Description |
> | :- | :- | :- |
> | `shop_id` | String | Shop |
> | `id` | String | Sample application ID |
> | `status` | String | PENDING, AWAITING\_SHIPMENT, SHIPPED, CONTENT\_PENDING, COMPLETED, or one of the cancelled/failed statuses |
> | `fulfillment_status` | String | Content delivery by the creator: PENDING, ONGOING, SUCCEED, FAILED, OVERDUE, SUSPEND, CANCELLED or EXEMPTED |
> | `commission_rate` | Number | Commission rate for the creator on this product, in percent |
> | `order_id` | String | Sample order created when you approved the request |
> | `tracking_number` | String | Tracking number of the sample shipment |
> | `available_quantity` | Integer | Remaining sample quota of the product |
> | `approve_expiration_time`, `shipment_expiration_time` | Datetime | Deadlines to approve and to ship (UTC) |
> | `is_approvable` | Boolean | Whether the request can be approved |
> | `disapprovable_reasons` | Array | Why it cannot be approved |
> | `partner_name` | String | Agency that applied for the creator, if any |
> | `creator_open_id`, `creator_username`, `creator_nickname`, `creator_avatar_url` | String | The creator |
> | `creator_follower_count` | Integer | Followers |
> | `creator_gmv_amount`, `creator_gmv_currency` | Number, String | Creator's shoppable GMV in the last 30 days (empty if not disclosed) |
> | `creator_content_count` | Integer | Contents posted in the last 30 days (empty if not disclosed) |
> | `creator_fulfillment_percentage` | Number | Sample fulfillment rate in the last 90 days, in percent (empty if not disclosed) |
> | `creator_ec_video_view` | Integer | Median views of the creator's shoppable videos in the last 30 days (empty if not disclosed) |
> | `product_id`, `product_title`, `sku_id`, `sku_name`, `sku_image_url` | String | The product and SKU requested |

# Data Model

```mermaid theme={null}
flowchart LR
    Orders("Affiliate Orders");
    Open("Open Collaborations");
    OpenCreators("Open Collaboration Creators");
    Target("Target Collaborations");
    TargetProducts("Target Collaboration Products");
    TargetCreators("Target Collaboration Creators");
    Samples("Sample Applications");

    Orders -- "open_collaboration_id" --> Open;
    Orders -- "target_collaboration_id" --> Target;
    OpenCreators -- "open_collaboration_id" --> Open;
    TargetProducts -- "target_collaboration_id" --> Target;
    TargetCreators -- "target_collaboration_id" --> Target;
    Orders -. "creator_username" .-> TargetCreators;
    Samples -. "creator_username" .-> TargetCreators;
```

# Use Cases for Data Analysis

TikTok Shop does not offer a per-creator performance report through its API for every market, so creator results are computed from the affiliate orders. Replace the table names with the ones you chose in step 3.

### 1. Sales and commission by creator per month

```sql theme={null}
SELECT
    date_trunc('month', create_time) AS month,
    creator_username,
    content_type,
    count(DISTINCT order_id) AS orders,
    sum(quantity) AS items,
    sum(estimated_commission_base_amount) AS gmv,
    sum(estimated_commission_amount) AS estimated_commission,
    sum(CASE WHEN settlement_status = 'SETTLED' THEN actual_commission_amount END) AS settled_commission
FROM tiktok_shop_affiliates_affiliate_orders
WHERE creator_username IS NOT NULL
GROUP BY 1, 2, 3
ORDER BY 1 DESC, gmv DESC
```

### 2. Did the samples turn into sales?

```sql theme={null}
SELECT
    s.creator_username,
    count(DISTINCT s.id) AS samples,
    count(DISTINCT o.order_id) AS orders_after_sample,
    sum(o.estimated_commission_base_amount) AS gmv_after_sample
FROM tiktok_shop_affiliates_sample_applications s
LEFT JOIN tiktok_shop_affiliates_affiliate_orders o
    ON o.creator_username = s.creator_username
   AND o.product_id = s.product_id
WHERE s.status IN ('SHIPPED', 'CONTENT_PENDING', 'COMPLETED')
GROUP BY 1
ORDER BY gmv_after_sample DESC NULLS LAST
```

## Implementation Notes

* **Commission settlement.** The commission of an affiliate order is estimated first and settled weeks later (or becomes ineligible after a return). TikTok Shop only lets the connector search orders by creation date, so each sync reads again every order from the oldest one not settled yet. An order still not settled after **Settlement tracking (days)** stops being read with a warning; run a full sync of **Affiliate Orders** to refresh it.
* **Full sync.** A full sync of **Affiliate Orders** reads all the history again (from the Initial sync date, or from the start when it is empty), so it is safe to run. The whole history is read before the table is replaced, so a failed full sync keeps the previous table.
* **Creator identity.** Affiliate orders carry the creator's username, not an internal creator ID. The collaboration and sample tables carry the Creator Open ID when TikTok Shop sends it (not in every market).
* **Full table streams.** Collaborations, their products and creators, and sample applications are read in full on every sync. They are read completely before anything is written, and the listing is checked against the total TikTok Shop reports, so a sync that cannot read a table completely fails that table and keeps its previous copy.
* **Target collaborations you cannot open.** For some target collaborations TikTok Shop does not give the shop the details. They are listed in **Target Collaborations**, but their products and creators are missing, with a warning naming them.
* **Permissions.** Before reading anything, the connector checks that the authorization can read the affiliate data. Tables it cannot read are skipped with a warning; reconnect the source from the account that owns the shop to grant the permission.
* **Multiple shops.** A single authorization can cover more than one shop. Every row carries a `shop_id`.
* **Rates and amounts.** Commission rates are in percent. Amounts are numbers in the currency of the `_currency` column next to them.
* **Rate limits.** When TikTok Shop throttles a request, the connector waits and retries automatically, which can make an extraction take longer.

## Troubleshooting

| Error or symptom | What it means | What to do |
| :- | :- | :- |
| "refused the authorization of this source" | The authorization was cancelled or expired in TikTok Shop. | Reconnect the source (Authorization > Refresh) from the account that owns the shop. |
| Tables skipped with "cannot read the affiliate (creator collaboration) data" | The authorization does not include the affiliate permission. | Reconnect the source and approve every permission requested. |
| "not linked to any shop" | The authorization was granted without a shop. | Reconnect from the Seller Center account that owns the shop. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.