Skip to content
AdCrunch
Esc
↑↓navigate↵open⌘Jpreview
On this page

meta_create_campaign

Create a Meta campaign from a conversation. It always arrives paused.

Ask for a new campaign on a Meta advertiser, with its objective and its budget. AdCrunch creates it paused, so it spends nothing until you activate it. When each ad set has its own budget, ask for a campaign with no budget.

Create a sales campaign called Spring Prospecting on Northwind, with a daily budget of 50 euros.

The agent calls meta_create_campaign, then get_mutation_status, and you see the id of the new paused campaign.

When the agent builds a Line Item of a Campaign Plan, it names the Line Item and its Campaign Plan in the call. AdCrunch then records the campaign against the Line Item when Meta creates it, so the Line Item page shows it with no second call. get_mutation_status says execution: recorded. When it says not_recorded, for example because someone deleted the Line Item meanwhile, the agent records the campaign with line_item_record_execution. A Line Item must belong to your organization, and its ad account must be the advertiser of the campaign. The call then also needs the campaign_plan:write scope. Change what runs on Meta walks the whole campaign, from the Page to the activation.

Reference

Available on: Meta

Create a campaign on a live Meta ad account. It is always created PAUSED and cannot be created active — nothing spends until you separately activate it with meta_update_status. Set at most one campaign budget: dailyBudget or lifetimeBudget. A campaign budget turns on Advantage campaign budget (CBO), and the ad sets of the campaign share it. When each ad set carries its own budget, for example one ad set for each Line Item, omit both budgets. Then adsetBudgetSharing lets the ad sets share part of their daily budgets, and it needs a bidStrategy. A campaign holds only the bid strategy: give the amount of a bid cap, a cost cap or a ROAS goal on each ad set with meta_create_adset. Runs asynchronously: returns a mutationId immediately — call get_mutation_status with it to get the new campaign’s id. Budgets are in whole units of the ad account currency: 10.5 is 10.50, never 1050. When you build from a Line Item, send line_item_id and campaign_plan_name: AdCrunch records the campaign against the Line Item when Meta creates it, and get_mutation_status says execution: recorded. Call line_item_record_execution only after execution: not_recorded. A Line Item needs the campaign_plan:write scope.

Input

Argument Type Required Description
adsetBudgetSharing boolean no Let the ad sets share their budgets. Only when both campaign budgets are omitted; false when omitted. Each ad set can then share up to 20 % of its daily budget with the other ad sets of the campaign. Sharing works with daily budgets only. It needs a bidStrategy, and it locks that bid strategy for the life of the campaign. Sharing cannot be turned on later.
advertiserId string yes Advertiser account ID (acc_<id>). Must belong to the active organization — find one with list_advertisers.
bidStrategy one of LOWEST_COST_WITHOUT_CAP, LOWEST_COST_WITH_BID_CAP, COST_CAP, LOWEST_COST_WITH_MIN_ROAS no How Meta bids. LOWEST_COST_WITHOUT_CAP (“Highest volume” in Ads Manager) gets the most results for the budget and takes no amount. LOWEST_COST_WITH_BID_CAP (“Bid cap”) takes bidCap. COST_CAP (“Cost per result goal”) takes costCap. LOWEST_COST_WITH_MIN_ROAS (“ROAS goal”) takes roasFloor, and needs the optimization goal VALUE. Give exactly the amount that the strategy takes, and no other amount. A higher bid cap, a higher cost cap or a lower ROAS floor can make an ad set spend its full budget, never more. On a campaign, give only the strategy. It applies when the campaign carries a budget, or when adsetBudgetSharing is true, which requires it. Give the amount of a bid cap, a cost cap or a ROAS goal on each ad set, with the same bidStrategy. Omit it to let Meta apply its default strategy.
campaign_plan_name string no The Campaign Plan slug of line_item_id. Send the two together, or neither.
dailyBudget number, more than 0 no Campaign-level daily budget in whole units of the ad account currency (10.5 is 10.50). Setting either budget turns on Advantage campaign budget. Set at most one of this or lifetimeBudget. When each ad set carries its own budget, omit both.
lifetimeBudget number, more than 0 no Campaign-level lifetime budget in whole units of the ad account currency (10.5 is 10.50). Set at most one of this or dailyBudget. When each ad set carries its own budget, omit both.
line_item_id string no The Line Item that the campaign builds, as line_item_list gives it. AdCrunch then records the campaign against it when Meta creates it. Send it with campaign_plan_name. It needs the campaign_plan:write scope. The Line Item must belong to your organization, and its ad account, when it names one, must be advertiserId.
name string, at least 1 character yes Campaign name, as it will appear in Ads Manager. Use something the user would recognize.
objective one of OUTCOME_AWARENESS, OUTCOME_ENGAGEMENT, OUTCOME_LEADS, OUTCOME_SALES, OUTCOME_TRAFFIC, OUTCOME_APP_PROMOTION yes What the campaign optimizes toward. This constrains which optimization goals its ad sets may use, so pick it from what the user actually wants (e.g. OUTCOME_SALES for purchases, OUTCOME_TRAFFIC for site visits).
specialAdCategories array of (one of NONE, EMPLOYMENT, HOUSING, CREDIT, ISSUES_ELECTIONS_POLITICS, ONLINE_GAMBLING_AND_GAMING, FINANCIAL_PRODUCTS_SERVICES) no Regulated categories this campaign falls under, which Meta requires you to declare — employment, housing, credit, politics, gambling, or financial products. Declaring one restricts targeting. Omit (or pass ["NONE"]) when none applies; do not guess, ask the user. Default: [].

Output

A successful call returns this object in structuredContent.

Field Type Always present Description
consoleUrl string yes The page of this change in the AdCrunch console. When get_mutation_status reports awaiting_confirmation, give this URL to the user: a person must confirm the change there before it reaches Meta. You cannot confirm it.
mutationId string yes The id of the change. The change has not reached Meta yet. Give this id to get_mutation_status to find out how the change ended.

Failure codes

A failed call has isError set, and structuredContent.error holds one of these codes. Errors describes the shape of a failed call.

  • not_found
  • provider_not_connected
  • missing_write_access
  • policy_violation
  • policy_unavailable
  • organization_unentitled
  • forbidden
  • invalid_request
  • internal_error

Scope

The token must hold mutation:write. Auth & scopes lists each scope.

Annotations

A client reads these hints. A hint that the tool does not declare has the default value of the MCP specification.

  • Writes. The tool can change data.
  • Destructive. The tool can make a change that you cannot undo. A client can ask you to confirm before it calls the tool.
  • Not idempotent. A second call with the same arguments can change more.
  • Open world. The tool reaches a system outside AdCrunch, such as an ad platform.

Example

The arguments:

{
  "advertiserId": "acc_1485443900032333",
  "dailyBudget": 50,
  "name": "Spring Prospecting",
  "objective": "OUTCOME_SALES"
}

The result, in structuredContent:

{
  "consoleUrl": "https://console.adcrunch.dev/activity/mut_k3x9q2v7m4n8p1r5t6w0y2z4",
  "mutationId": "mut_k3x9q2v7m4n8p1r5t6w0y2z4"
}

Was this page helpful?