List Spend Policies
GET/accounts/{account_id}/billing/spend-policies
Returns every spend policy on the account that has not been deleted, including disabled ones. Results are sorted by name, then id. There is no pagination.
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:
List Spend Policies
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/billing/spend-policies \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"{
"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
}