Skip to content

Update monthly spend cap

PubNio API billing.spendControls.update: update monthly spend cap. Request fields, examples in five clients, errors, and idempotency.

Update monthly spend cap with PATCH /api/v1/workspaces/{workspaceId}/billing/spend-controls. Requires a signed-in workspace owner, in the web app or the CLI; API keys are not accepted and MCP cannot call it.

Request

Parameter In Type Required
workspaceId path UUID Yes
Body field Type Required
version integer Yes
monthlySpendCapMicros integer or null Yes

Response

  • HTTP 200: WorkspaceBilling with workspaceId, plan, status, paymentStatus, interval, gateway, periodStart, periodEnd, cancelAtPeriodEnd, creditBalanceMicros, creditBalance, spendControls, currentPeriod.
    • plan: payg, pro, platform, enterprise
    • status: active, trialing, past_due, canceled, incomplete, unpaid
    • paymentStatus: ok, payment_required, insufficient_credit, spend_cap_reached
    • gateway: fake, stripe

The OpenAPI document has each field’s type.

Examples

const billing = await workspace.billing.updateSpendControls({
  version: 4,
  monthlySpendCapMicros: 50000000,
});

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 PATCH "https://pubnio.com/api/v1/workspaces/$WORKSPACE_ID/billing/spend-controls" \
  -H "Authorization: Bearer $PUBNIO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"version":4,"monthlySpendCapMicros":50000000}'
pnio billing spend-cap --version 4 --file spend-controls.json
async () => {
  const response = await codemode.request({
    method: "PATCH",
    path: `/api/v1/workspaces/${codemode.workspaceId}/billing/spend-controls`,
    body: { version: 4, monthlySpendCapMicros: 50000000 },
  });
  return response.data;
};

Errors

It also declares the problems most operations declare.

Idempotency

No key. The required version 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 login or in the web app.

Type to search…

↑↓ navigate↵ selectEsc close