Skip to content

Read a campaign, ad group, ad, and creative tree

PubNio API ads.getTree: read a campaign, ad group, ad, and creative tree. Request fields, examples in five clients, errors, and idempotency.

Read a campaign, ad group, ad, and creative tree with GET /api/v1/ads/tree. Requires an API key with the read scope or a signed-in workspace member.

Request

Optionally filter by account or campaign. Returns at most the requested number of campaigns.

Parameter In Type Required
workspaceId query UUID Yes
accountId query UUID No
campaignId query UUID No
cursor query string No
limit query string No

Response

  • HTTP 200: AdTree with data, hasMore, nextCursor, freshness.

The OpenAPI document has each field’s type.

Examples

const tree = await workspace.ads.tree({ campaignId });
tree = workspace.ads.get_tree()
curl "https://pubnio.com/api/v1/ads/tree?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY"
pnio ads get-tree --campaign-id "$CAMPAIGN_ID"
async () => {
  const response = await codemode.request({
    method: "GET",
    path: "/api/v1/ads/tree",
    query: { workspaceId: codemode.workspaceId },
  });
  return response.data;
};

Errors

It declares no problem of its own.

It declares the problems every Ads operation and most operations declare.

Idempotency

None needed: a read is safe to retry.

Limits

  • Up to 100 items a page; pass nextCursor back as cursor. See Pagination.

Type to search…

↑↓ navigate↵ selectEsc close