Guides
Envelope and errors
The {code, message, request_id, data} envelope, HTTP 200 on errors, the exceptions, the return codes and the message format.
The envelope
Every JSON response of the Marketing API has the same shape:
json
{ "code": 0, "message": "OK", "request_id": "202611061243183BA35E6EF252DB3125", "data": { "campaign_id": "1700013373458745" } }code0 is success.20001(partially successful, on/adgroup/status/update/withallow_partial_success) is also a success code.- Errors come with HTTP 200 and a non-zero
code: decide oncode, never on the HTTP status. - On Marketing API errors,
datais{}. request_ididentifies the call and also comes in theX-Tt-Logidheader. Keep it in your logs.
json
{ "code": 40002, "message": "Missing required field(s): pacing.", "request_id": "202611061243198C6E658D431503A557", "data": {} }Exceptions
| Case | Response |
|---|---|
Events API (/event/track/) | HTTP 400 or 401 on errors, without data (see Events API) |
/oauth/token/ | Flat body: access_token, token_type, advertiser_ids and scope next to code |
/report/task/download/ with CSV_STRING and /page/lead/task/download/ | The CSV in the body (text/csv); errors come in the envelope |
| Unknown path, missing trailing slash or wrong method | HTTP 404 with the text 404 page not found |
| A documented route or feature outside Mimicr's core | HTTP 501 with code 40014 |
Chaos 503 | HTTP 503 with code 50000 |
json
{ "code": 40014, "message": "Not simulated by Mimicr: dimension platform is outside the integration core.", "request_id": "20261106124339CEE4C23C500D9192A6", "data": {} }Codes Mimicr uses
code | Meaning | When |
|---|---|---|
| 0 | OK | Success |
| 20001 | Partially successful | /adgroup/status/update/ with invalid ids and allow_partial_success |
| 40000 | Invalid parameters | A body that is not JSON, or a wrong JSON type |
| 40001 | No permission | Account not granted to the token, missing scope, another account's Pixel, disabled account |
| 40002 | Parameter error | Most validations |
| 40007 | Object does not exist | Unknown campaign, ad group, ad, task or test lead |
| 40011 | Too many ids | Id lists over the limit (100 in filtering) |
| 40014 | Not simulated | Features outside the core, with HTTP 501 |
| 40050 | Duplicated request | Same request_id within 10 seconds |
| 40051 | Invalid version | /v1.2/ and /v1.1/ |
| 40053 | Invalid video_id | A video of another account, or unknown |
| 40065 | Ages 13–17 in the US | Targeting |
| 40100 | Too many requests | App limit (see Rate limits) |
| 40101, 40104, 40105, 40107, 40108, 40110, 40113 | Authentication | See Authentication |
| 40118 | Allowlist only | Dynamic daily budget on reach objectives, app events |
| 40133 | Advertiser limit | Too many requests per advertiser and route |
| 40200, 40201 | Task error, task not ready | Async report and lead download |
| 40202 | Write conflict | Chaos and the [conflito] trigger; retry |
| 40300 | Advertiser does not exist | Unknown advertiser_id |
| 40502 | Ad limit | More than 50 ads in an ad group |
| 50000, 51003 | Service error | Chaos and the [falha-simulada] trigger; retry |
Messages
- Missing field:
Missing required field(s): <a>, <b>. - Invalid value:
Invalid value for <path>: <reason>., with dot paths and indexes (creatives.0.ad_text,data.2.event_id). - Business rules: a short English sentence (
The new budget should be at least 105% of the current spend.).
Message texts TikTok does not publish are Mimicr's; handle errors by code, not by text.
What to retry
code | Action |
|---|---|
| 40100, 40133, 40202, 50000, 51003 | Retry with growing backoff |
| 40105, 40001 for an account not granted | Ask the advertiser for a new authorization |
| 40002, 40007, 40014 and the rest | Fix the request; repeating it does not change the outcome |