API Reference
Create an ad set
/v27.0/act_{ad_account_id}/adsetshttps://meta-ads.mimicr.dev · provider: https://graph.facebook.comCreates an ad set: budget, schedule, optimization goal, billing event, destination and audience. Validation errors come with error_user_title, error_user_msg (in pt-BR for pt_BR users) and error_data.blame_field_specs. Requires ads_management and a role on the ad account. Disabled or closed accounts (status 2, 101) answer (#200) The ad account is disabled.
Authorization
Bearer token in the Authorization: Bearer <token> header. See Authentication.
Path parameters
ID of the ad account (the path is act_{ad_account_id}).
"100539998049706"Body
application/x-www-form-urlencodedName of the ad set, up to 400 characters. [sem-entrega] in the name keeps it from delivering (Mimicr trigger).
ID of a campaign of this account that is not DELETED.
ACTIVE (default) or PAUSED.
ACTIVEPAUSEDWhat you pay for. Click-to-WhatsApp requires IMPRESSIONS.
What delivery optimizes for. Must fit the objective: ENGAGEMENT → CONVERSATIONS, LINK_CLICKS; TRAFFIC → LINK_CLICKS, LANDING_PAGE_VIEWS, REACH, …; LEADS → LEAD_GENERATION, QUALITY_LEAD, CONVERSATIONS; otherwise 100/2490408.
Bid strategy. LOWEST_COST_WITH_BID_CAP and COST_CAP need bid_amount.
Bid in the minor unit.
Daily budget in the minor unit; only for ad sets that run more than 24 h. Below the minimum for the goal returns 100/1885272 (sandbox minimums: R$ 1.00 impressions/reach, R$ 2.50 clicks, R$ 5.00 conversations/leads).
Lifetime budget in the minor unit; requires end_time (100/1487171).
Start time (ISO 8601, YYYY-MM-DD HH:MM:SS-07:00 or UNIX). Defaults to now.
End time; 0 for ongoing daily-budget ad sets. In the past returns 1487033.
WHATSAPP for click-to-WhatsApp (needs promoted_object.page_id with a WhatsApp number, else 100/2446880), WEBSITE, ON_AD for lead forms, …
Promoted object: {page_id, whatsapp_phone_number} for WhatsApp, {page_id} for leads, {pixel_id, custom_event_type} for conversions.
Show child attributes
ID of the Page. Required for WhatsApp and lead generation ad sets.
WhatsApp number (digits) the ads open a chat with. Must be the Page's number.
Phone number ID of the WhatsApp Business account.
ID of the dataset (pixel) for conversion optimization.
Conversion event to optimize for (PURCHASE, LEAD, …).
29 values
ACHIEVEMENT_UNLOCKEDADD_PAYMENT_INFOADD_TO_CARTADD_TO_WISHLISTAD_IMPRESSIONCOMPLETE_REGISTRATIONCONTACTCONTENT_VIEWCUSTOMIZE_PRODUCTD2_RETENTIOND7_RETENTIONDONATEFIND_LOCATIONINITIATED_CHECKOUTLEADLEVEL_ACHIEVEDLISTING_INTERACTIONMESSAGING_CONVERSATION_STARTED_7DOTHERPURCHASERATESCHEDULESEARCHSERVICE_BOOKING_REQUESTSPENT_CREDITSSTART_TRIALSUBMIT_APPLICATIONSUBSCRIBETUTORIAL_COMPLETIONID of the app for app promotion.
Audience. geo_locations is required (100/1487079).
Show child attributes
Locations to target. Required.
Show child attributes
ISO-2 country codes.
Regions as {key}.
Cities as {key, radius, distance_unit}; radius 10–50 mi or 17–80 km.
Points with a radius: {latitude, longitude, radius, distance_unit} or {address_string, radius}; radius 1–80 km or 0.63–50 mi; up to 200 items.
Show child attributes
Latitude of the point.
Longitude of the point.
Radius around the point.
kilometer or mile (default).
Address, instead of coordinates.
home and/or recent.
Minimum age, 13 or more (default 18). With Advantage+ audience only 18 to 25.
Maximum age, up to 65.
[1] men, [2] women. Omit for all.
Advantage+ audience settings.
Show child attributes
1 lets Meta expand the audience (Advantage+ audience), 0 keeps it. Must be set explicitly on create when the audience is constrained.
Per-dimension automation settings (age, gender, device).
Platforms: facebook, instagram, messenger, audience_network.
Facebook placements.
Instagram placements.
Messenger placements. story is dropped since v26.0.
mobile and/or desktop.
connected_tvdesktopmobileDetailed targeting. In Mimicr it is stored, not resolved.
Excluded detailed targeting. Stored, not resolved.
Custom audiences. Custom audiences are not simulated (501).
Interests. Stored, not resolved.
["standard"] or ["day_parting"] with adset_schedule.
Day parting; lifetime budget only (100/1487201).
Show child attributes
Start minute of the day (0–1439), on the hour.
End minute of the day; 1440 is the end of the day.
Days of the week, 0 (Sunday) to 6.
USER or ADVERTISER.
Stored.
Stored.
Refused since v27.0 (version error).
["validate_only"] runs every validation and returns {"success":true} without writing.
validate_onlyResponses
200OK.
ID of the new object.
400Error in the Graph envelope: 100 with subcodes 1885272 (budget too low), 1487171 (lifetime budget without end_time), 1487172 (daily budget for ≤ 24 h), 1885621/1487169 (both or neither budget), 1487201 (schedule), 2490408 (goal not available), 2446880 (Page without WhatsApp), 2446509 (destination), 1487079 (no location), 1870227 (Advantage+ audience flag required).
Show child attributes
Description of the error.
"(#100) The parameter special_ad_categories is required"OAuthException for most codes (the Marketing API uses it for validation too), GraphMethodException for unknown objects, FacebookApiException for transient errors. In Mimicr, routes outside the integration core answer MimicrNotSimulated with HTTP 501.
"OAuthException"Error code (100 invalid parameter, 190 invalid token, 200 permission, 2635 deprecated version, 613/17/80004 rate limits, …).
100Error subcode with more detail (1885272 budget too low, 463 token expired, …).
1885272Whether retrying the same request may succeed. Present on every Marketing API error; true for codes 1 and 2.
Title of the error, to show to people.
Message of the error, to show to people.
Extra data. blame_field_specs lists the params that caused a validation error.
Show child attributes
Internal support identifier of the request.
"AbCdEf12345"