Skip to main content

Campaigns, ad groups and ads

Use these calls when you want control over each level. To promote one post quickly, /boost does the three steps in one call.

Every call takes the ad account as explained in Choosing the ad account. All examples send profile_username.

Campaigns​

Create​

POST /api/uploadposts/ads/tiktok/campaigns
NameTypeRequiredDescription
nameStringYesUp to 512 characters.
goalStringYesreach, video_views, traffic or followers. Its ad groups must use the same goal.
budgetObjectNo{"amount": 100, "type": "daily" | "lifetime"}. Without it the campaign has no limit and the budget lives in its ad groups.
statusStringNopaused (default) or active.
idempotency_keyStringNoA retry with the same key within 10 minutes answers 409 instead of creating it twice.
curl -X POST https://api.upload-post.com/api/uploadposts/ads/tiktok/campaigns \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{"profile_username": "my-profile", "name": "Summer collection", "goal": "video_views"}'
{
"success": true,
"campaign_id": "1800000000000000001",
"campaign": { "campaign_id": "1800000000000000001", "campaign_name": "Summer collection", "objective_type": "VIDEO_VIEWS", "budget_mode": "BUDGET_MODE_INFINITE", "operation_status": "DISABLE" }
}

campaign is TikTok's own answer (shortened here).

List​

GET /api/uploadposts/ads/tiktok/campaigns

Returns the campaigns as TikTok has them, including the ones made in TikTok Ads Manager. Filters: ids (comma-separated, up to 100), page, page_size (default 50).

curl -G https://api.upload-post.com/api/uploadposts/ads/tiktok/campaigns \
-H 'Authorization: Apikey your-api-key-here' \
--data-urlencode 'profile_username=my-profile'
{
"success": true,
"campaigns": [
{ "campaign_id": "1800000000000000001", "campaign_name": "Summer collection", "objective_type": "VIDEO_VIEWS", "operation_status": "DISABLE", "budget_mode": "BUDGET_MODE_INFINITE" }
],
"page_info": { "page": 1, "page_size": 50, "total_number": 1, "total_page": 1 }
}

Ad groups​

The ad group holds the budget, the schedule and who sees the ads.

Create​

POST /api/uploadposts/ads/tiktok/adgroups
NameTypeRequiredDescription
campaign_idStringYesThe campaign.
nameStringYesUp to 512 characters.
goalStringYesThe campaign's goal.
budgetObjectYes{"amount": 20, "type": "daily"}. type: daily (default) or lifetime (needs schedule.end_date). TikTok's minimum is about 20 EUR a day.
targetingObjectYescountries (ISO codes) or location_ids, plus optional age, gender, interests, languages and audiences. Same fields as the boost targeting.
scheduleObjectNostart_date, end_date (YYYY-MM-DD, UTC, or ISO 8601). Default: from now, no end.
frequency, frequency_scheduleIntegerNoreach only: default 3 impressions every 7 days per person.
statusStringNopaused (default) or active.
idempotency_keyStringNoSame as for campaigns.

Ads run on the TikTok app placement.

curl -X POST https://api.upload-post.com/api/uploadposts/ads/tiktok/adgroups \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{
"profile_username": "my-profile",
"campaign_id": "1800000000000000001",
"name": "Spain 18-34",
"goal": "video_views",
"budget": {"amount": 25, "type": "daily"},
"targeting": {"countries": ["ES"], "age_min": 18, "age_max": 34}
}'
{
"success": true,
"adgroup_id": "1800000000000000002",
"adgroup": { "adgroup_id": "1800000000000000002", "adgroup_name": "Spain 18-34", "budget": 25.0, "operation_status": "DISABLE" }
}

List​

GET /api/uploadposts/ads/tiktok/adgroups

Filters: ids, campaign_id (comma-separated), page, page_size. Answers adgroups and page_info, like the campaign list.

Ads​

An ad promotes a post of the TikTok account linked to your ad account (a Spark Ad). Get identity_id and post_id as in Boost a post.

Create​

POST /api/uploadposts/ads/tiktok/ads
NameTypeRequiredDescription
adgroup_idStringYesThe ad group.
nameStringYesUp to 512 characters.
identity_idStringYesThe TikTok account (GET /identities).
post_idStringYesThe post (item_id of GET /spark/posts?identity_id=).
goalStringNoThe campaign's goal. Send traffic to require landing_page_url, and followers to allow VIEW_PROFILE.
landing_page_urlStringNoWebsite the ad links to.
call_to_actionStringNoButton. Only with landing_page_url (default LEARN_MORE when there is one).
statusStringNopaused (default) or active.
identity_typeStringNoTT_USER (default).
idempotency_keyStringNoSame as for campaigns.

The ad's text is the post's caption: there is no text field for it.

curl -X POST https://api.upload-post.com/api/uploadposts/ads/tiktok/ads \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{
"profile_username": "my-profile",
"adgroup_id": "1800000000000000002",
"name": "Summer video",
"identity_id": "5f39abca-0000-4000-8000-000000000001",
"post_id": "7311111111111111111",
"landing_page_url": "https://example.com/summer",
"call_to_action": "SHOP_NOW"
}'
{
"success": true,
"ad_id": "1800000000000000003",
"ad_ids": ["1800000000000000003"],
"need_audit": true
}

need_audit: true means TikTok reviews the ad before it runs.

Other ways to make an ad, less common: a post authorized with a code from the TikTok app (post_auth_code instead of identity_id + post_id), or a new video that is not on the TikTok profile (identity_id, video_id and a cover image_id from creatives, and ad_text up to 100 characters).

List​

GET /api/uploadposts/ads/tiktok/ads

Filters: ids, campaign_id, adgroup_id, page, page_size. Answers ads and page_info.

Edit​

PATCH /api/uploadposts/ads/tiktok/campaigns/{campaign_id}
PATCH /api/uploadposts/ads/tiktok/adgroups/{adgroup_id}
PATCH /api/uploadposts/ads/tiktok/ads/{ad_id}

Only the fields you send change. Status is changed with pause, resume and delete, not here.

LevelFields
Campaignname, budget (a number, or {"amount": n}), only if the campaign has its own daily or lifetime budget
Ad groupname, budget. TikTok requires at least 105% of what the ad group already spent.
Adname. ad_text only on ads made from a new video (it sends the ad to TikTok's review again).
curl -X PATCH https://api.upload-post.com/api/uploadposts/ads/tiktok/adgroups/1800000000000000002 \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{"profile_username": "my-profile", "budget": 40}'
{
"success": true,
"message": "Adgroup updated.",
"adgroup_id": "1800000000000000002",
"changed": { "budget": 40.0 },
"result": {}
}

Two answers to expect:

  • A campaign with no budget of its own (every boost campaign, and any campaign created without budget) answers 400 campaign_without_budget: change the budget of its ad groups.
  • ad_text on an ad that promotes an existing post answers 400 tiktok_ads_spark_text_fixed: its text is the post's caption.

Pause, resume and delete​

POST /api/uploadposts/ads/tiktok/{campaigns|adgroups|ads}/{id}/pause
POST /api/uploadposts/ads/tiktok/{campaigns|adgroups|ads}/{id}/resume
POST /api/uploadposts/ads/tiktok/{campaigns|adgroups|ads}/{id}/delete
  • Resume can start spending right away.
  • Delete cannot be undone: send {"confirm": true}, otherwise 400 confirmation_required.
  • Pausing a campaign stops everything under it.
curl -X POST https://api.upload-post.com/api/uploadposts/ads/tiktok/campaigns/1800000000000000001/resume \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{"profile_username": "my-profile"}'
{
"success": true,
"message": "Campaign resumed.",
"campaign_id": "1800000000000000001",
"result": { "campaign_ids": ["1800000000000000001"] }
}
curl -X POST https://api.upload-post.com/api/uploadposts/ads/tiktok/ads/1800000000000000003/delete \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{"profile_username": "my-profile", "confirm": true}'
{ "success": true, "message": "Ad deleted.", "ad_id": "1800000000000000003", "result": { "ad_ids": ["1800000000000000003"] } }

An id that is not in the ad account answers 404.

Next: Reports.