OverviewProductsPlatformsAPI ReferenceResources

Create ads

Create a Microsoft Ads search campaign with its ad group, responsive search ad and keywords in one call.


POST /v1/ads/create creates the search campaign, its ad group, a responsive search ad and its keywords in one call.

Create a campaign

Send status: "PAUSED" to create it paused. Without status, every level is switched on and the campaign starts spending once Microsoft approves the ad.

TypeScript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: created } = await zernio.adcampaigns.createStandaloneAd({
  body: {
    accountId: '66b2e19d8c3f5a7e9d0b1c2d',
    adAccountId: '189372438',
    name: 'Planner launch',
    goal: 'traffic',
    status: 'PAUSED',
    budgetAmount: 5,
    budgetType: 'daily',
    headline: 'Plan Your Week in Minutes',
    body: 'Tasks, docs and meetings in one place. Free for teams of 5.',
    additionalHeadlines: ['Free for Teams of 5', 'One Planner for Everything'],
    linkUrl: 'https://example.com/planner',
    countries: ['US', 'CA'],
    keywords: ['team planner', { text: 'weekly planner app', matchType: 'PHRASE' }]
  }
});

console.log(created.ad.id);

Response (201), trimmed:

JSON
{
  "ad": {
    "id": "6ae0968fa23091cc35b72121",
    "name": "Planner launch",
    "platform": "microsoft",
    "status": "paused",
    "adType": "standalone",
    "goal": "traffic",
    "budget": { "amount": 5, "type": "daily" },
    "platformAdId": "74217415020506",
    "platformCampaignId": "571866721",
    "platformAdSetId": "1187474990051502",
    "platformAdAccountId": "189372438"
  }
}

budgetAmount is in whole units of the ad account's currency. platformAdSetId is the Microsoft ad group, and the ad name stays the name you sent: Microsoft has no ad name of its own.

Campaign and ad group names default to <name> - Campaign and <name> - Ad Group; send campaignName and adSetName to set them.

Every sample on the Microsoft Ads pages reuses the zernio and client constructors from this one. The accountId is the microsoftads account from Connect.

Ad copy

FieldRule
headlineRequired, the first headline, up to 30 characters
additionalHeadlinesUp to 14 more, each up to 30 characters
bodyRequired, the first description, up to 90 characters
additionalDescriptionsUp to 3 more, each up to 90 characters
linkUrlRequired, the landing page

Microsoft needs at least 3 headlines and 2 descriptions. When you send fewer, Zernio fills the rest from the ad name and the landing page's host name.

How it behaves

  • countries (or targeting.countries) is required, so a campaign never serves everywhere.
  • Each keyword is a string (match type BROAD) or { text, matchType } with EXACT, PHRASE or BROAD.
  • startDate and endDate set the ad group's schedule.
  • If a step after the campaign fails, Zernio deletes the campaign it created, so a failed create leaves nothing behind.
  • Microsoft reviews every new ad: it serves only once its editorial review passes, and a rejected ad reads rejected.

If it fails

ErrorCauseFix
422 with param: "targeting.countries"No countries sentSend countries.
422 with param: "budget.type"A lifetime budgetSend budgetType: "daily".
422 with param: "bidStrategy"A bid field sentLeave bid fields out: campaigns use Maximize Clicks.
422 with param: "campaignType"A campaign type other than searchOmit campaignType.
422 on headline, body or linkUrlA required ad field is missing or the URL does not parseSend all three.
400 on additionalHeadlines or additionalDescriptionsA text over its character limit, or too manyShorten it, or send fewer.
Was this page helpful?

On this page