Guides
API principles

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" } }
  • code 0 is success. 20001 (partially successful, on /adgroup/status/update/ with allow_partial_success) is also a success code.
  • Errors come with HTTP 200 and a non-zero code: decide on code, never on the HTTP status.
  • On Marketing API errors, data is {}.
  • request_id identifies the call and also comes in the X-Tt-Logid header. Keep it in your logs.
json
{ "code": 40002, "message": "Missing required field(s): pacing.", "request_id": "202611061243198C6E658D431503A557", "data": {} }

Exceptions

CaseResponse
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 methodHTTP 404 with the text 404 page not found
A documented route or feature outside Mimicr's coreHTTP 501 with code 40014
Chaos 503HTTP 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

codeMeaningWhen
0OKSuccess
20001Partially successful/adgroup/status/update/ with invalid ids and allow_partial_success
40000Invalid parametersA body that is not JSON, or a wrong JSON type
40001No permissionAccount not granted to the token, missing scope, another account's Pixel, disabled account
40002Parameter errorMost validations
40007Object does not existUnknown campaign, ad group, ad, task or test lead
40011Too many idsId lists over the limit (100 in filtering)
40014Not simulatedFeatures outside the core, with HTTP 501
40050Duplicated requestSame request_id within 10 seconds
40051Invalid version/v1.2/ and /v1.1/
40053Invalid video_idA video of another account, or unknown
40065Ages 13–17 in the USTargeting
40100Too many requestsApp limit (see Rate limits)
40101, 40104, 40105, 40107, 40108, 40110, 40113AuthenticationSee Authentication
40118Allowlist onlyDynamic daily budget on reach objectives, app events
40133Advertiser limitToo many requests per advertiser and route
40200, 40201Task error, task not readyAsync report and lead download
40202Write conflictChaos and the [conflito] trigger; retry
40300Advertiser does not existUnknown advertiser_id
40502Ad limitMore than 50 ads in an ad group
50000, 51003Service errorChaos 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

codeAction
40100, 40133, 40202, 50000, 51003Retry with growing backoff
40105, 40001 for an account not grantedAsk the advertiser for a new authorization
40002, 40007, 40014 and the restFix the request; repeating it does not change the outcome