Documentation

Ads management

Cross-platform ad campaigns, creatives, audiences, performance metrics, and automation rules.

The ads module is a meta-layer over the ad platforms — Facebook, Google, TikTok, LinkedIn, Pinterest, Snapchat. You author a campaign once, target one or more channels, and the module pushes the right shape to each platform's API. Performance metrics flow back through the sync jobs and roll up into a unified view.

Campaign CRUD

POST/crm/ads/campaignsJWT
GET/crm/ads/campaignsJWT
GET/crm/ads/campaigns/:campaignIdJWT
PUT/crm/ads/campaigns/:campaignIdJWT
DELETE/crm/ads/campaigns/:campaignIdJWT
{
  "name": "Black Friday 2026",
  "objective": "conversions",
  "platforms": ["facebook", "google", "tiktok"],
  "budget": { "type": "daily", "amount": 250, "currency": "USD" },
  "audienceIds": ["aud-vip", "aud-cart-abandoned"],
  "creativeIds": ["cre-bf-video-1", "cre-bf-static-1"],
  "schedule": { "startAt": "2026-11-24T00:00:00Z", "endAt": "2026-11-30T23:59:59Z" }
}

Lifecycle controls

POST/crm/ads/campaigns/launch/:campaignIdJWT
POST/crm/ads/campaigns/pause/:campaignIdJWT
POST/crm/ads/campaigns/resume/:campaignIdJWT
POST/crm/ads/campaigns/schedule/:campaignIdJWT
POST/crm/ads/campaigns/duplicate/:campaignIdJWT

Launch pushes the campaign to every platform listed in platforms. Pause/resume cascades to all of them. Duplicate copies the spec — useful for A/B tests where you change one variable.

Bulk variants exist for batch operations:

POST/crm/ads/campaigns/bulk/launchJWT
POST/crm/ads/campaigns/bulk/pauseJWT

Creatives

POST/crm/ads/creativesJWT
GET/crm/ads/creativesJWT

A creative bundles the asset (image, video, carousel) plus headline, description, and call-to-action. The same creative can be referenced by multiple campaigns; the platform handles per-channel resizing and format conversion at launch.

Custom audiences

POST/crm/ads/audiencesJWT
GET/crm/ads/audiencesJWT

Ad audiences are distinct from CRM audiences (see Audiences and segmentation). An ad audience is what the ad platform sees — a list synced via customer-match upload, a pixel-based retargeting rule, or a lookalike. You can seed one from a CRM audience via the sourceAudienceId field.

Connected accounts

GET/crm/ads/accountsJWT
POST/crm/ads/accounts/syncJWT

Lists ad accounts the org has connected. sync pulls latest account metadata (name, currency, timezone, business manager) from each platform. Connect new accounts via the OAuth flow.

Performance

GET/crm/ads/campaigns/metrics/:campaignIdJWT
GET/crm/ads/analytics/overviewJWT
GET/crm/ads/analytics/performanceJWT
GET/crm/ads/analytics/comparisonJWT
GET/crm/ads/analytics/trendsJWT

Metrics include impressions, clicks, CTR, CPC, spend, conversions, ROAS, and per-platform breakdowns. Data freshness depends on each ad platform's reporting API — Facebook and Google update hourly, TikTok every few hours, LinkedIn daily.

Automation rules

POST/crm/ads/automation/rulesJWT
GET/crm/ads/automation/rulesJWT

Define conditional rules: "pause any ad set with CPC > $5 over the last 24 hours", "increase budget 20% if ROAS > 4 for 3 days". Rules run on a sync cycle and use the Rule Engine for evaluation.

Templates and reports

POST/crm/ads/templatesJWT
GET/crm/ads/templatesJWT
POST/crm/ads/campaigns/from-template/:templateIdJWT
POST/crm/ads/reports/generateJWT

Templates capture a reusable campaign skeleton. Reports can be scheduled and exported to CSV or PDF.

Each platform has its own ad-policy rules. A campaign that launches successfully on Facebook may be rejected on TikTok. The module surfaces per-platform launch errors in the campaign's platformStatus map; check it after every launch.