Skip to main content

FastCF

from fastcore.utils import *
from fastcflare import *

Intro to Account Tokens

Account-owned API tokens (created via /accounts/{id}/tokens) are tied to the account, not a specific user. They act as service principals — ideal for CI/CD pipelines and service-to-service integrations, since they remain valid even if the creating user leaves the organisation.

Creating Account Tokens

You need a token with “Create Additional Tokens” permission at the account level. Use the Cloudflare Python SDK with the Global API Key + email (not a user token):

from cloudflare import Cloudflare
cf = Cloudflare(api_token=your_cf_token, api_email='you@example.com')
accts = cf.accounts.list()
acct_id = accts.result[0].id

Look up available permission groups for your account:

groups = cf.accounts.tokens.permission_groups.list(account_id=acct_id)
{g.name: g.id for g in groups if 'dns' in g.name.lower() or 'zone' in g.name.lower()}

Create the token with nested resource format — zones must be nested under the account:

tok = cf.accounts.tokens.create(account_id=acct_id, name="dns-all-zones", policies=[{
    "effect": "allow",
    "resources": {f"com.cloudflare.api.account.{acct_id}": {"com.cloudflare.api.account.zone.*": "*"}},
    "permission_groups": [
        {"id": "c8fed203ed3043cba015a93ad1616f1f"},  # Zone Read
        ...
    ]
}])
dns_tok = tok.value  # Save this — it's only shown once

⚠️ The resource format {"com.cloudflare.api.account.zone.*": "*"} (without nesting) will fail with: “Must specify a zone for account owned tokens, or nest zone under specific account resource”

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastcflare-0.0.5.tar.gz (170.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastcflare-0.0.5-py3-none-any.whl (172.2 kB view details)

Uploaded Python 3

File details

Details for the file fastcflare-0.0.5.tar.gz.

File metadata

  • Download URL: fastcflare-0.0.5.tar.gz
  • Upload date:
  • Size: 170.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for fastcflare-0.0.5.tar.gz
Algorithm Hash digest
SHA256 b515ea54e8d1d3e9c34038e34909ef1554b1641c38685ca45812ec1a46472ff3
MD5 9ae09fa3e108dcff8793fdef04b33b38
BLAKE2b-256 d2ee3f0c63db8e441d93749d4b6e764c1e75eedde095d54580218f93e3139647

See more details on using hashes here.

File details

Details for the file fastcflare-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: fastcflare-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 172.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for fastcflare-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d99cfe3b9f72ed1e830b3e63564f02eedcdde09815378a839bcab1cc76b6b24b
MD5 686dc973c0957a1e6167514a2ffb22be
BLAKE2b-256 3d8ec0d26a830667567a8f503e7ad5bfc3d8a0514f5eef171c08b8ecf5b62e1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page