Ads API Reference
The Ads API runs and reads paid ads through one cross-network contract: boost a post you already published, create ads from your own creative, manage campaigns and ad sets, and pull performance reports.
Supported networks: Meta (Facebook and Instagram), Google Ads (Search, Performance Max and Display), Pinterest (promoted Pins) and TikTok (Spark Ads, video ads and image carousels). LinkedIn Ads is coming soon.
Network support
Section titled “Network support”| Capability | Meta | Google Ads | TikTok | |
|---|---|---|---|---|
| Boost a published post | Facebook, Instagram | No | Pins | Spark Ads |
| Create an ad from your own creative | Image, video, carousel | Search, Performance Max, Display | Image, video, carousel | Video, image carousel |
| Campaigns and ad sets | Yes | Yes | Yes | Yes |
| Pause / resume | Yes | Yes | Yes | Yes |
| Archive | Yes | No | Yes | No |
| Delete | Yes | Yes | Archives instead | Yes |
validate_only | Yes | Yes | No | No |
| Analytics and insights | Yes | Yes | Yes | Yes |
| Breakdowns | 8 dimensions | None | 8 dimensions, last 90 days | 6 dimensions |
| Review status | Yes | Yes | Yes | Yes |
| Preview | Yes | No | Yes | No |
| Targeting search | Yes | Yes | Yes | Yes |
| Browse targeting, DSA recommendations | Yes | No | No | No |
| Keywords and negative keywords | No | Yes | Yes | No |
| Search terms, Keyword Planner | No | Yes | No | No |
| Campaign targeting, ad schedule | No | Yes | No | No |
| Identities | No | No | No | Yes |
An operation or field a network has no equivalent for returns 501 Not Implemented.
Each network uses its own names for the three levels. The API always says campaign, ad set and ad:
| API | Meta | Google Ads | TikTok | |
|---|---|---|---|---|
| Campaign | Campaign | Campaign | Campaign | Campaign |
| Ad set | Ad set | Ad group (Performance Max: asset group) | Ad group | Ad group |
| Ad | Ad | Ad group ad | Promoted Pin | Ad |
Ads profiles
Section titled “Ads profiles”An ads connection is its own profile, separate from the profiles you publish with. Its platform is meta_ads, google_ads, pinterest_ads or tiktok_ads, and it holds the ads permissions and the ad accounts the login can reach.
Connect one from the Profiles page in the dashboard, or generate a connection link with Initialize connection using one of the ads platforms. Ads profiles cannot be posted to.
Stored and live data
Section titled “Stored and live data”- Stored: ad accounts, campaigns, ad sets, ads and their latest metrics are synced in the background and served from Postproxy. Ads created outside Postproxy are imported too, with
source: "platform". - Live: every write,
live=truereads, ad account health, analytics, insights, review, preview and targeting lookups go to the network. A repeat of the same live read within a few seconds returns the previous answer with"cached": true.
Every id, ad_account_id, campaign_id and ad_set_id in responses, paths, parameters and filters is a Postproxy ID. The network’s own IDs are returned next to them as platform_id, platform_ad_account_id, platform_campaign_id and platform_ad_set_id, and are not accepted as input.
campaign_id or ad_set_id is null when the parent has not been imported (objects that are not live and have not changed in 90 days are left out); the platform_ value is still there. An ad account ID names one ad account of one ads profile, so profile_id is never needed next to ad_account_id.
Pagination
Section titled “Pagination”Stored lists paginate with page (1-based) and per_page (default 25, max 100) and return { total, page, per_page, data }. Lists read live from the network (keywords, search terms, targeting lookups, identities) return { data, next_page_token, cached }.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
GET | /api/ads/ad_accounts | List ad accounts |
GET | /api/ads/ad_accounts/:ad_account_id | Get an ad account |
GET | /api/ads/ad_accounts/:ad_account_id/health | Check ad account health |
GET | /api/ads/ad_accounts/:ad_account_id/identities | List TikTok identities |
POST | /api/ads/boost_post | Boost a published post |
POST | /api/ads | Create an ad |
POST | /api/ads/campaigns | Create a campaign |
POST | /api/ads/ad_sets | Create an ad set |
GET | /api/ads, /api/ads/campaigns, /api/ads/ad_sets | List ads, campaigns, ad sets |
GET | /api/ads/:id, /api/ads/campaigns/:id, /api/ads/ad_sets/:id | Get one |
GET | /api/ads/tree | Campaigns with ad sets and ads nested |
PATCH | /api/ads/:id, /api/ads/campaigns/:id, /api/ads/ad_sets/:id | Update |
POST | …/:id/pause, …/:id/resume, …/:id/archive | Pause, resume, archive |
POST | /api/ads/campaigns/update_statuses | Pause or activate many campaigns |
DELETE | /api/ads/:id, /api/ads/campaigns/:id, /api/ads/ad_sets/:id | Delete |
GET | …/:id/analytics | Analytics for one object |
GET | /api/ads/insights | Report across many objects |
GET | /api/ads/:id/review | Review status |
GET | /api/ads/:id/preview | Preview |
GET | /api/ads/search_targeting | Search targeting options |
GET | /api/ads/browse_targeting | Browse the targeting catalog |
GET | /api/ads/dsa_recommendations | DSA recommendations |
GET POST PATCH DELETE | /api/ads/keywords | Keywords |
GET POST DELETE | /api/ads/negative_keywords | Negative keywords |
GET | /api/ads/search_terms | Search terms |
POST | /api/ads/generate_keyword_ideas | Keyword ideas |
POST | /api/ads/keyword_historical_metrics | Keyword historical metrics |
GET PATCH | /api/ads/campaigns/:id/targeting | Campaign targeting |
GET PATCH | /api/ads/campaigns/:id/ad_schedule | Ad schedule |
Sandbox
Section titled “Sandbox”Sandbox keys work against a sandbox ads profile, connected from the dashboard in sandbox mode, for every supported network. It has two ad accounts; ads are created instantly, pass review, and accrue synthetic metrics while active. Writes, analytics, targeting lookups and webhooks behave as in live, with synthetic data. Sandbox ads do not count against the plan’s ad limit.
List ad accounts
Section titled “List ad accounts”GET /api/ads/ad_accounts
Lists the ad accounts reachable through your ads profiles. Start here: every other ads call takes an ad account id.
Query parameters
Section titled “Query parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
profile_id | string | No | Limit to one ads profile. Required with live |
platform | string | No | Only ad accounts of one network: meta_ads, google_ads, pinterest_ads, tiktok_ads |
live | boolean | No | Refetch the ad account list from the network before answering |
page, per_page | integer | No | Pagination |
Example
Section titled “Example”curl -X GET "https://api.postproxy.dev/api/ads/ad_accounts?platform=meta_ads" \ -H "Authorization: Bearer YOUR_API_KEY"import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const accounts = await client.ads.accounts.list({ platform: "meta_ads" });console.log(`Total ad accounts: ${accounts.total}`);for (const account of accounts.data) { console.log(`${account.id}: ${account.name} (${account.currency}, ${account.status})`);}from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")accounts = await client.ads.accounts.list(platform="meta_ads")print(f"Total ad accounts: {accounts.total}")for account in accounts.data: print(f"{account.id}: {account.name} ({account.currency}, {account.status})")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") platform := postproxy.AdPlatformMeta accounts, _ := client.Ads.Accounts.List(context.Background(), &postproxy.AdAccountListOptions{Platform: &platform}) fmt.Printf("Total ad accounts: %d\n", accounts.Total) for _, account := range accounts.Data { fmt.Printf("%s: %s (%s)\n", account.ID, *account.Name, account.Status) }}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")accounts = client.ads.accounts.list(platform: "meta_ads")puts "Total ad accounts: #{accounts.total}"accounts.data.each do |account| puts "#{account.id}: #{account.name} (#{account.currency}, #{account.status})"enduse PostProxy\Client;
$client = new Client("YOUR_API_KEY");$accounts = $client->ads()->accounts()->list(platform: "meta_ads");echo "Total ad accounts: {$accounts->total}\n";foreach ($accounts->data as $account) { echo "{$account->id}: {$account->name} ({$account->currency}, {$account->status})\n";}import dev.postproxy.sdk.PostProxy;import dev.postproxy.sdk.model.AdPlatform;
var client = PostProxy.builder("YOUR_API_KEY").build();var accounts = client.ads().accounts().list(null, AdPlatform.META_ADS);System.out.println("Total ad accounts: " + accounts.total());for (var account : accounts.data()) { System.out.println(account.id() + ": " + account.name() + " (" + account.currency() + ")");}using PostProxy;using PostProxy.Models;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var accounts = await client.Ads.Accounts.ListAsync(platform: AdPlatform.MetaAds);Console.WriteLine($"Total ad accounts: {accounts.Total}");foreach (var account in accounts.Data){ Console.WriteLine($"{account.Id}: {account.Name} ({account.Currency}, {account.Status})");}Response:
{ "total": 1, "page": 1, "per_page": 25, "data": [ { "id": "Yq7HnB", "platform_id": "12712117149", "name": "Main Ad Account", "currency": "USD", "status": "active", "platform": "meta_ads", "profile_id": "OLUOa3o9E", "profile_group_id": "lmFWNVANy", "timezone": "America/Los_Angeles", "timezone_offset_hours_utc": -8, "platform_status": 1, "disable_reason": null, "business": { "id": "1234", "name": "Acme" }, "balance": 0.0, "amount_spent": 152.4, "spend_cap": null, "minimum_daily_budget": 1.0, "funding_source": { "id": "7846263838068845", "type": 1, "display": "Visa *4242" }, "billing_status": "ok", "is_prepay": false, "usable": true, "unusable_reason": null, "platform_data": {}, "synced_at": "2026-11-16T14:11:41.000Z" } ]}See Ad account fields.
Get ad account
Section titled “Get ad account”GET /api/ads/ad_accounts/:ad_account_id
Returns one ad account, in the same shape as a list entry. live=true refetches it from the network first.
Check ad account health
Section titled “Check ad account health”GET /api/ads/ad_accounts/:ad_account_id/health
Live check of whether the account can run ads right now. Run it before creating or boosting an ad.
Example
Section titled “Example”curl -X GET "https://api.postproxy.dev/api/ads/ad_accounts/Yq7HnB/health" \ -H "Authorization: Bearer YOUR_API_KEY"import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const health = await client.ads.accounts.health("Yq7HnB");console.log(`Status: ${health.status} (ready: ${health.ready})`);for (const blocker of health.blockers) { console.log(blocker);}from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")health = await client.ads.accounts.health("Yq7HnB")print(f"Status: {health.status} (ready: {health.ready})")for blocker in health.blockers: print(blocker)package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") health, _ := client.Ads.Accounts.Health(context.Background(), "Yq7HnB", nil) fmt.Printf("Status: %s (ready: %t)\n", health.Status, health.Ready) for _, blocker := range health.Blockers { fmt.Println(blocker) }}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")health = client.ads.accounts.health("Yq7HnB")puts "Status: #{health.status} (ready: #{health.ready})"health.blockers.each do |blocker| puts blockerenduse PostProxy\Client;
$client = new Client("YOUR_API_KEY");$health = $client->ads()->accounts()->health("Yq7HnB");$ready = $health->ready ? "true" : "false";echo "Status: {$health->status} (ready: {$ready})\n";foreach ($health->blockers as $blocker) { echo "{$blocker}\n";}import dev.postproxy.sdk.PostProxy;
var client = PostProxy.builder("YOUR_API_KEY").build();var health = client.ads().accounts().health("Yq7HnB");System.out.println("Status: " + health.status().getValue() + " (ready: " + health.ready() + ")");for (var blocker : health.blockers()) { System.out.println(blocker);}using PostProxy;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var health = await client.Ads.Accounts.GetHealthAsync("Yq7HnB");Console.WriteLine($"Status: {health.Status} (ready: {health.Ready})");foreach (var blocker in health.Blockers){ Console.WriteLine(blocker);}Response:
{ "id": "Yq7HnB", "platform_id": "12712117149", "status": "ok", "ready": true, "blockers": [], "checks": [ { "id": "account_status", "ok": true, "message": null }, { "id": "payment", "ok": true, "message": null }, { "id": "spend_cap", "ok": true, "message": null } ]}status is ok, attention (fixable, such as a missing payment method) or blocked (the account is disabled or closed). blockers holds the messages of the failed checks.
Boost a post
Section titled “Boost a post”POST /api/ads/boost_post
Turns a published post into an ad. Creates the campaign, ad set and ad in one call (or attaches to existing ones) and returns the ad. If a later step fails, the campaign created by the call is removed.
The ad account decides the network. Meta boosts Facebook and Instagram posts; Pinterest promotes a Pin; TikTok runs the post as a Spark Ad. Google Ads cannot boost posts (501).
A boost is not idempotent on its own: send an Idempotency-Key header before retrying (see Idempotency).
Request body
Section titled “Request body”The table describes Meta. Pinterest and TikTok take the same parameters with the differences listed in their sections.
| Parameter | Type | Required | Description |
|---|---|---|---|
ad_account_id | string | Yes | From List ad accounts |
post_id | string | One of | A Postproxy post published to the ad account’s network |
platform_post_id | string | One of | The network’s post ID, for a post not published through Postproxy. On Meta it needs platform |
platform | string | With platform_post_id | facebook or instagram. With post_id, picks the placement when the post went to both |
post_profile_id | string | No | Picks one placement of the post when several can be boosted |
page_id | string | No | Facebook Page ID. Needed with platform_post_id when the ID does not contain it |
instagram_account_id | string | With Instagram platform_post_id | Instagram account ID |
ad_name | string | No | Defaults to Postproxy Ad - <timestamp> |
campaign_name, ad_set_name | string | No | Default to ad_name |
goal | string | No | engagement (default), traffic, awareness, video_views. traffic is not available for Instagram |
optimization_goal | string | No | Per goal: engagement post_engagement; traffic link_clicks, landing_page_views; awareness reach, impressions; video_views thruplay. Defaults to the first |
status | string | No | active (default) or paused |
campaign_status, ad_set_status | string | No | Default to status |
budget | object | Yes* | { amount, type, level }. type: daily (default) or lifetime. level: ad_set (default) or campaign. Amount in the ad account currency, whole units |
bid_strategy | string | No | lowest_cost, bid_cap, cost_cap. Defaults to bid_cap when bid_amount is sent, else lowest_cost |
bid_amount | number | With bid_cap / cost_cap | Not allowed with lowest_cost |
schedule | object | No | { start, end } ISO 8601. No end runs until paused. end must be at least 30 hours after the start; a lifetime budget requires it |
targeting | object | No | See Targeting. Defaults to US, ages 18 to 65 |
call_to_action | object | No | { type, link, link_title } for a link button (needs goal traffic), or { type, destination } with destination messenger, whatsapp or instagram_dm (needs goal engagement) |
tracking | object | No | { pixel_id } |
url_tags | string[] | No | Appended to the ad’s links, e.g. ["utm_source=postproxy"] |
special_ad_categories | string[] | No | housing, financial_products_services, credit, employment, issues_elections_politics, none |
special_ad_category_countries | string[] | No | Defaults to the countries of the targeted locations |
dsa_beneficiary, dsa_payor | string | No | Must be sent together. Suggestions: DSA recommendations |
attach_to | object | No | { campaign_id } to add a new ad set and ad to a campaign, or { ad_set_id } to add only the ad (its campaign is implied) |
ad_set_budget_sharing_enabled | boolean | No | Meta ad set budget sharing |
platforms | object | No | Per-network extras, keyed by ads platform (see the network sections) |
validate_only | boolean | No | Check the request without creating anything |
* Not with attach_to.ad_set_id: the ad set already carries budget, bid and targeting, so those cannot be sent. With attach_to.campaign_id on a campaign that carries its own budget, budget cannot be sent either.
attach_to cannot be combined with budget.level: "campaign", special_ad_categories or ad_set_budget_sharing_enabled.
Instagram posts can be boosted whichever way the Instagram profile was connected. The ads connection must manage the Facebook Page linked to that Instagram account; otherwise the boost returns 422.
Targeting object
Section titled “Targeting object”| Key | Description |
|---|---|
locations | { countries, regions, cities, zips, country_groups, custom_locations }. Regions and cities are { key } objects with keys from Search targeting; a city or custom location radius needs distance_unit mile (10 to 50) or kilometer (17 to 80) |
excluded_locations | Same shape |
age_min, age_max | Integers |
genders | all (default), male, female |
interests, behaviors | Arrays of IDs from Search targeting |
advantage_audience | boolean, default false |
platform_targeting | Raw targeting keys passed to the network as they are |
Targeting IDs are network-specific: search on the ads profile the ad will run on. Google, Pinterest and TikTok use different locations shapes, described in their sections.
Example
Section titled “Example”curl -X POST "https://api.postproxy.dev/api/ads/boost_post" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "ad_account_id": "Yq7HnB", "post_id": "rDt5DM9aD", "goal": "engagement", "status": "paused", "budget": { "amount": 10, "type": "daily" }, "targeting": { "locations": { "countries": ["US", "CA"] }, "age_min": 21, "age_max": 45 } }'import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const ad = await client.ads.boostPost({ ad_account_id: "Yq7HnB", post_id: "rDt5DM9aD", goal: "engagement", status: "paused", budget: { amount: 10, type: "daily" }, targeting: { locations: { countries: ["US", "CA"] }, age_min: 21, age_max: 45 },});console.log(`Created ad: ${ad.id} (status: ${ad.status})`);from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")ad = await client.ads.boost_post({ "ad_account_id": "Yq7HnB", "post_id": "rDt5DM9aD", "goal": "engagement", "status": "paused", "budget": {"amount": 10, "type": "daily"}, "targeting": {"locations": {"countries": ["US", "CA"]}, "age_min": 21, "age_max": 45},})print(f"Created ad: {ad.id} (status: {ad.status})")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") ad, _ := client.Ads.BoostPost(context.Background(), map[string]any{ "ad_account_id": "Yq7HnB", "post_id": "rDt5DM9aD", "goal": "engagement", "status": "paused", "budget": map[string]any{"amount": 10, "type": "daily"}, "targeting": map[string]any{ "locations": map[string]any{"countries": []string{"US", "CA"}}, "age_min": 21, "age_max": 45, }, }, nil) fmt.Printf("Created ad: %s (status: %s)\n", ad.ID, ad.Status)}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")ad = client.ads.boost_post({ ad_account_id: "Yq7HnB", post_id: "rDt5DM9aD", goal: "engagement", status: "paused", budget: { amount: 10, type: "daily" }, targeting: { locations: { countries: ["US", "CA"] }, age_min: 21, age_max: 45 }})puts "Created ad: #{ad.id} (status: #{ad.status})"use PostProxy\Client;
$client = new Client("YOUR_API_KEY");$ad = $client->ads()->boostPost([ "ad_account_id" => "Yq7HnB", "post_id" => "rDt5DM9aD", "goal" => "engagement", "status" => "paused", "budget" => ["amount" => 10, "type" => "daily"], "targeting" => ["locations" => ["countries" => ["US", "CA"]], "age_min" => 21, "age_max" => 45],]);echo "Created ad: {$ad->id} (status: {$ad->status})\n";import dev.postproxy.sdk.PostProxy;import java.util.List;import java.util.Map;
var client = PostProxy.builder("YOUR_API_KEY").build();var ad = client.ads().boostPost(Map.of( "ad_account_id", "Yq7HnB", "post_id", "rDt5DM9aD", "goal", "engagement", "status", "paused", "budget", Map.of("amount", 10, "type", "daily"), "targeting", Map.of( "locations", Map.of("countries", List.of("US", "CA")), "age_min", 21, "age_max", 45)));System.out.println("Created ad: " + ad.id() + " (status: " + ad.status().getValue() + ")");using PostProxy;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var ad = await client.Ads.BoostPostAsync(new Dictionary<string, object?>{ ["ad_account_id"] = "Yq7HnB", ["post_id"] = "rDt5DM9aD", ["goal"] = "engagement", ["status"] = "paused", ["budget"] = new Dictionary<string, object?> { ["amount"] = 10, ["type"] = "daily" }, ["targeting"] = new Dictionary<string, object?> { ["locations"] = new Dictionary<string, object?> { ["countries"] = new[] { "US", "CA" } }, ["age_min"] = 21, ["age_max"] = 45, },});Console.WriteLine($"Created ad: {ad.Id} (status: {ad.Status})");Response (201 Created):
{ "id": "Kx82LmQp", "kind": "ad", "platform": "meta_ads", "platform_id": "305559959245942194", "profile_id": "OLUOa3o9E", "ad_account_id": "Yq7HnB", "platform_ad_account_id": "12712117149", "campaign_id": "c7RtY2Wn", "platform_campaign_id": "534260176547215351", "campaign_name": "Postproxy Ad - 2026-11-16 14:11", "ad_set_id": "s4HdN9Zv", "platform_ad_set_id": "532339667291788965", "ad_set_name": "Postproxy Ad - 2026-11-16 14:11", "name": "Postproxy Ad - 2026-11-16 14:11", "status": "paused", "platform_status": "PAUSED", "configured_status": "PAUSED", "source": "postproxy", "ad_type": "boost", "goal": { "type": "engagement", "title": "Get More Engagement" }, "platform_objective": "OUTCOME_ENGAGEMENT", "optimization_goal": "POST_ENGAGEMENT", "bid_strategy": "lowest_cost", "budget": { "amount": 10.0, "type": "daily", "level": "ad_set", "currency": "USD", "remaining": 10.0 }, "schedule": { "start": "2026-11-16T14:11:41Z", "end": null }, "targeting": { "age_min": 21, "age_max": 45, "genders": "all", "locations": { "countries": ["US", "CA"] }, "interests": [], "behaviors": [], "advantage_audience": 0 }, "creative": { "id": "148287159020790067", "type": "share" }, "review": { "status": "pending", "reasons": [] }, "preview_link": "https://fb.me/HutjLU9Ggi3P", "billing_event": "IMPRESSIONS", "post_id": "rDt5DM9aD", "post_profile_id": "E0fX7OYZR", "platform_post_id": "104512345678901_122104567890123", "metrics": {}, "platform_data": {}, "created_at": "2026-11-16T14:11:41.264Z", "platform_created_at": "2026-11-16T14:11:41.000Z", "updated_at": "2026-11-16T14:11:41.264Z", "synced_at": "2026-11-16T14:11:41.264Z"}Create an ad
Section titled “Create an ad”POST /api/ads
Creates an ad from your own creative, with its campaign and ad set (or attached to existing ones). The ad account decides the network, and each network takes its own creative: this section describes Meta; see Google Ads, Pinterest and TikTok for theirs.
Takes every Boost a post parameter except the post ones, plus:
| Parameter | Type | Required | Description |
|---|---|---|---|
page_id | string | Yes | Facebook Page the ad runs as |
instagram_account_id | string | No | Instagram account to show the ad from |
link | string | Yes | Destination URL |
media | string[] | One of | One image or video URL |
carousel_cards | object[] | One of | 2 to 10 cards: { media, link, headline, description } |
headline, body, description | string | No | Ad copy |
headlines, bodies, descriptions | string[] | No | Copy variants, up to 5 of each; Meta mixes them and shows what performs best. Not with carousel_cards or attach_to.ad_set_id: an ad with variants needs its own ad set |
attribution | object[] | No | Attribution windows of the ad set: [{ event, window_days }] with event click, view or engaged_view and window_days 1 or 7 |
platforms.meta_ads.thumbnail_url | string | With a video | Video thumbnail |
placements | object | No | Manual placements: publisher_platforms, facebook_positions, instagram_positions, messenger_positions, audience_network_positions, threads_positions, device_platforms. Omit for automatic placements |
goal | string | No | Defaults to traffic |
targeting also accepts languages (locale IDs from Search targeting), work_positions, work_employers, work_industries, income, user_os and user_device.
call_to_action.type for a link button is one of LEARN_MORE, APPLY_NOW, SIGN_UP, SHOP_NOW, BOOK_TRAVEL, GET_QUOTE, CONTACT_US, DOWNLOAD or SUBSCRIBE.
Example
Section titled “Example”curl -X POST "https://api.postproxy.dev/api/ads" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: spring-sale-1" \ -d '{ "ad_account_id": "Yq7HnB", "page_id": "104512345678901", "link": "https://example.com/spring", "headline": "Spring sale", "body": "20% off everything this week.", "media": ["https://example.com/spring.jpg"], "call_to_action": { "type": "SHOP_NOW" }, "goal": "traffic", "status": "paused", "budget": { "amount": 15, "type": "daily" }, "targeting": { "locations": { "countries": ["US"] } } }'import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const ad = await client.ads.create( { ad_account_id: "Yq7HnB", page_id: "104512345678901", link: "https://example.com/spring", headline: "Spring sale", body: "20% off everything this week.", media: ["https://example.com/spring.jpg"], call_to_action: { type: "SHOP_NOW" }, goal: "traffic", status: "paused", budget: { amount: 15, type: "daily" }, targeting: { locations: { countries: ["US"] } }, }, { idempotencyKey: "spring-sale-1" },);console.log(`Created ad: ${ad.id} (status: ${ad.status})`);from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")ad = await client.ads.create( { "ad_account_id": "Yq7HnB", "page_id": "104512345678901", "link": "https://example.com/spring", "headline": "Spring sale", "body": "20% off everything this week.", "media": ["https://example.com/spring.jpg"], "call_to_action": {"type": "SHOP_NOW"}, "goal": "traffic", "status": "paused", "budget": {"amount": 15, "type": "daily"}, "targeting": {"locations": {"countries": ["US"]}}, }, idempotency_key="spring-sale-1",)print(f"Created ad: {ad.id} (status: {ad.status})")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") ctx := postproxy.WithIdempotencyKey(context.Background(), "spring-sale-1") ad, _ := client.Ads.Create(ctx, map[string]any{ "ad_account_id": "Yq7HnB", "page_id": "104512345678901", "link": "https://example.com/spring", "headline": "Spring sale", "body": "20% off everything this week.", "media": []string{"https://example.com/spring.jpg"}, "call_to_action": map[string]any{"type": "SHOP_NOW"}, "goal": "traffic", "status": "paused", "budget": map[string]any{"amount": 15, "type": "daily"}, "targeting": map[string]any{"locations": map[string]any{"countries": []string{"US"}}}, }, nil) fmt.Printf("Created ad: %s (status: %s)\n", ad.ID, ad.Status)}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")ad = client.ads.create( { ad_account_id: "Yq7HnB", page_id: "104512345678901", link: "https://example.com/spring", headline: "Spring sale", body: "20% off everything this week.", media: ["https://example.com/spring.jpg"], call_to_action: { type: "SHOP_NOW" }, goal: "traffic", status: "paused", budget: { amount: 15, type: "daily" }, targeting: { locations: { countries: ["US"] } } }, idempotency_key: "spring-sale-1")puts "Created ad: #{ad.id} (status: #{ad.status})"use PostProxy\Client;
$client = new Client("YOUR_API_KEY");$ad = $client->ads()->create( [ "ad_account_id" => "Yq7HnB", "page_id" => "104512345678901", "link" => "https://example.com/spring", "headline" => "Spring sale", "body" => "20% off everything this week.", "media" => ["https://example.com/spring.jpg"], "call_to_action" => ["type" => "SHOP_NOW"], "goal" => "traffic", "status" => "paused", "budget" => ["amount" => 15, "type" => "daily"], "targeting" => ["locations" => ["countries" => ["US"]]], ], idempotencyKey: "spring-sale-1",);echo "Created ad: {$ad->id} (status: {$ad->status})\n";import dev.postproxy.sdk.PostProxy;import java.util.List;import java.util.Map;
var client = PostProxy.builder("YOUR_API_KEY").build();var ad = client.ads().create(Map.ofEntries( Map.entry("ad_account_id", "Yq7HnB"), Map.entry("page_id", "104512345678901"), Map.entry("link", "https://example.com/spring"), Map.entry("headline", "Spring sale"), Map.entry("body", "20% off everything this week."), Map.entry("media", List.of("https://example.com/spring.jpg")), Map.entry("call_to_action", Map.of("type", "SHOP_NOW")), Map.entry("goal", "traffic"), Map.entry("status", "paused"), Map.entry("budget", Map.of("amount", 15, "type", "daily")), Map.entry("targeting", Map.of("locations", Map.of("countries", List.of("US"))))), null, "spring-sale-1");System.out.println("Created ad: " + ad.id() + " (status: " + ad.status().getValue() + ")");using PostProxy;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var ad = await client.Ads.CreateAsync(new Dictionary<string, object?>{ ["ad_account_id"] = "Yq7HnB", ["page_id"] = "104512345678901", ["link"] = "https://example.com/spring", ["headline"] = "Spring sale", ["body"] = "20% off everything this week.", ["media"] = new[] { "https://example.com/spring.jpg" }, ["call_to_action"] = new Dictionary<string, object?> { ["type"] = "SHOP_NOW" }, ["goal"] = "traffic", ["status"] = "paused", ["budget"] = new Dictionary<string, object?> { ["amount"] = 15, ["type"] = "daily" }, ["targeting"] = new Dictionary<string, object?> { ["locations"] = new Dictionary<string, object?> { ["countries"] = new[] { "US" } }, },}, idempotencyKey: "spring-sale-1");Console.WriteLine($"Created ad: {ad.Id} (status: {ad.Status})");Response (201 Created):
{ "id": "Kx82LmQp", "kind": "ad", "platform": "meta_ads", "platform_id": "305559959245942194", "profile_id": "OLUOa3o9E", "ad_account_id": "Yq7HnB", "platform_ad_account_id": "12712117149", "campaign_id": "c7RtY2Wn", "platform_campaign_id": "534260176547215351", "campaign_name": "Postproxy Ad - 2026-11-16 14:11", "ad_set_id": "s4HdN9Zv", "platform_ad_set_id": "532339667291788965", "ad_set_name": "Postproxy Ad - 2026-11-16 14:11", "name": "Postproxy Ad - 2026-11-16 14:11", "status": "paused", "platform_status": "PAUSED", "configured_status": "PAUSED", "source": "postproxy", "ad_type": "standalone", "goal": { "type": "traffic", "title": "Get More Website Visitors" }, "platform_objective": "OUTCOME_TRAFFIC", "optimization_goal": "LINK_CLICKS", "bid_strategy": "lowest_cost", "budget": { "amount": 15.0, "type": "daily", "level": "ad_set", "currency": "USD", "remaining": 15.0 }, "schedule": { "start": "2026-11-16T14:11:41Z", "end": null }, "targeting": { "age_min": 18, "age_max": 65, "genders": "all", "locations": { "countries": ["US"] }, "interests": [], "behaviors": [], "advantage_audience": 0 }, "call_to_action": { "type": "SHOP_NOW", "link": "https://example.com/spring" }, "creative": { "id": "148287159020790067", "type": "link" }, "review": { "status": "pending", "reasons": [] }, "preview_link": "https://fb.me/HutjLU9Ggi3P", "billing_event": "IMPRESSIONS", "post_id": null, "post_profile_id": null, "platform_post_id": null, "metrics": {}, "platform_data": {}, "created_at": "2026-11-16T14:11:41.264Z", "platform_created_at": "2026-11-16T14:11:41.000Z", "updated_at": "2026-11-16T14:11:41.264Z", "synced_at": "2026-11-16T14:11:41.264Z"}Create a campaign
Section titled “Create a campaign”POST /api/ads/campaigns
Creates an empty campaign to put ad sets and ads into later, with Create an ad set or attach_to.campaign_id. Paused unless status is active.
Request body
Section titled “Request body”| Parameter | Type | Required | Description |
|---|---|---|---|
ad_account_id | string | Yes | |
name | string | Yes | |
status | string | No | paused (default) or active |
goal | string | No | engagement, traffic, awareness, video_views. Defaults to engagement on Meta, traffic on Pinterest and TikTok. Not used by Google |
budget | object | Depends | { amount, type }. Meta: optional, makes it a campaign-budget campaign. Google and Pinterest: required. TikTok: optional overall budget |
bid_strategy | string | No | Meta, only with a budget |
special_ad_categories, special_ad_category_countries | string[] | No | Meta |
campaign_type | string | No | Google: search (default) or display. A Performance Max campaign cannot be created empty; use Create an ad |
bidding, schedule, targeting, network_settings, eu_political_advertising | No | Google, as in Create a Search ad | |
validate_only | boolean | No | Meta and Google |
Example
Section titled “Example”curl -X POST "https://api.postproxy.dev/api/ads/campaigns" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "ad_account_id": "Yq7HnB", "name": "Spring sale", "goal": "traffic", "budget": { "amount": 50, "type": "daily" } }'import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const campaign = await client.ads.campaigns.create({ ad_account_id: "Yq7HnB", name: "Spring sale", goal: "traffic", budget: { amount: 50, type: "daily" },});console.log(`Created campaign: ${campaign.id} (status: ${campaign.status})`);from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")campaign = await client.ads.campaigns.create({ "ad_account_id": "Yq7HnB", "name": "Spring sale", "goal": "traffic", "budget": {"amount": 50, "type": "daily"},})print(f"Created campaign: {campaign.id} (status: {campaign.status})")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") campaign, _ := client.Ads.Campaigns.Create(context.Background(), map[string]any{ "ad_account_id": "Yq7HnB", "name": "Spring sale", "goal": "traffic", "budget": map[string]any{"amount": 50, "type": "daily"}, }, nil) fmt.Printf("Created campaign: %s (status: %s)\n", campaign.ID, campaign.Status)}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")campaign = client.ads.campaigns.create({ ad_account_id: "Yq7HnB", name: "Spring sale", goal: "traffic", budget: { amount: 50, type: "daily" }})puts "Created campaign: #{campaign.id} (status: #{campaign.status})"use PostProxy\Client;
$client = new Client("YOUR_API_KEY");$campaign = $client->ads()->campaigns()->create([ "ad_account_id" => "Yq7HnB", "name" => "Spring sale", "goal" => "traffic", "budget" => ["amount" => 50, "type" => "daily"],]);echo "Created campaign: {$campaign->id} (status: {$campaign->status})\n";import dev.postproxy.sdk.PostProxy;import java.util.Map;
var client = PostProxy.builder("YOUR_API_KEY").build();var campaign = client.ads().campaigns().create(Map.of( "ad_account_id", "Yq7HnB", "name", "Spring sale", "goal", "traffic", "budget", Map.of("amount", 50, "type", "daily")));System.out.println("Created campaign: " + campaign.id() + " (status: " + campaign.status().getValue() + ")");using PostProxy;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var campaign = await client.Ads.Campaigns.CreateAsync(new Dictionary<string, object?>{ ["ad_account_id"] = "Yq7HnB", ["name"] = "Spring sale", ["goal"] = "traffic", ["budget"] = new Dictionary<string, object?> { ["amount"] = 50, ["type"] = "daily" },});Console.WriteLine($"Created campaign: {campaign.Id} (status: {campaign.Status})");Response (201 Created):
{ "id": "c7RtY2Wn", "kind": "campaign", "platform": "meta_ads", "platform_id": "534260176547215351", "profile_id": "OLUOa3o9E", "ad_account_id": "Yq7HnB", "platform_ad_account_id": "12712117149", "campaign_id": null, "platform_campaign_id": null, "campaign_name": null, "ad_set_id": null, "platform_ad_set_id": null, "ad_set_name": null, "name": "Spring sale", "status": "paused", "platform_status": "PAUSED", "configured_status": "PAUSED", "source": "postproxy", "goal": { "type": "traffic", "title": "Get More Website Visitors" }, "platform_objective": "OUTCOME_TRAFFIC", "bid_strategy": "lowest_cost", "budget": { "amount": 50.0, "type": "daily", "level": "campaign", "currency": "USD", "remaining": 50.0 }, "buying_type": "AUCTION", "spend_cap": null, "issues": [], "post_id": null, "post_profile_id": null, "platform_post_id": null, "metrics": {}, "platform_data": {}, "created_at": "2026-11-16T14:11:41.264Z", "platform_created_at": "2026-11-16T14:11:41.000Z", "updated_at": "2026-11-16T14:11:41.264Z", "synced_at": "2026-11-16T14:11:41.264Z"}Create an ad set
Section titled “Create an ad set”POST /api/ads/ad_sets
Creates an ad set in an existing campaign, with no ad in it. Add ads with attach_to: { ad_set_id } in Create an ad or Boost a post. Returns the ad set (201 Created).
| Parameter | Type | Required | Description |
|---|---|---|---|
ad_account_id | string | Yes | |
campaign_id | string | Yes | The campaign to put it in |
name | string | Yes | |
status | string | No | active (default) or paused |
goal | string | No | Meta. Defaults to the campaign’s goal |
budget | object | Depends | { amount, type }. Meta: required, unless the campaign carries the budget, in which case it cannot be sent. TikTok: required. Pinterest: not accepted (the budget lives on the campaign) |
bid_amount, bid_strategy, optimization_goal | No | As in Boost a post | |
schedule, targeting, placements | object | Depends | As in Boost a post; targeting.locations is required on Meta, Pinterest and TikTok |
dsa_beneficiary, dsa_payor | string | No | Meta |
keywords, negative_keywords, bidding.max_cpc | No | Google Search ad group | |
validate_only | boolean | No | Meta and Google |
Validate without creating
Section titled “Validate without creating”Send validate_only: true on Boost a post, Create an ad, Create a campaign or Create an ad set to check the request without creating anything. The call returns 200:
{ "valid": true, "validated": ["params", "campaign"] }On Meta the parameters are validated and the campaign is dry-run on the network; the ad set and ad are not. On Google the whole request is validated. Pinterest and TikTok return 501.
List ads, campaigns, ad sets
Section titled “List ads, campaigns, ad sets”GET /api/ads
GET /api/ads/campaigns
GET /api/ads/ad_sets
Lists stored objects across ad accounts, including ones created outside Postproxy. Each row is an ad object.
Query parameters
Section titled “Query parameters”| Parameter | Type | Description |
|---|---|---|
status | string | One or several, comma-separated: active, pending_review, paused, rejected, error, completed, archived, deleted |
platform | string | meta_ads, google_ads, pinterest_ads, tiktok_ads |
profile_id | string | One ads profile |
ad_account_id | string | One ad account |
campaign_id | string | Ads and ad sets of a campaign |
ad_set_id | string | Ads of an ad set |
platform_id | string | The object with this network ID |
post_id | string | Ads boosting this Postproxy post |
platform_post_id | string | Ads promoting the post with this network ID, whether or not it was published through Postproxy |
has_delivery | boolean | true: objects with impressions; false: objects with none |
min_spend | number | Objects that spent at least this much, in the ad account’s currency |
include_empty | boolean | Campaigns and ad sets only. false leaves out the ones with no ads. Default true |
source | string | all (default) or postproxy (created through Postproxy only) |
from, to | ISO 8601 | Created on the network within this range. No effect on Google Ads |
search | string | Name contains, or exact network ID |
sort | string | newest (default), oldest, spend_desc or spend_asc. Objects with no metrics yet come last in both spend orders |
page, per_page | integer | Pagination |
Example
Section titled “Example”curl -X GET "https://api.postproxy.dev/api/ads?status=active&ad_account_id=Yq7HnB" \ -H "Authorization: Bearer YOUR_API_KEY"import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const ads = await client.ads.list({ status: "active", adAccountId: "Yq7HnB" });console.log(`Total ads: ${ads.total}`);for (const ad of ads.data) { console.log(`${ad.id}: ${ad.name} (${ad.status}, spend: ${ad.metrics.spend})`);}from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")ads = await client.ads.list(status="active", ad_account_id="Yq7HnB")print(f"Total ads: {ads.total}")for ad in ads.data: print(f"{ad.id}: {ad.name} ({ad.status}, spend: {ad.metrics.get('spend')})")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") adAccountID := "Yq7HnB" ads, _ := client.Ads.List(context.Background(), &postproxy.AdListOptions{ Status: []postproxy.AdDeliveryStatus{postproxy.AdDeliveryStatusActive}, AdAccountID: &adAccountID, }) fmt.Printf("Total ads: %d\n", ads.Total) for _, ad := range ads.Data { fmt.Printf("%s (status: %s, spend: %v)\n", ad.ID, ad.Status, ad.Metrics["spend"]) }}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")ads = client.ads.list(status: "active", ad_account_id: "Yq7HnB")puts "Total ads: #{ads.total}"ads.data.each do |ad| puts "#{ad.id}: #{ad.name} (#{ad.status}, spend: #{ad.metrics[:spend]})"enduse PostProxy\Client;
$client = new Client("YOUR_API_KEY");$ads = $client->ads()->list(status: "active", adAccountId: "Yq7HnB");echo "Total ads: {$ads->total}\n";foreach ($ads->data as $ad) { $spend = $ad->metrics["spend"] ?? 0; echo "{$ad->id}: {$ad->name} ({$ad->status}, spend: {$spend})\n";}import dev.postproxy.sdk.PostProxy;import dev.postproxy.sdk.model.AdDeliveryStatus;import dev.postproxy.sdk.param.AdListParams;import java.util.List;
var client = PostProxy.builder("YOUR_API_KEY").build();var ads = client.ads().list(AdListParams.builder() .status(List.of(AdDeliveryStatus.ACTIVE)) .adAccountId("Yq7HnB") .build());System.out.println("Total ads: " + ads.total());for (var ad : ads.data()) { System.out.println(ad.id() + ": " + ad.name() + " (spend: " + ad.metrics().get("spend") + ")");}using PostProxy;using PostProxy.Models;using PostProxy.Parameters;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var ads = await client.Ads.ListAsync(new ListAdsParams{ Status = [AdDeliveryStatus.Active], AdAccountId = "Yq7HnB",});Console.WriteLine($"Total ads: {ads.Total}");foreach (var ad in ads.Data){ Console.WriteLine($"{ad.Id}: {ad.Name} ({ad.Status}, spend: {ad.Metrics?["spend"]})");}Response:
{ "total": 1, "page": 1, "per_page": 25, "data": [ { "id": "Kx82LmQp", "kind": "ad", "platform": "meta_ads", "platform_id": "305559959245942194", "profile_id": "OLUOa3o9E", "ad_account_id": "Yq7HnB", "platform_ad_account_id": "12712117149", "campaign_id": "c7RtY2Wn", "platform_campaign_id": "534260176547215351", "campaign_name": "Spring sale", "ad_set_id": "s4HdN9Zv", "platform_ad_set_id": "532339667291788965", "ad_set_name": "Spring sale", "name": "Spring sale", "status": "active", "platform_status": "ACTIVE", "configured_status": "ACTIVE", "source": "postproxy", "ad_type": "boost", "goal": { "type": "engagement", "title": "Get More Engagement" }, "platform_objective": "OUTCOME_ENGAGEMENT", "optimization_goal": "POST_ENGAGEMENT", "bid_strategy": "lowest_cost", "budget": { "amount": 10.0, "type": "daily", "level": "ad_set", "currency": "USD", "remaining": 5.31 }, "schedule": { "start": "2026-11-16T14:11:41Z", "end": null }, "targeting": { "age_min": 21, "age_max": 45, "genders": "all", "locations": { "countries": ["US", "CA"] }, "interests": [], "behaviors": [], "advantage_audience": 0 }, "creative": { "id": "148287159020790067", "type": "share" }, "review": { "status": "approved", "reasons": [] }, "preview_link": "https://fb.me/HutjLU9Ggi3P", "billing_event": "IMPRESSIONS", "post_id": "rDt5DM9aD", "post_profile_id": "E0fX7OYZR", "platform_post_id": "104512345678901_122104567890123", "metrics": { "spend": 41.2, "impressions": 9120, "reach": 6400, "clicks": 180, "ctr": 1.97, "currency": "USD" }, "platform_data": {}, "created_at": "2026-11-16T14:11:41.264Z", "platform_created_at": "2026-11-16T14:11:41.000Z", "updated_at": "2026-11-28T09:30:12.118Z", "synced_at": "2026-11-30T15:00:02.000Z" } ]}Get ad, campaign, ad set
Section titled “Get ad, campaign, ad set”GET /api/ads/:id
GET /api/ads/campaigns/:id
GET /api/ads/ad_sets/:id
Returns one ad object with its latest synced metrics. live=true refetches the object and its metrics from the network first.
Get tree
Section titled “Get tree”GET /api/ads/tree
Campaigns with their ad sets and ads nested (data[].ad_sets[].ads[]). Takes the list filters, applied to campaigns, plus depth: campaign, ad_set or ad (default). Paginated by campaign.
Update
Section titled “Update”PATCH /api/ads/:id
PATCH /api/ads/ad_sets/:id
PATCH /api/ads/campaigns/:id
The table describes Meta; the other networks list the fields they accept in their sections.
| Field | Ad | Ad set | Campaign |
|---|---|---|---|
ad_name (or name) | Yes | Yes | Yes |
status (active, paused, archived) | Yes | Yes | Yes |
budget { amount, type } | Applied to its ad set | Yes | Yes |
bid_amount | Applied to its ad set | Yes | No |
targeting | Applied to its ad set | Yes | No |
schedule { start, end } | Applied to its ad set | Yes | No |
bid_strategy | No | Yes | Yes |
spend_cap | No | No | Yes |
attribution | No | Yes | No |
creative | Yes | No | No |
targeting replaces the whole targeting and must include locations. A field the network cannot change at that level returns 501. An ad whose budget lives on its campaign returns 422 for budget: update the campaign.
creative (Meta, ads created with Create an ad) takes any of headline, body, description, link, media (one image URL), thumbnail_url, carousel_cards, call_to_action { type, link } and, on an ad created with copy variants, headlines, bodies, descriptions. Fields left out keep their value. The ad gets a new creative, so creative.id changes and the ad goes back into review. Not possible: editing a boosted post’s creative (501; edit the post), replacing a video (501), adding variants to an ad created without them (422).
Returns the updated object, refetched from the network.
Pause, resume, archive
Section titled “Pause, resume, archive”POST /api/ads/:id/pause
POST /api/ads/:id/resume
POST /api/ads/:id/archive
The same three exist under /api/ads/ad_sets/:id and /api/ads/campaigns/:id. Only the object addressed is switched; parents and siblings are left alone, so a paused parent still blocks delivery after a resume.
Returns the object plus updated. If it was already in that state, the response carries "updated": false with a skipped_reason.
archive is not available on Google Ads or TikTok (501).
Example
Section titled “Example”curl -X POST "https://api.postproxy.dev/api/ads/Kx82LmQp/pause" \ -H "Authorization: Bearer YOUR_API_KEY"import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const ad = await client.ads.pause("Kx82LmQp");console.log(`Ad ${ad.id} is ${ad.status} (updated: ${ad.updated})`);from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")ad = await client.ads.pause("Kx82LmQp")print(f"Ad {ad.id} is {ad.status} (updated: {ad.updated})")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") ad, _ := client.Ads.Pause(context.Background(), "Kx82LmQp", nil) fmt.Printf("Ad %s is %s (updated: %t)\n", ad.ID, ad.Status, *ad.Updated)}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")ad = client.ads.pause("Kx82LmQp")puts "Ad #{ad.id} is #{ad.status} (updated: #{ad.updated})"use PostProxy\Client;
$client = new Client("YOUR_API_KEY");$ad = $client->ads()->pause("Kx82LmQp");$updated = $ad->updated ? "true" : "false";echo "Ad {$ad->id} is {$ad->status} (updated: {$updated})\n";import dev.postproxy.sdk.PostProxy;
var client = PostProxy.builder("YOUR_API_KEY").build();var ad = client.ads().pause("Kx82LmQp");System.out.println("Ad " + ad.id() + " is " + ad.status().getValue() + " (updated: " + ad.updated() + ")");using PostProxy;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var ad = await client.Ads.PauseAsync("Kx82LmQp");Console.WriteLine($"Ad {ad.Id} is {ad.Status} (updated: {ad.Updated})");Response:
{ "id": "Kx82LmQp", "kind": "ad", "platform": "meta_ads", "platform_id": "305559959245942194", "profile_id": "OLUOa3o9E", "ad_account_id": "Yq7HnB", "platform_ad_account_id": "12712117149", "campaign_id": "c7RtY2Wn", "platform_campaign_id": "534260176547215351", "campaign_name": "Spring sale", "ad_set_id": "s4HdN9Zv", "platform_ad_set_id": "532339667291788965", "ad_set_name": "Spring sale", "name": "Spring sale", "status": "paused", "platform_status": "PAUSED", "configured_status": "PAUSED", "source": "postproxy", "ad_type": "boost", "goal": { "type": "engagement", "title": "Get More Engagement" }, "platform_objective": "OUTCOME_ENGAGEMENT", "optimization_goal": "POST_ENGAGEMENT", "bid_strategy": "lowest_cost", "budget": { "amount": 10.0, "type": "daily", "level": "ad_set", "currency": "USD", "remaining": 5.31 }, "schedule": { "start": "2026-11-16T14:11:41Z", "end": null }, "targeting": { "age_min": 21, "age_max": 45, "genders": "all", "locations": { "countries": ["US", "CA"] }, "interests": [], "behaviors": [], "advantage_audience": 0 }, "creative": { "id": "148287159020790067", "type": "share" }, "review": { "status": "approved", "reasons": [] }, "preview_link": "https://fb.me/HutjLU9Ggi3P", "billing_event": "IMPRESSIONS", "post_id": "rDt5DM9aD", "post_profile_id": "E0fX7OYZR", "platform_post_id": "104512345678901_122104567890123", "metrics": { "spend": 41.2, "impressions": 9120, "reach": 6400, "clicks": 180, "ctr": 1.97, "currency": "USD" }, "platform_data": {}, "created_at": "2026-11-16T14:11:41.264Z", "platform_created_at": "2026-11-16T14:11:41.000Z", "updated_at": "2026-11-30T15:04:19.502Z", "synced_at": "2026-11-30T15:04:19.502Z", "updated": true}Update campaign statuses
Section titled “Update campaign statuses”POST /api/ads/campaigns/update_statuses
Pauses or activates up to 50 campaigns in one call.
curl -X POST "https://api.postproxy.dev/api/ads/campaigns/update_statuses" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "campaign_ids": ["c7RtY2Wn", "Zk4HBg"], "status": "paused" }'{ "status": "paused", "data": [ { "id": "c7RtY2Wn", "ok": true, "updated": true, "status": "paused" }, { "id": "Zk4HBg", "ok": false, "error": "Campaign not found" } ]}status is active or paused. A failed item carries error instead of updated and status.
Delete
Section titled “Delete”DELETE /api/ads/:id
DELETE /api/ads/ad_sets/:id
DELETE /api/ads/campaigns/:id
Deletes the object on the network. This cannot be undone. Deleting an ad also deletes its ad set and campaign when Postproxy created them and nothing else is left in them. Pinterest has no delete: the object is archived instead.
{ "deleted": true, "id": "K6mHNZ", "platform_id": "616815714713752294", "status": "deleted", "removed_parents": [{ "kind": "ad_set", "id": "Zj1HQg", "platform_id": "175364510906434831" }]}The object stays readable with status: "deleted".
Analytics
Section titled “Analytics”GET /api/ads/:id/analytics
GET /api/ads/ad_sets/:id/analytics
GET /api/ads/campaigns/:id/analytics
Live performance report for one object over a date range. For many objects at once, use Insights.
Query parameters
Section titled “Query parameters”| Parameter | Type | Description |
|---|---|---|
from, to | date | YYYY-MM-DD. Defaults to the last 30 days. At most 37 months back (422 beyond); Pinterest: 914 days |
breakdowns | string | Comma-separated dimensions to split the metrics by, see below |
Breakdowns per network:
| Network | Breakdowns |
|---|---|
| Meta | age, gender, country, region, publisher_platform, platform_position, device_platform, impression_device |
| Google Ads | None |
age, gender, country, region, placement, device, interest, keyword (last 90 days only) | |
| TikTok | age, gender, country, platform, placement, language |
Breakdowns the network does not offer come back in unsupported_breakdowns instead of failing.
Example
Section titled “Example”curl -X GET "https://api.postproxy.dev/api/ads/Kx82LmQp/analytics?from=2026-11-01&to=2026-11-30" \ -H "Authorization: Bearer YOUR_API_KEY"import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const analytics = await client.ads.analytics("Kx82LmQp", { from: "2026-11-01", to: "2026-11-30" });console.log(`Spend: ${analytics.summary.spend} ${analytics.currency}`);for (const day of analytics.daily) { console.log(`${day.date}: ${day.impressions} impressions, ${day.clicks} clicks`);}from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")analytics = await client.ads.analytics("Kx82LmQp", from_="2026-11-01", to="2026-11-30")print(f"Spend: {analytics.summary.get('spend')} {analytics.currency}")for day in analytics.daily: print(f"{day['date']}: {day.get('impressions')} impressions, {day.get('clicks')} clicks")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") from, to := "2026-11-01", "2026-11-30" analytics, _ := client.Ads.Analytics(context.Background(), "Kx82LmQp", &postproxy.AdAnalyticsOptions{From: &from, To: &to}) fmt.Printf("Spend: %v\n", analytics.Summary["spend"]) for _, day := range analytics.Daily { fmt.Printf("%v: %v impressions, %v clicks\n", day["date"], day["impressions"], day["clicks"]) }}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")analytics = client.ads.analytics("Kx82LmQp", from: "2026-11-01", to: "2026-11-30")puts "Spend: #{analytics.summary[:spend]} #{analytics.currency}"analytics.daily.each do |day| puts "#{day[:date]}: #{day[:impressions]} impressions, #{day[:clicks]} clicks"enduse PostProxy\Client;
$client = new Client("YOUR_API_KEY");$analytics = $client->ads()->analytics("Kx82LmQp", from: "2026-11-01", to: "2026-11-30");echo "Spend: {$analytics->summary['spend']} {$analytics->currency}\n";foreach ($analytics->daily as $day) { echo "{$day['date']}: {$day['impressions']} impressions, {$day['clicks']} clicks\n";}import dev.postproxy.sdk.PostProxy;
var client = PostProxy.builder("YOUR_API_KEY").build();var analytics = client.ads().analytics("Kx82LmQp", "2026-11-01", "2026-11-30", null);System.out.println("Spend: " + analytics.summary().get("spend") + " " + analytics.currency());for (var day : analytics.daily()) { System.out.println(day.get("date") + ": " + day.get("impressions") + " impressions, " + day.get("clicks") + " clicks");}using PostProxy;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var analytics = await client.Ads.GetAnalyticsAsync("Kx82LmQp", from: "2026-11-01", to: "2026-11-30");Console.WriteLine($"Spend: {analytics.Summary?["spend"]} {analytics.Currency}");Console.WriteLine($"Days: {analytics.Daily.Count}");Response:
{ "id": "Kx82LmQp", "kind": "ad", "platform": "meta_ads", "platform_id": "305559959245942194", "currency": "USD", "range": { "from": "2026-11-01", "to": "2026-11-30" }, "summary": { "spend": 41.2, "impressions": 9120, "reach": 6400, "clicks": 180, "ctr": 1.97, "cpc": 0.23, "cpm": 4.52 }, "daily": [ { "date": "2026-11-16", "spend": 4.69, "impressions": 297, "reach": 251, "clicks": 9 }, { "date": "2026-11-17", "spend": 9.84, "impressions": 2190, "reach": 1764, "clicks": 44 }, { "date": "2026-11-18", "spend": 9.97, "impressions": 2308, "reach": 1812, "clicks": 47 } ], "breakdowns": {}, "unsupported_breakdowns": [], "cached": false}summary, each daily row and each breakdown row carry the metrics the network reports.
Insights
Section titled “Insights”GET /api/ads/insights
One live report across many objects of an ad account: one row per object per day.
Query parameters
Section titled “Query parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
level | string | Yes | account, campaign, ad_set, ad |
ids | string | One of | Up to 50 Postproxy IDs of that level, comma-separated, all in one ad account. Not with level=account |
ad_account_id | string | One of | Every object of that level in the ad account |
from, to | date | No | As in Analytics |
metrics | string | No | Comma-separated subset of the metric names. Default: all |
breakdowns | string | No | As in Analytics. Pinterest and TikTok take one breakdown per request |
page_token | string | No | From next_page_token |
Example
Section titled “Example”curl -X GET "https://api.postproxy.dev/api/ads/insights?level=campaign&ad_account_id=Yq7HnB&from=2026-11-01&to=2026-11-30" \ -H "Authorization: Bearer YOUR_API_KEY"import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const insights = await client.ads.insights({ level: "campaign", adAccountId: "Yq7HnB", from: "2026-11-01", to: "2026-11-30",});console.log(`Total spend: ${insights.totals.spend} ${insights.currency}`);for (const row of insights.data) { console.log(`${row.date} ${row.id}: ${row.spend}`);}from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")insights = await client.ads.insights( level="campaign", ad_account_id="Yq7HnB", from_="2026-11-01", to="2026-11-30",)print(f"Total spend: {insights.totals.get('spend')} {insights.currency}")for row in insights.data: print(f"{row['date']} {row['id']}: {row.get('spend')}")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") adAccountID, from, to := "Yq7HnB", "2026-11-01", "2026-11-30" insights, _ := client.Ads.Insights(context.Background(), postproxy.AdInsightsLevelCampaign, &postproxy.AdInsightsOptions{ AdAccountID: &adAccountID, From: &from, To: &to, }) fmt.Printf("Total spend: %v\n", insights.Totals["spend"]) for _, row := range insights.Data { fmt.Printf("%v %v: %v\n", row["date"], row["id"], row["spend"]) }}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")insights = client.ads.insights( level: "campaign", ad_account_id: "Yq7HnB", from: "2026-11-01", to: "2026-11-30")puts "Total spend: #{insights.totals[:spend]} #{insights.currency}"insights.data.each do |row| puts "#{row[:date]} #{row[:id]}: #{row[:spend]}"enduse PostProxy\Client;
$client = new Client("YOUR_API_KEY");$insights = $client->ads()->insights( "campaign", adAccountId: "Yq7HnB", from: "2026-11-01", to: "2026-11-30",);echo "Total spend: {$insights->totals['spend']} {$insights->currency}\n";foreach ($insights->data as $row) { echo "{$row['date']} {$row['id']}: {$row['spend']}\n";}import dev.postproxy.sdk.PostProxy;import dev.postproxy.sdk.model.AdInsightsLevel;import dev.postproxy.sdk.param.AdInsightsParams;
var client = PostProxy.builder("YOUR_API_KEY").build();var insights = client.ads().insights(AdInsightsParams.builder() .level(AdInsightsLevel.CAMPAIGN) .adAccountId("Yq7HnB") .from("2026-11-01") .to("2026-11-30") .build());System.out.println("Total spend: " + insights.totals().get("spend") + " " + insights.currency());using PostProxy;using PostProxy.Models;using PostProxy.Parameters;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var insights = await client.Ads.GetInsightsAsync(new AdInsightsParams{ Level = AdInsightsLevel.Campaign, AdAccountId = "Yq7HnB", From = "2026-11-01", To = "2026-11-30",});Console.WriteLine($"Total spend: {insights.Totals?["spend"]} {insights.Currency}");Console.WriteLine($"Rows: {insights.Data.Count}");Response:
{ "level": "campaign", "platform": "meta_ads", "ad_account_id": "Yq7HnB", "platform_ad_account_id": "12712117149", "currency": "USD", "range": { "from": "2026-11-01", "to": "2026-11-30" }, "totals": { "spend": 24.5, "impressions": 4795, "clicks": 100 }, "data": [ { "id": "c7RtY2Wn", "date": "2026-11-16", "platform_id": "534260176547215351", "currency": "USD", "spend": 4.69, "impressions": 297, "clicks": 9 }, { "id": "c7RtY2Wn", "date": "2026-11-17", "platform_id": "534260176547215351", "currency": "USD", "spend": 9.84, "impressions": 2190, "clicks": 44 }, { "id": "c7RtY2Wn", "date": "2026-11-18", "platform_id": "534260176547215351", "currency": "USD", "spend": 9.97, "impressions": 2308, "clicks": 47 } ], "unsupported_breakdowns": [], "next_page_token": null, "cached": false}A row’s id is null for an object that is not imported; platform_id is always present. totals cover the returned page.
Review
Section titled “Review”GET /api/ads/:id/review
Refetches the ad and returns its review state. Use it to see why an ad is not delivering.
{ "id": "K6mHNZ", "platform_id": "305559959245942194", "status": "rejected", "platform_status": "DISAPPROVED", "review": { "status": "rejected", "reasons": ["The ad's image contains too much text."] }, "issues": []}review.status is pending, approved or rejected. Google also returns approved_limited, with policy_topics.
Preview
Section titled “Preview”GET /api/ads/:id/preview
Renders an ad as it appears in a placement. Meta and Pinterest only; other networks return 501.
formats (Meta) is comma-separated, among DESKTOP_FEED_STANDARD (default), MOBILE_FEED_STANDARD, INSTAGRAM_STANDARD, INSTAGRAM_STORY, INSTAGRAM_REELS, FACEBOOK_STORY_MOBILE, FACEBOOK_REELS_MOBILE, RIGHT_COLUMN_STANDARD.
Returns { id, platform_id, previews: [{ format, body }], cached } where body is the network’s iframe HTML. Pinterest returns one preview with format: "PIN" and a url that stays valid for 7 days.
Search targeting
Section titled “Search targeting”GET /api/ads/search_targeting
Looks up targeting options on the network of an ads profile and returns the IDs to use in targeting.
| Parameter | Type | Required | Description |
|---|---|---|---|
profile_id | string | When several | The ads profile. Optional when exactly one ads profile is connected |
type | string | Yes | What to search, see the table below |
q | string | Mostly | Search text. On Meta it is optional for behavior, income, industry (lists all) and for location with location_type=region. For interest_suggestion, an interest name to get related ones |
location_type | string | No | Narrows a location search: country, country_group, region, city, subcity, neighborhood, zip, metro |
country_code, region_id | string | No | Narrow a location search |
limit | integer | No | Default 25, max 100 |
| Network | type values | location_type values |
|---|---|---|
| Meta | interest, interest_suggestion, behavior, income, industry, location, language, work_position, work_employer | All |
| Google Ads | location, language, topic (Display) | country, region, city, zip, metro |
location, interest, language (full list; q filters) | country (default), region, metro | |
| TikTok | location, interest, language (full list; q filters) | country (default), region, city |
{ "data": [ { "id": "6003139266461", "name": "Movies", "type": "interest", "path": ["Interests", "Entertainment", "Movies"], "audience_size_lower": 1200000000, "audience_size_upper": 1400000000 } ], "next_page_token": null, "cached": false}Location rows also carry country_code, region, region_id, supports_region and supports_city. Use id in targeting.interests, targeting.behaviors, targeting.languages, and as the key of a region or city on Meta.
Browse targeting
Section titled “Browse targeting”GET /api/ads/browse_targeting?ad_account_id=...
The network’s full detailed-targeting catalog for an ad account, in the same row shape as Search targeting. Meta only.
DSA recommendations
Section titled “DSA recommendations”GET /api/ads/dsa_recommendations?ad_account_id=...
Suggested values for dsa_beneficiary and dsa_payor, required for ads shown in the EU. Meta only.
{ "data": ["Acme Inc"], "count": 1, "cached": false }Ad object
Section titled “Ad object”Campaigns, ad sets and ads share one shape; kind tells them apart and fields that do not apply are left out.
{ "id": "K6mHNZ", "kind": "ad", "platform": "meta_ads", "platform_id": "305559959245942194", "profile_id": "OLUOa3o9E", "ad_account_id": "Yq7HnB", "platform_ad_account_id": "12712117149", "campaign_id": "Zk4HBg", "platform_campaign_id": "534260176547215351", "campaign_name": "Spring launch", "ad_set_id": "Zj1HQg", "platform_ad_set_id": "532339667291788965", "ad_set_name": "Spring launch", "name": "Spring launch", "status": "active", "platform_status": "ACTIVE", "configured_status": "ACTIVE", "source": "postproxy", "ad_type": "boost", "goal": { "type": "engagement", "title": "Get More Engagement" }, "platform_objective": "OUTCOME_ENGAGEMENT", "optimization_goal": "POST_ENGAGEMENT", "bid_strategy": "bid_cap", "bid_amount": 0.5, "budget": { "amount": 10.0, "type": "daily", "level": "ad_set", "currency": "USD", "remaining": 10.0 }, "schedule": { "start": "2026-11-16T14:11:41Z", "end": null }, "targeting": { "age_min": 21, "age_max": 45, "genders": "all", "locations": { "countries": ["US", "CA"] }, "interests": [{ "id": "6003139266461", "name": "Movies" }], "behaviors": [], "advantage_audience": 0 }, "creative": { "id": "148287159020790067", "type": "share" }, "review": { "status": "approved", "reasons": [] }, "preview_link": "https://fb.me/HutjLU9Ggi3P", "billing_event": "IMPRESSIONS", "post_id": "rDt5DM9aD", "post_profile_id": "E0fX7OYZR", "platform_post_id": "123_456", "metrics": { "spend": 0.65, "impressions": 700, "reach": 538, "clicks": 4 }, "platform_data": {}, "created_at": "2026-11-16T14:11:41.264Z", "platform_created_at": "2026-11-16T14:11:41.000Z", "updated_at": "2026-11-16T14:11:41.264Z", "synced_at": "2026-11-16T15:00:02.000Z"}| Field | Type | Description |
|---|---|---|
id | string | Postproxy ID |
kind | string | campaign, ad_set or ad |
platform | string | meta_ads, google_ads, pinterest_ads or tiktok_ads |
platform_id | string | The network’s ID |
profile_id | string | The ads profile |
ad_account_id, campaign_id, ad_set_id | string | null | Postproxy IDs of the parents. null when the parent is not imported |
platform_ad_account_id, platform_campaign_id, platform_ad_set_id | string | null | The network’s IDs of the parents |
campaign_name, ad_set_name, name | string | null | Names |
status | string | Normalised: active, pending_review, paused, rejected, error, completed, archived, deleted |
platform_status | string | The network’s effective status, as is |
configured_status | string | The on/off switch set on this object, as is |
source | string | postproxy (created through Postproxy) or platform (imported) |
ad_type | string | Ads only: boost or standalone |
goal | object | { type, title } |
budget | object | Present on the level that owns the budget, and on its ads |
schedule | object | { start, end } |
targeting, placements, call_to_action, creative | object | As the network returns them, normalised where the networks agree |
review | object | Ads only: { status, reasons } with status pending, approved, rejected (Google also approved_limited) |
issues | object[] | { code, summary, message } delivery issues |
post_id, post_profile_id, platform_post_id | string | null | The boosted post, when there is one |
metrics | object | See Metrics. Empty until the first sync with delivery |
platform_data | object | The network’s raw object |
created_at, platform_created_at, updated_at, synced_at | string | ISO 8601 timestamps |
Campaigns add buying_type, spend_cap and issues. Ad sets add learning_status, destination_type and placements. Network-specific keys are listed in the network sections.
Metrics
Section titled “Metrics”metrics on an object holds lifetime totals from the last sync (Pinterest: 90-day totals). Keys the network does not report are absent:
spend, impressions, reach, frequency, clicks, ctr, cpc, cpm, cpp, engagement, unique_clicks, unique_ctr, cost_per_unique_click, inline_link_clicks, cost_per_inline_link_click, outbound_clicks, cost_per_outbound_click, conversions, cost_per_conversion, conversion_value, roas, actions, video_plays, video_p25, video_p50, video_p75, video_p100, video_thruplays, cost_per_thruplay, currency.
Ad account fields
Section titled “Ad account fields”| Field | Type | Description |
|---|---|---|
id | string | Postproxy ID, the one every ads call takes |
platform_id | string | The network’s ID |
name, currency, timezone | string | |
status | string | active, restricted, disabled or closed |
platform | string | meta_ads, google_ads, pinterest_ads or tiktok_ads |
profile_id, profile_group_id | string | The ads profile and its profile group |
billing_status | string | ok, missing or unknown |
usable | boolean | Whether ads can be created on the account |
unusable_reason | string | null | Why not |
platform_data | object | The network’s raw object |
synced_at | string | ISO 8601 |
Each network adds its own keys, such as balance, amount_spent, spend_cap, minimum_daily_budget, funding_source and business on Meta. Money fields are in the ad account’s currency, in whole units.
Google Ads
Section titled “Google Ads”A Google Ads profile (platform: "google_ads") uses the same endpoints. What differs:
- Ad accounts. Every client account the login can reach is listed, including accounts reached through a manager account (
login_customer_idshows which manager). - IDs. An ad’s
platform_idis<ad group id>~<ad id>. Ads have no name. - Schedule times come back in the ad account’s time zone with no offset, such as
2026-11-27T12:18:05. Times you send may carry an offset; they are converted to the account’s time zone. - Not available (
501): boosting a post, previews,archive, DSA recommendations, targeting browse. Breakdowns are returned inunsupported_breakdowns. - Campaign types.
campaign_typeissearch(default),performance_maxordisplay. When an ad is attached to an existing campaign, the type is taken from that campaign. - Updates: campaign
name,status,budget,schedule,bidding; ad groupname,status,bid_amount(max CPC) and, for Display,targeting; asset groupname,status,creative; adstatusonly. - Changing the bid strategy:
PATCH /api/ads/campaigns/:idwithbidding: { strategy, target_cpa, target_roas, max_cpc }, the same object as at create;strategyis required and must be one the campaign’s type allows. - Shared budgets.
budget.sharedistruewhen the campaign’s budget is shared with other campaigns. Changing it changes it for all of them, so the update must say so:budget: { amount, shared: true }; without it the response is422. A shared budget is always a daily one. - Targeting search offers
type=location,type=languageandtype=topic. Location IDs go intotargeting.locations; language IDs into campaign targeting; topic IDs into a Display ad group’stargeting.topics.
Create a Search ad
Section titled “Create a Search ad”POST /api/ads
Creates the budget, campaign, ad group, keywords and a responsive search ad in one atomic call: if Google refuses any part, nothing is created.
| Parameter | Type | Required | Description |
|---|---|---|---|
ad_account_id | string | Yes | |
campaign_type | string | No | search (default) |
campaign_name, ad_set_name | string | No | |
final_url | string | Yes | Landing page |
headlines | string[] | Yes | 3 to 15, each up to 30 characters, unique |
descriptions | string[] | Yes | 2 to 4, each up to 90 characters, unique |
path1, path2 | string | No | Display path, up to 15 characters each; path2 needs path1 |
keywords | array | Yes* | { text, match_type, bid } or plain strings. match_type: exact, phrase, broad (default). Text up to 80 characters and 10 words |
negative_keywords | array | No | Same shape, added to the ad group |
budget | object | Yes* | { amount, type }, daily (default) or lifetime. A lifetime budget needs schedule.start and schedule.end |
bidding | object | No | { strategy, target_cpa, max_cpc }. strategy: maximize_clicks (default, optional max_cpc ceiling), manual_cpc (needs max_cpc), maximize_conversions, target_cpa (needs target_cpa) |
schedule | object | No | { start, end } ISO 8601, applied in the ad account’s time zone |
targeting | object | No | { locations: [ids], excluded_locations: [ids], location_targeting_type }. location_targeting_type: presence or presence_or_interest. languages is not accepted for Search |
network_settings | object | No | { search_partners, display_network }, both default false |
eu_political_advertising | boolean | No | Default false |
status | string | No | Status of the ad and campaign, active (default) or paused. campaign_status and ad_set_status override per level |
attach_to | object | No | { campaign_id } adds a new ad group and ad to a campaign; { campaign_id, ad_set_id } adds only the ad |
validate_only | boolean | No | Google validates the whole request and creates nothing |
* Not with attach_to: no budget with a campaign, no keywords with an ad group.
curl -X POST "https://api.postproxy.dev/api/ads" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "ad_account_id": "Gd3PqR7", "campaign_name": "Running shoes", "final_url": "https://example.com/shoes", "headlines": ["Running Shoes", "Free Shipping", "Shop the Sale"], "descriptions": ["Lightweight shoes for every runner.", "Order today, free returns."], "keywords": [{ "text": "running shoes", "match_type": "phrase" }], "budget": { "amount": 20 }, "bidding": { "strategy": "maximize_clicks", "max_cpc": 2 }, "targeting": { "locations": ["2840"] }, "status": "paused" }'POST /api/ads/campaigns creates a Search campaign alone (name, budget, and the campaign parameters above; paused by default). POST /api/ads/ad_sets creates an ad group in it: campaign_id, name, status, keywords, negative_keywords, bidding.max_cpc.
Campaign objects add campaign_type, bidding, network_settings, location_targeting_type and eu_political_advertising. Ads carry creative { headlines, descriptions, final_urls, path1, path2 } and review { status, reasons, policy_topics }.
Create a Performance Max campaign
Section titled “Create a Performance Max campaign”POST /api/ads
With campaign_type: "performance_max". Creates the budget, campaign, assets and one asset group in one atomic call. A Performance Max campaign has no ad groups or ads; its asset group is an ad set with ad_set_type: "asset_group". The response is the campaign (kind: "campaign") plus asset_group_id (that ad set’s ID) and platform_asset_group_id. Images are fetched from your URLs (GIF, JPG or PNG, up to 5120 KB each).
| Parameter | Type | Required | Description |
|---|---|---|---|
final_url | string | Yes | Landing page |
business_name | string | Yes | Up to 25 characters |
headlines | string[] | Yes | 3 to 15, each up to 30 characters |
long_headlines | string[] | Yes | 1 to 5, each up to 90 characters |
descriptions | string[] | Yes | 2 to 5, each up to 90 characters |
assets.marketing_images | string[] | Yes | 1 to 20 landscape images (1.91:1, at least 600x314) |
assets.square_marketing_images | string[] | Yes | 1 to 20 square images (at least 300x300) |
assets.logos | string[] | Yes | 1 to 5 square logos (at least 128x128) |
assets.portrait_marketing_images | string[] | No | Up to 20 portrait images (4:5) |
assets.landscape_logos | string[] | No | Up to 5 wide logos (4:1) |
assets.youtube_video_id | string | No | A YouTube video ID |
budget | object | Yes | As for Search |
bidding | object | No | strategy: maximize_conversions (default), target_cpa (needs target_cpa), maximize_conversion_value, target_roas (needs target_roas, a ratio such as 3.5) |
targeting.locations, targeting.excluded_locations | string[] | No | Location IDs from Search targeting |
ad_set_name | string | No | Name of the asset group |
validate_only | boolean | No | Google checks the whole request and creates nothing |
Not accepted: keywords, network_settings, attach_to. Google checks image proportions and refuses the whole call if one is off. The campaign can be paused, renamed, re-budgeted and re-bid.
Asset groups appear in GET /api/ads/ad_sets (filter with campaign_id), GET /api/ads/ad_sets/:id and the tree, with ad_set_type: "asset_group", a platform_id of the form asset_group~<id>, their own metrics and a creative: headlines, long_headlines, descriptions, business_name, images, youtube_video_ids, final_urls, link. Analytics, pause, resume and delete work as for any ad set.
PATCH /api/ads/ad_sets/:id on an asset group takes name, status and creative with any of final_url, business_name, headlines, long_headlines, descriptions and assets. Each field sent replaces all assets of that kind and must meet the counts and lengths of the create table; fields left out stay as they are. targeting and bid_amount return 501: a Performance Max campaign targets and bids at campaign level.
Create a Display ad
Section titled “Create a Display ad”POST /api/ads
With campaign_type: "display". Creates the budget, campaign, ad group, image assets and a responsive display ad in one atomic call, and returns the ad.
| Parameter | Type | Required | Description |
|---|---|---|---|
final_url | string | Yes | Landing page |
business_name | string | Yes | Up to 25 characters |
headlines | string[] | Yes | 1 to 5, each up to 30 characters |
long_headlines | string[] | Yes | Exactly 1, up to 90 characters |
descriptions | string[] | Yes | 1 to 5, each up to 90 characters |
assets.marketing_images | string[] | Yes | Landscape images (1.91:1, at least 600x314) |
assets.square_marketing_images | string[] | Yes | Square images (at least 300x300); at most 15 with the landscape ones |
assets.logos, assets.landscape_logos | string[] | No | Square (1:1) and wide (4:1) logos, at most 5 together |
assets.youtube_video_id | string | No | A YouTube video ID |
budget, bidding, targeting, schedule | As for Search | ||
targeting.placements | string[] | No | Websites the ads may show on, such as example.com or news.example.org/sport |
targeting.topics | string[] | No | Topic IDs from search_targeting?type=topic |
attach_to | object | No | { campaign_id } or { ad_set_id } of an existing Display campaign or ad group |
Not accepted: keywords, network_settings. An empty Display campaign and ad group can also be created with POST /api/ads/campaigns (campaign_type: "display") and POST /api/ads/ad_sets, which takes targeting.placements and targeting.topics too.
A Display ad group returns targeting { placements, topics: [{ id, name }] }. PATCH /api/ads/ad_sets/:id with targeting: { placements, topics } replaces the kinds it names and leaves the other alone; an empty list removes that kind.
Keywords
Section titled “Keywords”GET /api/ads/keywords
POST /api/ads/keywords
PATCH /api/ads/keywords/:id
DELETE /api/ads/keywords/:id
All keyword endpoints take ad_account_id. Keywords and negative keywords also work for Pinterest; the other keyword endpoints are Google Ads only (501 elsewhere).
| Operation | Parameters | Returns |
|---|---|---|
| List | campaign_id, ad_set_id, status (active, paused), from, to (default last 30 days) | { data: [keyword], range } |
| Add | ad_set_id, keywords: [{ text, match_type, bid }], up to 200 | 201 with { data: [{ id }] } |
| Update | status (active, paused) and / or bid (max CPC) | { id, updated, status, bid } |
| Remove | { deleted, id } |
A keyword row has id, text, match_type, status, bid, quality_score, campaign_id, platform_campaign_id, ad_set_id, platform_ad_set_id, review and metrics, with search_impression_share among the metrics. A keyword id is the network’s own, <ad group id>~<criterion id>: URL-encode it in paths.
curl -X POST "https://api.postproxy.dev/api/ads/keywords" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "ad_account_id": "Gd3PqR7", "ad_set_id": "s4HdN9Zv", "keywords": [ { "text": "running shoes", "match_type": "phrase" }, { "text": "trail running shoes", "match_type": "exact", "bid": 1.2 } ] }'import PostProxy from "postproxy-sdk";
const client = new PostProxy("YOUR_API_KEY");const keywords = await client.ads.keywords.create({ adAccountId: "Gd3PqR7", adSetId: "s4HdN9Zv", keywords: [ { text: "running shoes", match_type: "phrase" }, { text: "trail running shoes", match_type: "exact", bid: 1.2 }, ],});for (const keyword of keywords.data) { console.log(`Created keyword: ${keyword.id}`);}from postproxy import PostProxy
client = PostProxy("YOUR_API_KEY")keywords = await client.ads.keywords.create( ad_account_id="Gd3PqR7", ad_set_id="s4HdN9Zv", keywords=[ {"text": "running shoes", "match_type": "phrase"}, {"text": "trail running shoes", "match_type": "exact", "bid": 1.2}, ],)for keyword in keywords.data: print(f"Created keyword: {keyword.id}")package main
import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go")
func main() { client := postproxy.NewClient("YOUR_API_KEY") bid := 1.2 keywords, _ := client.Ads.Keywords.Create(context.Background(), "Gd3PqR7", "s4HdN9Zv", []postproxy.AdKeywordInput{ {Text: "running shoes", MatchType: postproxy.AdKeywordMatchTypePhrase}, {Text: "trail running shoes", MatchType: postproxy.AdKeywordMatchTypeExact, Bid: &bid}, }, nil) for _, keyword := range keywords.Data { fmt.Printf("Created keyword: %s\n", keyword.ID) }}require "postproxy"
client = PostProxy::Client.new("YOUR_API_KEY")keywords = client.ads.keywords.create( ad_account_id: "Gd3PqR7", ad_set_id: "s4HdN9Zv", keywords: [ { text: "running shoes", match_type: "phrase" }, { text: "trail running shoes", match_type: "exact", bid: 1.2 } ])keywords.data.each do |keyword| puts "Created keyword: #{keyword.id}"enduse PostProxy\Client;
$client = new Client("YOUR_API_KEY");$keywords = $client->ads()->keywords()->create("Gd3PqR7", "s4HdN9Zv", [ ["text" => "running shoes", "match_type" => "phrase"], ["text" => "trail running shoes", "match_type" => "exact", "bid" => 1.2],]);foreach ($keywords->data as $keyword) { echo "Created keyword: {$keyword->id}\n";}import dev.postproxy.sdk.PostProxy;import dev.postproxy.sdk.model.AdKeywordMatchType;import dev.postproxy.sdk.param.AdKeywordInput;import java.util.List;
var client = PostProxy.builder("YOUR_API_KEY").build();var keywords = client.ads().keywords().create("Gd3PqR7", "s4HdN9Zv", List.of( new AdKeywordInput("running shoes", AdKeywordMatchType.PHRASE, null), new AdKeywordInput("trail running shoes", AdKeywordMatchType.EXACT, 1.2)));for (var keyword : keywords.data()) { System.out.println("Created keyword: " + keyword.id());}using PostProxy;using PostProxy.Models;
var client = PostProxyClient.Builder("YOUR_API_KEY").Build();var keywords = await client.Ads.Keywords.CreateAsync("Gd3PqR7", "s4HdN9Zv",[ new AdKeywordInput { Text = "running shoes", MatchType = AdKeywordMatchType.Phrase }, new AdKeywordInput { Text = "trail running shoes", MatchType = AdKeywordMatchType.Exact, Bid = 1.2 },]);foreach (var keyword in keywords.Data){ Console.WriteLine($"Created keyword: {keyword.Id}");}Response (201 Created):
{ "data": [ { "id": "158834096621~301245790011" }, { "id": "158834096621~301245790012" } ]}Negative keywords
Section titled “Negative keywords”GET /api/ads/negative_keywords
POST /api/ads/negative_keywords
DELETE /api/ads/negative_keywords/:id
Pass campaign_id for campaign-level negatives or ad_set_id for ad-group-level ones. Add with keywords: [{ text, match_type }]. Rows are { id, level, text, match_type, campaign_id, ad_set_id }.
Search terms
Section titled “Search terms”GET /api/ads/search_terms
What people searched for before seeing an ad, with metrics: top 1000 by impressions. Takes ad_account_id, campaign_id and / or ad_set_id, from, to. Each row: term, status, campaign_id, platform_campaign_id, ad_set_id, platform_ad_set_id, metrics.
Keyword Planner
Section titled “Keyword Planner”POST /api/ads/generate_keyword_ideas
POST /api/ads/keyword_historical_metrics
Both create nothing. Ideas take ad_account_id, keywords (up to 20) and / or url, plus optional locations (IDs) and language (ID), and return up to 100 rows of text, avg_monthly_searches, competition, competition_index, low_bid, high_bid. Historical metrics take keywords and add monthly_searches: [{ year, month, searches }].
Campaign targeting
Section titled “Campaign targeting”GET /api/ads/campaigns/:id/targeting
PATCH /api/ads/campaigns/:id/targeting
{ "locations": ["2840"], "excluded_locations": [], "languages": ["1000"], "devices": [{ "device": "mobile", "bid_modifier": 1.2 }], "location_targeting_type": "presence"}Each list you send replaces that list; lists you leave out stay. device: mobile, desktop, tablet, connected_tv. bid_modifier is 0 to 10; 1 is no change.
Ad schedule
Section titled “Ad schedule”GET /api/ads/campaigns/:id/ad_schedule
PATCH /api/ads/campaigns/:id/ad_schedule
{ "schedule": [{ "day": "monday", "start": "09:00", "end": "17:30", "bid_modifier": 1.1 }] }PATCH replaces the whole schedule; minutes must be 00, 15, 30 or 45. An empty list runs the campaign at all hours. GET returns { data: [{ day, start, end, bid_modifier }] }.
Pinterest Ads
Section titled “Pinterest Ads”A Pinterest Ads profile (platform: "pinterest_ads") uses the same endpoints to promote Pins. What differs:
platform_post_idis the Pin ID. Every ad promotes a Pin, soad_typeisboostfor all Pinterest ads. Create an ad saves a public Pin to the board you name and promotes it.- The budget lives on the campaign.
budget.leveliscampaignand ad sets show no budget. Bid and targeting live on the ad set. - Ad accounts carry
country,owner,permissionsandtimezone.usableisfalsewhen the connection can only read the account (it needs the Owner, Admin or Campaign Manager role). metricson an object are 90-day totals, not lifetime.- Analytics and insights go back 914 days. A range inside the last 90 days, at most 90 days long, is answered straight away. An older or longer range is built by Pinterest as a report and may return
429withRetry-After: repeat the same request. Beyond 914 days the response is422. - Breakdowns cover the last 90 days only (
422further back), one per request on Insights. - Delete archives.
DELETEsets the object toarchived, and parents created with the ad are archived once empty. - Not available (
501):validate_only, budget changes addressed to an ad set or ad, creative edits, DSA recommendations, targeting browse. - Updates: campaign
name,status,budget,schedule; ad setname,status,bid_amount,targeting; adname,status.
Boost a Pin
Section titled “Boost a Pin”POST /api/ads/boost_post
Parameters as in Boost a post, with these differences:
| Parameter | Type | Required | Description |
|---|---|---|---|
platform_post_id | string | Instead of post_id | A Pin ID, for a Pin not published through Postproxy |
goal | string | No | traffic (default), awareness, video_views |
budget | object | Yes, unless attach_to | { amount, type }, type daily (default) or lifetime; a lifetime budget needs schedule.end. Set on the campaign |
bid_strategy | string | No | lowest_cost (default), bid_cap or cost_cap; the last two need bid_amount and are not available for video_views |
targeting.locations | object | Yes | Any of countries (ISO codes), metros, regions (such as US-CA), zips; regions and zips cannot be combined |
targeting.excluded_locations | object | No | Same shape |
targeting.genders | string | No | all (default), male, female |
targeting.age_min, targeting.age_max | integer | No | 18 to 65; 65 means 65 and over |
targeting.interests | string[] | No | Interest IDs from Search targeting |
targeting.languages | string[] | No | Locale codes from Search targeting, such as en-US |
targeting.user_device | string[] | No | android_mobile, android_tablet, ipad, iphone, web, web_mobile |
targeting.platform_targeting | object | No | Raw Pinterest targeting_spec keys, merged over the rest (audiences go here) |
call_to_action | object | No | { type, link }: a button label such as SHOP_NOW or LEARN_MORE, and a destination URL that overrides the Pin’s link |
platforms.pinterest_ads.placement_group | string | No | all (default), search, browse |
platforms.pinterest_ads.auto_targeting | boolean | No | Pinterest’s expanded targeting. Default true |
budget.level: "ad_set", special_ad_categories, tracking and the DSA fields are not accepted. With attach_to.campaign_id no budget is sent; with attach_to.ad_set_id no bid or targeting either.
curl -X POST "https://api.postproxy.dev/api/ads/boost_post" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "ad_account_id": "Pn5KdW2", "post_id": "abc123xyz", "status": "paused", "budget": { "amount": 25 }, "targeting": { "locations": { "countries": ["US"] }, "interests": ["935249274030"] } }'Create a Pinterest ad
Section titled “Create a Pinterest ad”POST /api/ads takes the boost parameters (no post_id) plus board_id (required, the board the Pin is saved to, from placements), link (required), headline, body and one of:
mediawith one image URL;mediawith one video URL (.mp4,.mov,.m4v), withplatforms.pinterest_ads.thumbnail_urlas the cover (the first frame is used without it). If Pinterest is still processing the video the response is429withRetry-After; repeat the same request;carousel_cards: 2 to 5 cards{ media, headline, description, link }with image URLs; a card withoutlinkuses the top-level one.
If Pinterest refuses the ad, the Pin is deleted and the campaign created by the call is archived.
Pinterest campaigns and ad sets
Section titled “Pinterest campaigns and ad sets”POST /api/ads/campaigns: name and budget are required, goal defaults to traffic, status to paused. Add ads with attach_to: { campaign_id }; the ad’s goal must match the campaign’s.
POST /api/ads/ad_sets creates an ad group in a campaign: campaign_id, name and targeting.locations are required; status, bid_strategy, bid_amount, targeting and platforms.pinterest_ads.placement_group / auto_targeting work as on boost. No budget and no goal: the campaign’s are used.
Pinterest keywords
Section titled “Pinterest keywords”The keyword endpoints work for Pinterest ad accounts too, with these differences:
GET /api/ads/keywordsneedsad_set_idorcampaign_id; rows areid,text,match_type,status,level,ad_set_id,platform_ad_set_id, without metrics. Use thekeywordbreakdown for performance.POST /api/ads/keywordstakesad_set_idandkeywords: [{ text, match_type }](broaddefault,phrase,exact; up to 120 characters). Nobid: Pinterest keywords use the ad set’s bid.GET/POST /api/ads/negative_keywordstakecampaign_idorad_set_id.DELETEarchives the keyword.PATCHreturns501.- Search terms, keyword ideas and historical metrics are Google Ads only.
TikTok Ads
Section titled “TikTok Ads”A TikTok Ads profile (platform: "tiktok_ads") uses the same endpoints. What differs:
- Budget, bid, schedule and targeting live on the ad set. A campaign can carry an optional overall budget.
- Boosting is a Spark Ad: the ad runs an existing TikTok post.
ad_typeisboostfor Spark Ads andstandalonefor ads built from an uploaded video. - Ads are video ads or image carousels. One or more image URLs make a carousel ad.
- Not available (
501):validate_only,archive, previews, schedule changes on a campaign, DSA recommendations, targeting browse. - Updates: campaign
name,status,budget; ad setname,status,budget,bid_amount,targeting,schedule; adname,status. - Breakdowns are one per request on Insights. Breakdown rows carry spend, impressions, clicks and conversions only.
List TikTok identities
Section titled “List TikTok identities”GET /api/ads/ad_accounts/:ad_account_id/identities
The TikTok accounts and custom identities an ad can run as. Use id and type as platforms.tiktok_ads.identity_id and identity_type. Other networks return 501.
{ "data": [ { "id": "7301234567890123456", "type": "TT_USER", "name": "acme" }, { "id": "7309876543210987654", "type": "CUSTOMIZED_USER", "name": "Acme Store" } ]}Boost a TikTok post
Section titled “Boost a TikTok post”POST /api/ads/boost_post
Parameters as in Boost a post, with these differences:
| Parameter | Type | Required | Description |
|---|---|---|---|
platform_post_id | string | Instead of post_id | A TikTok post ID |
goal | string | No | video_views (default), traffic, awareness, engagement (followers). traffic needs call_to_action.link |
budget | object | Yes | { amount, type }, type daily (default) or lifetime; a lifetime budget needs schedule.end. level must be ad_set if sent |
bid_strategy | string | No | lowest_cost (default) or bid_cap with bid_amount |
targeting.locations | array | Yes | ISO country codes and / or location IDs from Search targeting |
targeting.genders | string | No | all (default), male, female |
targeting.age_min, targeting.age_max | integer | No | 13 to 100; mapped to TikTok’s age groups (13-17, 18-24, 25-34, 35-44, 45-54, 55+) |
targeting.interests | string[] | No | Interest category IDs from Search targeting |
targeting.languages | string[] | No | Language codes from Search targeting |
targeting.user_os | string[] | No | android, ios |
targeting.platform_targeting | object | No | Raw TikTok ad group fields, merged over the rest |
call_to_action | object | No | { type, link }, type such as LEARN_MORE or SHOP_NOW |
platforms.tiktok_ads.identity_id | string | No | The TikTok identity that owns the post |
platforms.tiktok_ads.identity_type | string | No | TT_USER (default), BC_AUTH_TT or AUTH_CODE |
platforms.tiktok_ads.auth_code | string | No | A Spark Ads authorization code generated for the post in the TikTok app; replaces the identity |
platforms.tiktok_ads.authorization_days | integer | No | 7, 30 (default), 60, 180 or 365 |
TikTok needs to know which TikTok account owns the post. It is taken from auth_code, then identity_id, then the TikTok accounts linked to the ad account. If none of those settles it and the post was published through a TikTok Business profile on Postproxy, the post is authorized for ads automatically, for authorization_days. Otherwise the call returns 422 and lists the linked accounts.
Create a TikTok ad
Section titled “Create a TikTok ad”POST /api/ads takes the boost parameters (no post_id; goal defaults to traffic) plus:
| Parameter | Type | Required | Description |
|---|---|---|---|
media | string[] | Yes | One video URL, or several image URLs for a carousel. A video and images cannot be mixed |
carousel_cards | object[] | No | Alternative to media for a carousel: [{ media }], up to 35. Cards carry no text or link of their own |
body | string | No | The ad text, up to 100 characters |
link | string | No | Destination URL |
platforms.tiktok_ads.identity_id | string | Yes | From List TikTok identities. identity_type defaults to CUSTOMIZED_USER |
platforms.tiktok_ads.thumbnail_url | string | No | Cover image. TikTok’s own cover of the video is used when it is left out |
platforms.tiktok_ads.music_id | string | With a carousel | The track played with the carousel: a song_clip_id from TikTok trending music |
TikTok campaigns and ad sets
Section titled “TikTok campaigns and ad sets”POST /api/ads/campaigns: name (required), goal (default traffic), status (default paused), optional budget { amount, type } as the campaign’s overall budget.
POST /api/ads/ad_sets creates an ad group in a campaign: campaign_id, name, budget and targeting.locations are required; status, bid_strategy, bid_amount, schedule and targeting work as on boost. The campaign’s goal is used.
Webhooks
Section titled “Webhooks”Subscribe through the Webhooks API. Events come from writes made through Postproxy and from changes found on the network.
| Event | When |
|---|---|
ad.created, ad_set.created, campaign.created | Created through Postproxy, or first seen on the network after the initial import |
ad.updated, ad_set.updated, campaign.updated | Name, budget, bid, schedule, targeting or creative changed. changes lists which |
ad.status_changed, ad_set.status_changed, campaign.status_changed | status changed. previous_status carries the old value |
ad.approved, ad.rejected | Review outcome changed |
ad.delivery_issue | status became error |
ad.deleted | status became deleted |
ad_account.status_changed | Ad account status changed, or the account is no longer reachable (removed). Carries previous_status |
ad_account.synced | First import finished. Carries sync: { campaigns, ad_sets, ads } |
ad_account.sync_failed | A sync failed. Carries error: { category, message } with category token_invalid, permission_denied, rate_limited or sync_error |
ad_account.spend_synced | Once a day per ad account. Carries spend: { date, amount, currency } for the previous UTC day |
The payload is the ad object without platform_data (ad, ad set and campaign events) or the ad account without platform_data (ad account events), plus the extra keys above. The first import of an ad account sends only ad_account.synced.
Errors
Section titled “Errors”| Status | When |
|---|---|
400 | Invalid or missing parameter |
403 | The ads connection lacks permission for the ad account or post |
403 | Ad limit reached: the Free plan creates 2 ads in total through POST /api/ads and POST /api/ads/boost_post. Sandbox ads are not counted; reads, updates and ads created on the network are not limited |
404 | Unknown profile, ad account, post or object |
422 | The network rejected the request, the post cannot be boosted, or the ads profile needs reconnecting |
429 | The network is rate limiting, or a report is still being built; retry after the Retry-After header |
501 | The network has no equivalent for this operation or field |
502 | The network could not be reached; retry in a moment |
503 | The API is temporarily unavailable; retry after the Retry-After header |
With several ads profiles connected and no ad_account_id or profile_id in the request, the call returns 400: pass profile_id. With no ads profile connected it returns 422.