Code 40002 is TikTok's general "invalid or missing parameter" response. When it carries the message "Please select a pixel.", the cause is specific: an ad group with a conversion goal was sent without a pixel. This page covers that message and the two that follow it once you add one.
The exact error
The TikTok Marketing API reports refusals in the response body, usually with HTTP 200, so check code on every response. On /adgroup/create/:
{
"code": 40002,
"message": "Please select a pixel.",
"request_id": "...",
"data": {}
}
We measured three messages in order, on a real advertiser:
| What you sent | TikTok's 40002 message |
|---|---|
No pixel_id | "Please select a pixel." |
| A pixel id that does not exist | "Pixel ID doesn't exist." |
| A real pixel with no matching event | "This pixel event type does not exist. Please make sure that you have created the pixel event in Events Manager." |
What it means
The objectives WEB_CONVERSIONS, CONVERSIONS, PRODUCT_SALES and LEAD_GENERATION optimise toward a conversion event. TikTok needs to know which pixel reports that event, so the ad group requires pixel_id and optimization_event. The campaign is created fine; the ad group is where it fails.
Why it happens
- The advertiser has no pixel yet, or the code never sends
pixel_id. - The pixel id belongs to a different advertiser, or was mistyped.
- The pixel exists but the event you chose was never created in Events Manager.
- The pixel is new. TikTok refreshes pixel event data every 2 to 4 hours, so a pixel that started firing recently can still list no events.
One more trap: listing pixels with /pixel/list/ and creating events need the Pixel Management permission group on your developer app. Without it those calls return 40001, which looks like a broken connection and is not one.
How to fix it
- Create or find the pixel in TikTok Events Manager for this advertiser, and install it on your website.
- Create the event you want to optimise for (for example a purchase or a lead) in Events Manager.
- List pixels and events with
/pixel/list/to get the exactpixel_idand the event names it can optimise toward. - Send both fields on the ad group:
pixel_idandoptimization_event. - Or change the objective. If you have no pixel, use a goal that does not need one, such as traffic.
How Hermoso handles it
Hermoso checks a conversion ad group for a pixel before it calls TikTok, and when one is missing it refuses with a sentence naming what is missing and where to create it, instead of letting TikTok answer one field at a time. TikTok requires thirteen ad group fields together and reports only the first missing one per call, so Hermoso checks them all locally and names every absentee at once.
Hermoso lists the advertiser's pixels with the events each can optimise toward, and says plainly that a recently installed pixel can still show an empty event list. Every ad group Hermoso creates on TikTok is born paused, so nothing spends until you switch it on. See TikTok Ads over MCP.
Related
- TikTok Ads API: "Complete payment to continue"
- TikTok error: unaudited_client_can_only_post_to_private_accounts
- TikTok error: spam_risk_too_many_pending_share
Every platform error we have documented is on the error reference. For app reviews and access levels, see how to get API access.
Sources
Frequently asked questions
What does TikTok error 40002 Please select a pixel mean?
The ad group uses a conversion goal but the request had no pixel_id. Add the pixel and an optimization_event, or choose an objective that does not need a pixel.
Why does TikTok say Pixel ID doesn't exist?
The pixel id you sent is not a pixel this advertiser owns. List the advertiser's pixels and copy the id exactly.
Why does my pixel show no events?
TikTok refreshes pixel event data every 2 to 4 hours, and an event must also be created in Events Manager before you can optimise for it.


