Replace an ad account’s spend policy with PUT /api/v1/ads/accounts/{accountId}/spend-policy. Requires a signed-in workspace owner, in the web app or the CLI; API keys are not accepted and MCP cannot call it.
Request
Send every cap and the current expectedRevision. Caps use the account currency; a monthly cap is required before the first activation. A stale revision returns AdRevisionConflict.
| Parameter | In | Type | Required |
|---|---|---|---|
accountId |
path | UUID | Yes |
workspaceId |
query | UUID | Yes |
| Body field | Type | Required |
|---|---|---|
expectedRevision |
integer | Yes |
monthlyCap |
Money or null | Yes |
dailyCap |
Money or null | Yes |
maxCampaignDailyBudget |
Money or null | Yes |
maxCampaignLifetimeBudget |
Money or null | Yes |
Response
- HTTP 200:
AdSpendPolicywithaccountId,currency,configured,monthlyCap,dailyCap,maxCampaignDailyBudget,maxCampaignLifetimeBudget,killSwitchActive,killSwitchAt,killSwitchReason,revision,updatedAt.
The OpenAPI document has each field’s type.
Examples
const policy = await workspace.ads.updateSpendPolicy(accountId, {
expectedRevision: 1,
monthlyCap: { amountMinor: 100000, currency: "USD" },
dailyCap: { amountMinor: 5000, currency: "USD" },
maxCampaignDailyBudget: null,
maxCampaignLifetimeBudget: null,
});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 PUT "https://pubnio.com/api/v1/ads/accounts/$ACCOUNT_ID/spend-policy?workspaceId=$WORKSPACE_ID" \
-H "Authorization: Bearer $PUBNIO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"expectedRevision":1,"monthlyCap":{"amountMinor":100000,"currency":"USD"},"dailyCap":{"amountMinor":5000,"currency":"USD"},"maxCampaignDailyBudget":null,"maxCampaignLifetimeBudget":null}'pnio ads update-spend-policy "$ACCOUNT_ID" --expected-revision 1 --file spend-policy.jsonasync () => {
const accountId = "<accountId>";
const response = await codemode.request({
method: "PUT",
path: `/api/v1/ads/accounts/${accountId}/spend-policy`,
query: { workspaceId: codemode.workspaceId },
body: {
expectedRevision: 1,
monthlyCap: { amountMinor: 100000, currency: "USD" },
dailyCap: { amountMinor: 5000, currency: "USD" },
maxCampaignDailyBudget: null,
maxCampaignLifetimeBudget: null,
},
});
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. The required expectedRevision makes a stale retry fail instead of applying twice.
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.