Samples and jobs
Sync and answer sample requests, and follow background jobs.
What it's for: answering sample requests (Manage Sample), asking for Spark Ads Codes (Request Spark Ads Code), and following every background job.
Samples
POST /samples/sync pulls the store's sample requests from TikTok in the background; GET /samples lists them by tab. Then:
- approve or reject:
POST /samples/reviewwithactionand the requests; - remind creators to post:
POST /samples/remind/send; - rate creators:
POST /samples/rating.
To review the requests waiting for you: GET /samples?shop_id=SHOP_ID&status=to_review; add any creator filter of Creators, such as min_gmv=1000000. The tabs (status) are all, to_review, ready_to_ship, shipped, shipment_delayed, content_pending, video_not_confirmed, live_not_confirmed, video_fulfilled, live_fulfilled, completed, completed_no_content, overdue, unfulfilled, rejected, canceled and expired.
On TikTok, a ready_to_ship request carries ship_url: Seller Center's To ship orders filtered to Free sample orders, where TikTok ships it (the Affiliate Center has no ship action), and its order_id.
Through the API these three run as jobs: the answer is 202 with the job (kind API_ACTION, status RUNNING, and a title that says what it does, such as Approve 12 sample requests), and the worker runs the change one at a time per store, a few seconds apart. The job ends COMPLETED or FAILED, with the route's answer (or its reason) in the job; the job.completed and job.failed webhooks tell you when.
{ "success": true, "data": { "job": { "id": "…", "kind": "API_ACTION", "ref_id": "…", "title": "Approve 12 sample requests", "status": "RUNNING", "shop_id": "…" } } }Jobs
Broadcasts, collaboration runs, syncs, imports and exports are jobs. GET /jobs lists them, latest change first:
- without
shop_id: the jobs of every store you work, TikTok Shop and Shopee, and your own, 20 a page (page, up to 5), withpage,limitandhas_more; - with
shop_id(a TikTok Shop or a Shopee store's id): that store's; status=RUNNING,FAILED(any ofRUNNING,SCHEDULED,STOPPED,COMPLETED,FAILED) andkinds=…narrow it.
Each job has its kind, ref_id, title, status, its counts (total, done, success, failed, skipped) and its error, worded for people: what went wrong and what to do.
| Kinds | What runs |
|---|---|
MESSAGE_BROADCAST, EMAIL_BROADCAST, WA_OFFICIAL_BROADCAST | A TikTok, email or WhatsApp broadcast (ref_id: the template's or broadcast's id) |
COLLAB_BROADCAST, COLLAB_SYNC, COLLAB_CHECK, COLLAB_END, COLLAB_CLEAN, COLLAB_CHANGE, COLLAB_MERGE | Target Collaboration: sending a template, syncing invitations, checking a template's creators (ref_id: the template's id, or <template id>:check as listed), ending, cleaning, changing or merging invitations |
SAMPLE_SYNC | Pulling sample requests from TikTok |
CREATOR_IMPORT, BLOCK_IMPORT, STORE_CREATOR_IMPORT, STORE_BLOCK_IMPORT | Imports |
CREATOR_EXPORT, BLOCK_EXPORT, STORE_CREATOR_EXPORT, STORE_BLOCK_EXPORT, SPARK_ADS_CODE_EXPORT, SAMPLES_EXPORT | Exports (started in the dashboard) |
SHOPEE_MESSAGE_BROADCAST, SHOPEE_COLLAB_BROADCAST, SHOPEE_COLLAB_SYNC, SHOPEE_SAMPLE_SYNC, SHOPEE_SAMPLE_SHIP, SHOPEE_SAMPLE_REVIEW, SHOPEE_SAMPLE_RATE, SHOPEE_SAMPLE_WAYBILL | The same on a Shopee store |
API_ACTION | A change made through the API on a store's samples |
REPLY_CHECK | Which creators a TikTok broadcast reached have replied (ref_id: <template id>:replies) |
Templates and broadcasts carry their own job (kind, ref_id, status, error) in their lists and details, so the job to follow, stop or start is on the row.
POST /jobs/stop stops a running or scheduled job and POST /jobs/start starts a stopped or failed broadcast or import again, both with the job's kind and ref_id (for COLLAB_CHECK the template's id is enough). A job that is not running answers 409 INVALID_STATE.
Instead of reading jobs again and again, add a webhook for job.completed, job.failed and job.stopped: each job sends one event when it ends.