Zernio
APIFor you
Zernio
APIFor you
Platforms

LinkedIn Ads

Overview

Build

Create adsBoost a postLead Gen FormsCreative formats

Target

TargetingMatched AudiencesBid pricing & forecasts

Measure

AnalyticsConversions APIInsight TagURL tracking tags

Operate

Manage adsAd Library

Reference

Media & limits
Dashboard
OverviewPlatformsAPI ReferenceResources
LinkedIn Ads

Create ads

Create a single image or video LinkedIn ad in one call, set its bidding, and slot it into a campaign or campaign group you already have.


By the end of this page, a LinkedIn single image or video ad exists from one POST /v1/ads/create call, with the bid you pick.

Before you start

You need a linkedinads account, a numeric ad account id and a Company Page.

Create a campaign

Call POST /v1/ads/create with accountId, adAccountId, organizationId and the creative fields.

No existing post is needed. Zernio creates a Direct Sponsored Content post authored by your Company Page, then wraps it in a Campaign Group, a Campaign and a Creative. The post never appears on the Page's feed.

TypeScript
import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: created } = await zernio.adcampaigns.createStandaloneAd({
  body: {
    accountId: '66b2e19d8c3f5a7e9d0b1c2d',
    adAccountId: '517258773',
    organizationId: '107655573',
    name: 'Spring launch (single image)',
    goal: 'traffic',
    budgetAmount: 50,
    budgetType: 'daily',
    headline: 'Schedule social posts in one API call',
    body: 'The social media API built for developers.',
    imageUrl: 'https://cdn.example.com/launch-1200x627.jpg',
    linkUrl: 'https://zernio.com',
    callToAction: 'LEARN_MORE',
    countries: ['US']
  }
});

console.log(created.ad._id);

Response (201):

JSON
{
  "ad": {
    "_id": "66f0a1b2c3d4e5f6a7b8c9d0",
    "name": "Spring launch (single image)",
    "platform": "linkedin",
    "status": "pending_review",
    "adType": "standalone",
    "goal": "traffic",
    "budget": { "amount": 50, "type": "daily" },
    "platformAdId": "376524873",
    "platformCampaignId": "645412093",
    "platformAdSetId": "810456563"
  },
  "message": "Ad created"
}

platformCampaignId is the LinkedIn Campaign Group and platformAdSetId the LinkedIn Campaign.

_id is what the Insights and tracking tag endpoints take as adId.

organizationId names the Company Page that authors the post, as a numeric organization id or a full urn:li:organization:N URN.

It is optional when the Page itself is connected as a Zernio account or the ad account is owned by an organization. Zernio infers it then.

Page role. The authenticated member must be an Administrator or Direct Sponsored Content Poster of that Page. The Page must also be associated with the ad account, or LinkedIn returns 403.

Field rules:

  • headline is required. Supply exactly one of imageUrl or video.
  • body becomes the post's intro text. longHeadline (optional) becomes the secondary description line on image link ads.
  • goal: "traffic" requires linkUrl.
  • callToAction accepts LEARN_MORE, SIGN_UP, DOWNLOAD, SUBSCRIBE, REGISTER, JOIN, ATTEND, REQUEST_DEMO, VIEW_QUOTE, APPLY, SEE_MORE, SHOP_NOW, BUY_NOW, and defaults to LEARN_MORE when linkUrl is set.
  • The recommended image ratio is 1.91:1 (1200 x 627), JPEG, PNG or GIF.
  • status: "PAUSED" pauses only the top-most object the call creates, so you can review it before it spends (table below).
What the call createsWith status: "PAUSED"
A new Campaign GroupThe group is paused; its Campaign and Creative are active
A new Campaign in an existing group (existingCampaignId)The Campaign stays in draft; its Creative is active
A Creative added to an existing Campaign (adSetId)The Creative is paused itself

Resuming that one object brings the new ad live.

With status omitted, Zernio activates the Campaign Group and Campaign. The ad goes live the moment LinkedIn approves it.

The same imageUrl plus linkUrl shape also publishes LinkedIn's article and newsletter link ad. See Creative formats.

Video ads

Swap imageUrl for video: { url }. The two are mutually exclusive.

Zernio uploads the clip to LinkedIn under the Company Page. The campaign format becomes SINGLE_VIDEO, and the video_views goal becomes available (it requires a video).

LinkedIn generates the poster frame, so no thumbnail is needed.

The request blocks while LinkedIn transcodes the video. Short clips take 10 to 30 seconds.

The file must be MP4 H.264/AAC, 3 seconds to 30 minutes, 75 KB to 500 MB.

JSON
{
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "adAccountId": "517258773",
  "organizationId": "107655573",
  "name": "Spring launch (video)",
  "goal": "video_views",
  "budgetAmount": 50,
  "budgetType": "daily",
  "headline": "See it in action",
  "body": "The social media API built for developers.",
  "video": { "url": "https://cdn.example.com/launch.mp4" },
  "linkUrl": "https://zernio.com",
  "callToAction": "LEARN_MORE",
  "countries": ["US"]
}

Every other format is a key inside platformSpecificData: carousel, document, event, text ad, spotlight, follower, jobs, conversation, thought-leader. See Creative formats.

countries is the minimum targeting LinkedIn accepts. The B2B facets (industry, company size, seniority, job function) are on Targeting.

Bidding

Bidding fields go in platformSpecificData, on both POST /v1/ads/create and POST /v1/ads/boost:

JSON
{
  "platformSpecificData": {
    "costType": "CPC",
    "unitCost": 2.5,
    "optimizationTargetType": "MAX_CLICK",
    "creativeSelection": "OPTIMIZED",
    "audienceExpansionEnabled": true,
    "offsiteDeliveryEnabled": false,
    "connectedTelevisionOnly": false
  }
}
FieldNotes
costTypeCPM (default), CPC, CPV. Required when unitCost is set.
unitCostManual bid in whole account-currency units. Omit for LinkedIn automated bidding.
optimizationTargetTypeForwarded verbatim (MAX_CLICK, TARGET_COST_PER_CLICK, ...).
creativeSelectionOPTIMIZED (default) or ROUND_ROBIN.
audienceExpansionEnabled, offsiteDeliveryEnabled, connectedTelevisionOnlyCampaign delivery toggles, forwarded verbatim.

Unknown keys inside platformSpecificData return a 400. So do these LinkedIn-only keys on another platform's account.

To pick a bid inside LinkedIn's allowed range before creating anything, call Bid pricing.

Reuse an existing campaign or group

By default each create mints a fresh Campaign Group, Campaign and Creative.

Two optional, mutually exclusive fields slot into a hierarchy you already have. Passing both returns a 400.

adSetId takes the numeric LinkedIn Campaign id. It creates only a new Creative under it, skipping both provisioning steps.

Bidding, targeting, schedule and budget are inherited from the Campaign. Sending those fields (including budgetType and budgetAmount) returns a 400:

JSON
{
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "adAccountId": "517258773",
  "goal": "engagement",
  "platformSpecificData": { "thoughtLeader": { "postUrn": "urn:li:ugcPost:7482739454772752385" } },
  "adSetId": "810456563"
}

existingCampaignId takes a LinkedIn Campaign Group id and skips only the group provisioning. A new Campaign is created under that group, with bidding, targeting and schedule yours to set.

If the create fails, only the entities Zernio authored are cleaned up. The pre-existing parent is never touched.

JSON
{
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "adAccountId": "517258773",
  "goal": "engagement",
  "headline": "Schedule social posts in one API call",
  "body": "The social media API built for developers.",
  "imageUrl": "https://cdn.example.com/launch-1200x627.jpg",
  "linkUrl": "https://zernio.com",
  "budgetType": "daily",
  "budgetAmount": 20,
  "existingCampaignId": "1173166923"
}

Budget minimums

LinkedIn enforces a $10/day minimum for any ad format and a $100 minimum lifetime budget for inactive campaigns.

Bid pricing returns the account-and-targeting-specific bounds. Its dailyBudgetLimits.min is the authoritative number.

If it fails

ErrorCauseFix
403 platform_api_errorThe member lacks the Direct Sponsored Content Poster or Administrator role on the Page, or the Page is not associated with the ad accountFix the Page role or the association in LinkedIn, then repeat the call
400 with both adSetId and existingCampaignIdThe two reuse fields are mutually exclusiveSend one of them
400 with adSetId and a budget, endDate, rawTargeting, costType or unitCostThe new Creative inherits those from the CampaignLeave them out. Nested targeting, startDate and optimizationTargetType are ignored.
400 on platformSpecificDataAn unknown key, or a LinkedIn-only key on another platform's accountSend only the bidding keys in the table above

LinkedIn's REST error is forwarded verbatim inside Zernio's platform_error envelope:

JSON
{
  "error": "LinkedIn rejected the request",
  "type": "platform_error",
  "code": "platform_api_error",
  "platform": "linkedin",
  "platformError": { "status": 403, "message": "Not enough permissions to access: ..." }
}

Error handling covers the envelope.

Related

  • Creative formats: every other creative shape.
  • Boost a post: promote an existing Company Page post instead.
  • Targeting: the B2B facets and how to look up their ids.
  • Pause or resume: status, budget, duplicate and delete once the ad runs.
  • Create standalone ad: every field of the request.
Was this page helpful?

LinkedIn Ads

Create, boost, target and measure LinkedIn campaigns on a linkedinads account with the ads endpoints.

Boost a post

Promote an existing LinkedIn Company Page post as an ad with POST /v1/ads/boost, keeping its reactions and comments, on any of the 6 goals boost accepts.

On this page

Before you startCreate a campaignVideo adsBiddingReuse an existing campaign or groupBudget minimumsIf it failsRelated