Update Spend Policy
PUT/accounts/{account_id}/billing/spend-policies/{policy_id}
Replaces the whole spend policy. Every field is required, as on create; there are no partial updates and PATCH is not supported. The If-Match header must equal the policy’s current version. On success, version goes up by one and the new value is returned in ETag.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Path Parameters
Body ParametersJSON
Update Spend Policy
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/billing/spend-policies/$POLICY_ID \
-X PUT \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{
"action": "notification",
"enabled": true,
"name": "Workers cap",
"product_id": "workers",
"threshold_cents": 100,
"notification_email": "billing@example.com"
}'{
"errors": [
{
"message": "message",
"code": 0
}
],
"messages": [
{
"message": "message",
"code": 0
}
],
"result": {
"id": "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d",
"account_id": 1234567,
"action": "notification",
"enabled": true,
"name": "Workers cap",
"notification_email": "billing@example.com",
"product_id": "workers",
"threshold_cents": 100,
"version": 1,
"current_state": {
"balance_cents": 0,
"billing_period_end": "2019-12-27T18:11:19.117Z",
"billing_period_start": "2019-12-27T18:11:19.117Z",
"enforcement": {
"applied_generation": 0,
"delivery_status": "pending",
"desired_generation": 0,
"desired_state": "active",
"expires_at": "2019-12-27T18:11:19.117Z"
},
"evaluated_at": "2019-12-27T18:11:19.117Z",
"status": "disabled"
}
},
"success": true
}Returns Examples
{
"errors": [
{
"message": "message",
"code": 0
}
],
"messages": [
{
"message": "message",
"code": 0
}
],
"result": {
"id": "6f1c2b8e-3d4a-4f5b-9c6d-7e8f9a0b1c2d",
"account_id": 1234567,
"action": "notification",
"enabled": true,
"name": "Workers cap",
"notification_email": "billing@example.com",
"product_id": "workers",
"threshold_cents": 100,
"version": 1,
"current_state": {
"balance_cents": 0,
"billing_period_end": "2019-12-27T18:11:19.117Z",
"billing_period_start": "2019-12-27T18:11:19.117Z",
"enforcement": {
"applied_generation": 0,
"delivery_status": "pending",
"desired_generation": 0,
"desired_state": "active",
"expires_at": "2019-12-27T18:11:19.117Z"
},
"evaluated_at": "2019-12-27T18:11:19.117Z",
"status": "disabled"
}
},
"success": true
}