---
title: "Queue an ad insight refresh"
description: "PubNio API ads.refreshInsights: queue an ad insight refresh. Request fields, examples in five clients, errors, and idempotency."
---

> Documentation Index
> Fetch the complete documentation index at: https://pubnio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Queue an ad insight refresh

Queue an ad insight refresh with [`POST /api/v1/ads/accounts/{accountId}/insights/refresh`](https://pubnio.com/api/v1/docs#tag/ads/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: `AdRefreshAccepted` with `accountId`, `queuedScopes`, `nextDueAt`, `retryAfterSeconds`.

The [OpenAPI document](https://pubnio.com/api/v1/openapi) has each field's type.

## Examples

### TypeScript

```ts
const accepted = await workspace.ads.refresh(accountId);
```

### Python

```python
accepted = workspace.ads.refresh_insights(account_id)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/ads/accounts/$ACCOUNT_ID/insights/refresh?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY"
```

### CLI

```sh
pnio ads refresh-insights "$ACCOUNT_ID"
```

### MCP execute

```js
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](https://pubnio.com/docs/reference/#ads) and [most operations](https://pubnio.com/docs/reference/#shared-problems) 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](https://pubnio.com/api/v1/openapi).

## Related

- [Ads operations](https://pubnio.com/docs/reference/#ads)

Source: https://pubnio.com/docs/reference/ads-refresh-insights/index.mdx
