---
title: "Select a discovered ad account"
description: "PubNio API ads.selectAccount: select a discovered ad account. 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.

# Select a discovered ad account

Select a discovered ad account with [`POST /api/v1/ads/accounts/{accountId}/select`](https://pubnio.com/api/v1/docs#tag/ads/POST/api/v1/ads/accounts/{accountId}/select). Requires a signed-in workspace owner, in the web app or the CLI; API keys are not accepted and MCP cannot call it.

## Request

Selection starts campaign and insight sync. Reconnect preserves this PubNio account ID.

| Parameter     | In    | Type | Required |
| ------------- | ----- | ---- | -------- |
| `accountId`   | path  | UUID | Yes      |
| `workspaceId` | query | UUID | Yes      |

## Response

- HTTP 200: `AdAccountSelection` with `accountId`, `selected`, `campaignSyncQueued`, `insightSyncQueued`.

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

## Examples

### TypeScript

```ts
const selection = await workspace.ads.select(accountId);
```

Create this client with a signed-in person's `accessToken`, not an `apiKey`.

### Python

The Python SDK authenticates with a workspace API key, which this operation does not accept, so it has no method for it.

### cURL

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

### CLI

```sh
pnio ads select-account "$ACCOUNT_ID"
```

### MCP execute

```js
async () => {
  const accountId = "<accountId>";
  const response = await codemode.request({
    method: "POST",
    path: `/api/v1/ads/accounts/${accountId}/select`,
    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.

## Limits

- API keys and MCP cannot call it. A signed-in person runs it from the CLI after `pnio auth login` or in the web app.

## Related

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

Source: https://pubnio.com/docs/reference/ads-select-account/index.mdx
