Guides
Create a campaign
The campaign → ad set → creative → ad sequence, with budget, optimization goal, destination and the validation errors of each step.
A campaign in the Marketing API is four objects created in order in the ad account:
- The campaign sets the objective (
OUTCOME_*) and, optionally, the budget. - The ad set sets the budget, schedule, optimization goal, billing event, destination and audience.
- The creative is the Page post the ad shows.
- The ad links an ad set to a creative and goes through review.
Writes accept form data (-F), urlencoded or JSON; objects and lists can go as JSON strings. The response to a create is {"id":"…"}. Every write requires ads_management and a role on the account.
1. Campaign
curl -s "https://meta-ads.mimicr.dev/v27.0/act_100539998049706/campaigns" \ -H 'Authorization: Bearer <token>' \ -F name='Gás em casa' -F objective=OUTCOME_ENGAGEMENT -F status=PAUSED \ -F special_ad_categories='[]' -F is_adset_budget_sharing_enabled=false
{ "id": "120200539998049712" }objectiveis one ofOUTCOME_APP_PROMOTION,OUTCOME_AWARENESS,OUTCOME_ENGAGEMENT,OUTCOME_LEADS,OUTCOME_SALESandOUTCOME_TRAFFIC. Legacy objectives (MESSAGES,LINK_CLICKS,CONVERSIONS) answer100.special_ad_categoriesis required;[]when there's no special category.- Without a campaign budget,
is_adset_budget_sharing_enabledhas been required since v24.0. Without it:100/4834011"Must specify True or False in is_adset_budget_sharing_enabled field if you are not using campaign budget". - With a campaign budget (
daily_budgetorlifetime_budget), ad sets can't have their own budget (1885621).
2. Ad set
curl -s "https://meta-ads.mimicr.dev/v27.0/act_100539998049706/adsets" \
-H 'Authorization: Bearer <token>' \
-F name='Gás em casa' -F campaign_id=120200539998049712 -F status=PAUSED \
-F billing_event=IMPRESSIONS -F optimization_goal=CONVERSATIONS \
-F bid_strategy=LOWEST_COST_WITHOUT_CAP -F daily_budget=2000 \
-F destination_type=WHATSAPP \
-F promoted_object='{"page_id":"100539998049709","whatsapp_phone_number":"551336985333"}' \
-F start_time=2026-11-07T08:00:00-0300 -F end_time=2026-11-17T08:00:00-0300 \
-F targeting='{"geo_locations":{"custom_locations":[{"latitude":-23.55,"longitude":-46.63,"radius":5,"distance_unit":"kilometer"}]},"age_min":18,"targeting_automation":{"advantage_audience":0}}'| Parameter | Rule |
|---|---|
daily_budget / lifetime_budget | Cents; exactly one, unless the campaign has a budget. Lifetime requires end_time (1487171). Daily only for ad sets longer than 24 h (1487172) |
optimization_goal | Must match the objective (table below), otherwise 2490408 |
billing_event | IMPRESSIONS for click-to-WhatsApp |
bid_amount | Required with LOWEST_COST_WITH_BID_CAP and COST_CAP |
destination_type | WHATSAPP requires promoted_object.page_id of a Page with WhatsApp (2446880) |
promoted_object | {page_id, whatsapp_phone_number} for WhatsApp, {page_id} for leads, {pixel_id, custom_event_type} for conversions |
targeting | See Targeting; geo_locations is required |
pacing_type + adset_schedule | Hour schedule, only with a lifetime budget (1487201) |
start_time | Default: now |
Goals accepted per objective in Mimicr (without optimization_goal, Mimicr uses the objective's default goal: REACH, LINK_CLICKS, POST_ENGAGEMENT, LEAD_GENERATION, OFFSITE_CONVERSIONS or APP_INSTALLS):
| Objective | optimization_goal |
|---|---|
OUTCOME_ENGAGEMENT | CONVERSATIONS, LINK_CLICKS, POST_ENGAGEMENT, THRUPLAY, IMPRESSIONS, REACH, PAGE_LIKES |
OUTCOME_TRAFFIC | CONVERSATIONS, LANDING_PAGE_VIEWS, LINK_CLICKS, IMPRESSIONS, REACH, POST_ENGAGEMENT |
OUTCOME_SALES | CONVERSATIONS, OFFSITE_CONVERSIONS, LINK_CLICKS, IMPRESSIONS, REACH, VALUE, LANDING_PAGE_VIEWS |
OUTCOME_LEADS | LEAD_GENERATION, QUALITY_LEAD, CONVERSATIONS, LINK_CLICKS, OFFSITE_CONVERSIONS |
OUTCOME_AWARENESS | REACH, IMPRESSIONS, AD_RECALL_LIFT, THRUPLAY |
OUTCOME_APP_PROMOTION | APP_INSTALLS, APP_INSTALLS_AND_OFFSITE_CONVERSIONS, LINK_CLICKS, VALUE |
The minimum daily budget depends on the goal. In Mimicr: R$1.00 for impressions and reach, R$2.50 for clicks and R$5.00 for conversations and leads. Below that, 100/1885272 with the message in Portuguese for pt_BR users:
{
"error": {
"message": "(#100) Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": 1885272,
"is_transient": false,
"error_user_title": "Your Budget Is Too Low",
"error_user_msg": "O orçamento diário mínimo deste conjunto é R$ 5,00.",
"error_data": { "blame_field_specs": [["daily_budget"]] },
"fbtrace_id": "uu_3OO2gIWY"
}
}3. Creative
For video, upload the file first and wait for it to be ready:
curl -s "https://meta-ads.mimicr.dev/v27.0/act_100539998049706/advideos" \
-H 'Authorization: Bearer <token>' -F file_url=https://cdn.example.com/gas.mp4 -F name='Vídeo gás'
# {"id":"100539998049715"}
curl -s "https://meta-ads.mimicr.dev/v27.0/100539998049715?fields=status,picture" -H 'Authorization: Bearer <token>'status.video_status goes from processing to ready in 6 sandbox seconds. Creating a creative with a video that isn't ready yet answers 100/1885252.
Image creative with click-to-WhatsApp:
curl -s "https://meta-ads.mimicr.dev/v27.0/act_100539998049706/adcreatives" \
-H 'Authorization: Bearer <token>' \
-F name=Botijão \
-F object_story_spec='{"page_id":"100539998049709","link_data":{"message":"Botijão em 30 min","name":"Peça pelo WhatsApp","picture":"https://cdn.example.com/botijao.jpg","link":"https://api.whatsapp.com/send","call_to_action":{"type":"WHATSAPP_MESSAGE","value":{"app_destination":"WHATSAPP"}}}}'For a website, use link with the URL and call_to_action {"type":"ORDER_NOW","value":{"link":"https://loja.example.com"}}. For leads, see Lead ads and webhook. An unknown call_to_action.type answers 100/1373054. Creatives don't change after they're created, except name and status.
4. Ad
curl -s "https://meta-ads.mimicr.dev/v27.0/act_100539998049706/ads" \
-H 'Authorization: Bearer <token>' \
-F name=Botijão -F adset_id=120200539998049713 \
-F creative='{"creative_id":"120200539998049717"}' -F status=PAUSEDThe ad goes into review even when paused. See Ads and review. To go live, activate the ad, the ad set and the campaign (POST /{id} with status=ACTIVE).
Validate without creating
execution_options=["validate_only"] on campaigns, ad sets, creatives and ads runs every validation and answers {"success":true} without saving anything.
If something fails midway
Creates aren't idempotent in the Graph API: repeating a POST creates another object. If the ad set fails after the campaign was created, remove the campaign (POST /{campaign_id} with status=DELETED) and start over. A 500 with is_transient: true on a POST may or may not have created the object; list before retrying.
Reference: Create campaign, Create ad set, Create creative, Upload video and Create ad.