Spend Policies
List Spend Policies
Create Spend Policy
Get Spend Policy
Update Spend Policy
Delete Spend Policy
ModelsExpand Collapse
SpendPolicyListResponse object { id, account_id, action, 7 more } A spend policy.
A spend policy.
Internal numeric ID of the account that owns the policy. This is not the account tag used in the path.
action: "notification" or "usage_block"The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
Email address that receives notifications. An empty string when none is set.
product_id: "workers" or "durable_objects"The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
Optimistic-concurrency version. It starts at 1 and goes up by one on every update or delete. This value is also returned in ETag.
current_state: optional object { balance_cents, billing_period_end, billing_period_start, 3 more } Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
enforcement: object { applied_generation, delivery_status, desired_generation, 2 more } Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
status: "disabled" or "no_current_period" or "unavailable" or 3 moreThreshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
Threshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
SpendPolicyCreateResponse object { id, account_id, action, 7 more } A spend policy.
A spend policy.
Internal numeric ID of the account that owns the policy. This is not the account tag used in the path.
action: "notification" or "usage_block"The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
Email address that receives notifications. An empty string when none is set.
product_id: "workers" or "durable_objects"The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
Optimistic-concurrency version. It starts at 1 and goes up by one on every update or delete. This value is also returned in ETag.
current_state: optional object { balance_cents, billing_period_end, billing_period_start, 3 more } Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
enforcement: object { applied_generation, delivery_status, desired_generation, 2 more } Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
status: "disabled" or "no_current_period" or "unavailable" or 3 moreThreshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
Threshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
SpendPolicyGetResponse object { id, account_id, action, 7 more } A spend policy.
A spend policy.
Internal numeric ID of the account that owns the policy. This is not the account tag used in the path.
action: "notification" or "usage_block"The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
Email address that receives notifications. An empty string when none is set.
product_id: "workers" or "durable_objects"The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
Optimistic-concurrency version. It starts at 1 and goes up by one on every update or delete. This value is also returned in ETag.
current_state: optional object { balance_cents, billing_period_end, billing_period_start, 3 more } Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
enforcement: object { applied_generation, delivery_status, desired_generation, 2 more } Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
status: "disabled" or "no_current_period" or "unavailable" or 3 moreThreshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
Threshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
SpendPolicyUpdateResponse object { id, account_id, action, 7 more } A spend policy.
A spend policy.
Internal numeric ID of the account that owns the policy. This is not the account tag used in the path.
action: "notification" or "usage_block"The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
Email address that receives notifications. An empty string when none is set.
product_id: "workers" or "durable_objects"The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
Optimistic-concurrency version. It starts at 1 and goes up by one on every update or delete. This value is also returned in ETag.
current_state: optional object { balance_cents, billing_period_end, billing_period_start, 3 more } Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
enforcement: object { applied_generation, delivery_status, desired_generation, 2 more } Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
status: "disabled" or "no_current_period" or "unavailable" or 3 moreThreshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
Threshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
Spend PoliciesAudit
List Spend Policy Audit Entries
ModelsExpand Collapse
AuditListResponse object { action, balance_cents, billing_period_end, 7 more } A state transition recorded when the policy was evaluated against the account’s balance.
A state transition recorded when the policy was evaluated against the account’s balance.
action: "notification" or "usage_block"The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
The account’s balance for the product at evaluation time, in US cents.
Inclusive start of the billing period that was evaluated.
source: "kafka" or "policy_revision"What caused the evaluation. kafka means a balance update. policy_revision means a change to the policy.
What caused the evaluation. kafka means a balance update. policy_revision means a change to the policy.
Spend PoliciesActivity
List Spend Policy Activity
ModelsExpand Collapse
ActivityListResponse object { id, action, actor, 5 more }
details: object { after, before }
after: optional object { id, account_id, action, 7 more } A spend policy.
A spend policy.
Internal numeric ID of the account that owns the policy. This is not the account tag used in the path.
action: "notification" or "usage_block"The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
Email address that receives notifications. An empty string when none is set.
product_id: "workers" or "durable_objects"The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
Optimistic-concurrency version. It starts at 1 and goes up by one on every update or delete. This value is also returned in ETag.
current_state: optional object { balance_cents, billing_period_end, billing_period_start, 3 more } Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
enforcement: object { applied_generation, delivery_status, desired_generation, 2 more } Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
status: "disabled" or "no_current_period" or "unavailable" or 3 moreThreshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
Threshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
before: optional object { id, account_id, action, 7 more } Prior configuration; null on creation or if a previous revision is unavailable.
Prior configuration; null on creation or if a previous revision is unavailable.
Internal numeric ID of the account that owns the policy. This is not the account tag used in the path.
action: "notification" or "usage_block"The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
The action taken when the threshold is reached. notification sends an email to notification_email. usage_block blocks further usage of the product until the end of the billing period. Raising the threshold above the current balance, disabling the policy, or deleting it lifts the block early.
Email address that receives notifications. An empty string when none is set.
product_id: "workers" or "durable_objects"The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
The product the policy applies to: workers or durable_objects. Each product’s balance and policies are separate. Both products support notification and usage_block policies on create and update.
Optimistic-concurrency version. It starts at 1 and goes up by one on every update or delete. This value is also returned in ETag.
current_state: optional object { balance_cents, billing_period_end, billing_period_start, 3 more } Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
Read-only state on list/get responses, evaluated from the latest owning projector snapshot at request time, independently of the API replica. Configuration enabled/version/ETag do not change when a cycle rolls over. Audit history remains unchanged. Missing during a rolling upgrade or on mutation responses; clients must treat missing state as unavailable. Balances are asynchronous estimates, not a synchronous usage read.
enforcement: object { applied_generation, delivery_status, desired_generation, 2 more } Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
Durable desired cap and delivery bookkeeping for this policy, or null if no owned effect exists. Separate from threshold evaluation: pending/leased/retry can lag the new billing period. Succeeded with equal generations means delivery completed, not an EWC readback.
status: "disabled" or "no_current_period" or "unavailable" or 3 moreThreshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.
Threshold evaluation, not proof of an edge cap. No current active period yields no_current_period for enabled policies; failed aggregate reads yield unavailable for enabled policies. Disabled policies report disabled. Neither no_current_period nor unavailable implies a zero balance or below-limit state. Operators may disable current-state reads, in which case current_state is omitted.