Queue an ad insight refresh with POST /api/v1/ads/accounts/{accountId}/insights/refresh. Requires an API key with the ads_manage scope or a signed-in workspace owner.
Request
Owner or ads_manage key. Marks the account’s campaign and insight cursors due now and returns 202. Rate limited per account. No provider call happens during the request.
| Parameter | In | Type | Required |
|---|---|---|---|
accountId |
path | UUID | Yes |
workspaceId |
query | UUID | Yes |
Response
- HTTP 202:
AdRefreshAcceptedwithaccountId,queuedScopes,nextDueAt,retryAfterSeconds.
The OpenAPI document has each field’s type.
Examples
const accepted = await workspace.ads.refresh(accountId);accepted = workspace.ads.refresh_insights(account_id)curl -X POST "https://pubnio.com/api/v1/ads/accounts/$ACCOUNT_ID/insights/refresh?workspaceId=$WORKSPACE_ID" \
-H "Authorization: Bearer $PUBNIO_API_KEY"pnio ads refresh-insights "$ACCOUNT_ID"async () => {
const accountId = "<accountId>";
const response = await codemode.request({
method: "POST",
path: `/api/v1/ads/accounts/${accountId}/insights/refresh`,
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
No key, so a retried POST is not deduplicated. Read the current state before you retry.
Rate limits
One refresh per ad account per minute. An earlier refresh inside that minute returns ad-refresh-rate-limited (HTTP 429) with retryAfterSeconds.
Limits
- Field lengths and ranges are in the OpenAPI document.