Start an ad account OAuth connection with POST /api/v1/ads/accounts/connect. Requires a signed-in workspace owner, in the web app or the CLI; API keys are not accepted and MCP cannot call it.
Request
Open the returned URL as the same PubNio user. Check the shared attempt route for the result, then select discovered accounts explicitly.
| Body field | Type | Required |
|---|---|---|
workspaceId |
UUID | Yes |
provider |
one of 9 strings | Yes |
accountId |
UUID | No |
Response
- HTTP 200:
AdConnectLaunchwithattemptId,provider,url,status.provider:meta_ads,google_ads,reddit_ads,pinterest_ads,tiktok_ads,linkedin_ads,snapchat_ads,amazon_ads,openai_ads
The OpenAPI document has each field’s type.
Examples
const launch = await workspace.ads.connect({
workspaceId: workspace.workspaceId,
provider: "meta_ads",
});Create this client with a signed-in person’s accessToken, not an apiKey.
The Python SDK authenticates with a workspace API key, which this operation does not accept, so it has no method for it.
curl -X POST "https://pubnio.com/api/v1/ads/accounts/connect" \
-H "Authorization: Bearer $PUBNIO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"workspaceId":"'"$WORKSPACE_ID"'","provider":"meta_ads"}'pnio ads connect-account --workspace-id "$WORKSPACE_ID" --provider meta_adsasync () => {
const response = await codemode.request({
method: "POST",
path: "/api/v1/ads/accounts/connect",
body: { workspaceId: codemode.workspaceId, provider: "meta_ads" },
});
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.
Limits
- API keys and MCP cannot call it. A signed-in person runs it from the CLI after
pnio auth loginor in the web app.