{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"Creates a spend policy. Each account can have only one enabled `usage_block` policy per product. A second one returns `409`. There is no limit on `notification` policies.","properties":{"path":{"type":"object","properties":{"account_id":{"$ref":"#/definitions/billing-spend-policies_identifier","description":"Identifies the Cloudflare account (account tag)."}},"required":["account_id"],"additionalProperties":false},"body":{"$ref":"#/definitions/billing-spend-policies_policy_input","examples":[{"action":"notification","enabled":true,"name":"Durable Objects alert","notification_email":"billing@example.com","product_id":"durable_objects","threshold_cents":100}]}},"required":["path","body"],"additionalProperties":false,"definitions":{"billing-spend-policies_identifier":{"description":"Represents a Cloudflare resource identifier tag.","type":"string","maxLength":32,"pattern":"^[0-9a-f]{32}$","examples":["023e105f4ecef8ad9ca31a8372d0c353"]},"billing-spend-policies_policy_input":{"description":"A spend policy as sent on create and on full replacement. Unknown fields and trailing JSON are rejected. Only the first 1 MiB of the body is read.","type":"object","properties":{"action":{"$ref":"#/definitions/billing-spend-policies_policy_action"},"enabled":{"description":"Whether the policy is evaluated.","type":"boolean","examples":[true]},"name":{"description":"Display name of the policy. After surrounding whitespace is trimmed, it must be 1 to 200 bytes long. The value is stored as sent, untrimmed.","type":"string","minLength":1,"examples":["Workers cap"]},"notification_email":{"description":"Email address that receives notifications. Required when `action` is `notification`. When set, it must be a bare address (`user@example.com`); display-name forms such as `Name <user@example.com>` are rejected.","type":"string","format":"email","examples":["billing@example.com"]},"product_id":{"$ref":"#/definitions/billing-spend-policies_product_id"},"threshold_cents":{"description":"The spend threshold for the current billing period, in US cents. Must be greater than zero.","type":"integer","minimum":1,"examples":[100]}},"additionalProperties":false,"required":["name","product_id","enabled","threshold_cents","action"]},"billing-spend-policies_policy_action":{"description":"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.","type":"string","enum":["notification","usage_block"],"examples":["notification"]},"billing-spend-policies_product_id":{"description":"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.","type":"string","enum":["workers","durable_objects"],"examples":["workers"]}}},"name":"Create Spend Policy","id":"cloudflare.spend-policies-create","example":{"path":{"account_id":"023e105f4ecef8ad9ca31a8372d0c353"},"body":{"name":"Workers cap","product_id":"workers","enabled":true,"threshold_cents":100,"action":"notification"}},"maxRequests":1,"summary":false}}