- Manual setup
- Terraform
1
Create an API token
In Cloudflare Dashboard > My Profile > API Tokens, create a token. Permission: Account / Billing / Read, scoped to this account. Copy the token immediately. It is shown once. Global API keys and Origin CA keys will not work.
2
Copy the Account ID
Copy the Account ID from the dashboard Overview page (right-hand sidebar) or from the URL (
/accounts/<account-id>/...). It is 32 hex characters.3
Connect in Costory
Go to Integrations, click + Add integration, then choose Cloudflare under Billing. The connect URL is
/integration/new/cloudflare/billing. 4
Enter connection details
Fill Connection name (default Cloudflare), API token, and Account ID. Start date is optional. Leave it empty to use Costory’s default lookback.
5
Validate, then save
Click Validate. Costory calls
GET /client/v4/accounts/<account-id>/billing-usage/info with Authorization: Bearer. Save stays disabled until the token can read PayGo billing for that account. If this is the only billing source and it is demo data, Costory asks you to confirm before replacing it.Field reference
What Costory includes
Costory pulls PayGo billable usage from Cloudflare’s usage API and maps it into Standard Columns. Typical lines include usage for PayGo products on that account (Workers, R2, and other products Cloudflare returns on the usage API). How to analyze Cloudflare costs- Spend by product: group by Service name or SKU
- Spend over time: use the same date presets as other billing sources in Explorer
- Enterprise contract invoices and committed-use billing (not on the public PayGo API)
- Taxes, credits, or invoice adjustments outside the usage API
- Zone-level analytics that are not billed on PayGo usage
Rotate the API token from Integrations when you need a new credential. The Account ID stays the same.
Troubleshooting
Related pages
Billing Data
All billing providers and shared setup notes.
Explorer
Filter and group Cloudflare spend with the rest of your stack.
Standard Columns
Normalized cost fields across providers.
Scaleway billing
Import Scaleway consumption the same way.
