Connecting to Cloudflare
To authenticate to Cloudflare, you can use either API Key or API Token authentication. Use API Key authentication to connect to your own data with your account email and Global API Key. Use API Token authentication for more secure, granular access control.
Using Global API Key Authentication
To use Global API Key authentication, obtain your Global API Key from the Cloudflare dashboard under My Profile > API Tokens > API Keys section. Set your API Key, KeyType, and account email in ProfileSettings.
After setting the following connection properties, you are ready to connect:
- AuthScheme: Set this to APIKey.
- ProfileSettings: Set your APIKey, KeyType=Key, and APIEmail in ProfileSettings.
Example connection string
Profile=C:\profiles\Cloudflare.apip;ProfileSettings='APIKey=your_global_api_key;KeyType=Key;[email protected];';AuthScheme=APIKey;
Using API Token Authentication
To use API Token authentication, create an API Token from the Cloudflare dashboard under My Profile > API Tokens. Configure the token with the appropriate permissions for the resources you need to access. Set your API Token in ProfileSettings.
After setting the following connection properties, you are ready to connect:
- AuthScheme: Set this to APIKey.
- ProfileSettings: Set your APIKey (token) and KeyType=Token in ProfileSettings. APIEmail is not required for token authentication.
Example connection string
Profile=C:\profiles\Cloudflare.apip;ProfileSettings='APIKey=your_api_token;KeyType=Token;';AuthScheme=APIKey;
Usage Examples
The following examples demonstrate common SQL queries for accessing Cloudflare data through various tables:
AccessApplications:
SELECT * FROM AccessApplications WHERE AccountId = 'account123'
AccessGroups:
SELECT * FROM AccessGroups WHERE AccountId = 'account123'
AccessPolicies:
SELECT * FROM AccessPolicies WHERE AccountId = 'account123'
AccessServiceTokens:
SELECT * FROM AccessServiceTokens WHERE AccountId = 'account123'
AccountAuditLogs:
SELECT * FROM AccountAuditLogs WHERE AccountId = 'account123'
AccountMembers:
SELECT * FROM AccountMembers WHERE AccountId = 'account123'
AccountRoles:
SELECT * FROM AccountRoles WHERE AccountId = 'account123'
Accounts:
SELECT * FROM Accounts
AccountSubscriptions:
SELECT * FROM AccountSubscriptions WHERE AccountId = 'account123'
ApiGatewayOperations:
SELECT * FROM ApiGatewayOperations WHERE ZoneId = 'zone123'
Argo:
SELECT * FROM Argo WHERE ZoneId = 'zone123'
BotManagement:
SELECT * FROM BotManagement WHERE ZoneId = 'zone123'
CacheReserve:
SELECT * FROM CacheReserve WHERE ZoneId = 'zone123'
CacheVariants:
SELECT * FROM CacheVariants WHERE ZoneId = 'zone123'
ClientCertificates:
SELECT * FROM ClientCertificates WHERE ZoneId = 'zone123'
CloudflareTunnels:
SELECT * FROM CloudflareTunnels WHERE AccountId = 'account123'
CustomCertificates:
SELECT * FROM CustomCertificates WHERE ZoneId = 'zone123'
CustomHostnames:
SELECT * FROM CustomHostnames WHERE ZoneId = 'zone123'
D1Databases:
SELECT * FROM D1Databases WHERE AccountId = 'account123'
DnsAnalytics:
SELECT * FROM DnsAnalytics WHERE ZoneId = 'zone123'
DnsRecords:
SELECT * FROM DnsRecords WHERE ZoneId = 'zone123'
DnsSettings:
SELECT * FROM DnsSettings WHERE ZoneId = 'zone123'
Dnssec:
SELECT * FROM Dnssec WHERE ZoneId = 'zone123'
DurableObjects:
SELECT * FROM DurableObjects WHERE AccountId = 'account123' AND NamespaceId = 'namespace123'
DurableObjectsNamespaces:
SELECT * FROM DurableObjectsNamespaces WHERE AccountId = 'account123'
EmailRoutingAddresses:
SELECT * FROM EmailRoutingAddresses WHERE ZoneId = 'zone123'
EmailRoutingRules:
SELECT * FROM EmailRoutingRules WHERE ZoneId = 'zone123'
EmailRoutingSettings:
SELECT * FROM EmailRoutingSettings WHERE ZoneId = 'zone123'
FirewallAccessRules:
SELECT * FROM FirewallAccessRules WHERE ZoneId = 'zone123'
FirewallLockdowns:
SELECT * FROM FirewallLockdowns WHERE ZoneId = 'zone123'
FirewallUaRules:
SELECT * FROM FirewallUaRules WHERE ZoneId = 'zone123'
GatewayRules:
SELECT * FROM GatewayRules WHERE AccountId = 'account123'
Healthchecks:
SELECT * FROM Healthchecks WHERE ZoneId = 'zone123'
Hyperdrive:
SELECT * FROM Hyperdrive WHERE AccountId = 'account123'
ImageKeys:
SELECT * FROM ImageKeys WHERE AccountId = 'account123'
Images:
SELECT * FROM Images WHERE AccountId = 'account123'
ImageStats:
SELECT * FROM ImageStats WHERE AccountId = 'account123'
LogpushJobs:
SELECT * FROM LogpushJobs WHERE ZoneId = 'zone123'
MagicTransitGre:
SELECT * FROM MagicTransitGre WHERE AccountId = 'account123'
MagicTransitIpsec:
SELECT * FROM MagicTransitIpsec WHERE AccountId = 'account123'
NotificationPolicies:
SELECT * FROM NotificationPolicies WHERE AccountId = 'account123'
PageRules:
SELECT * FROM PageRules WHERE ZoneId = 'zone123'
PagesDeployments:
SELECT * FROM PagesDeployments WHERE AccountId = 'account123' AND ProjectName = 'project123'
PagesDomains:
SELECT * FROM PagesDomains WHERE AccountId = 'account123' AND ProjectName = 'project123'
PagesProjects:
SELECT * FROM PagesProjects WHERE AccountId = 'account123'
PageShield:
SELECT * FROM PageShield WHERE ZoneId = 'zone123'
PageShieldConnections:
SELECT * FROM PageShieldConnections WHERE ZoneId = 'zone123'
PageShieldCookies:
SELECT * FROM PageShieldCookies WHERE ZoneId = 'zone123'
PageShieldPolicies:
SELECT * FROM PageShieldPolicies WHERE ZoneId = 'zone123'
PageShieldScripts:
SELECT * FROM PageShieldScripts WHERE ZoneId = 'zone123'
QueueConsumers:
SELECT * FROM QueueConsumers WHERE AccountId = 'account123' AND QueueId = 'queue123'
Queues:
SELECT * FROM Queues WHERE AccountId = 'account123'
R2Buckets:
SELECT * FROM R2Buckets WHERE AccountId = 'account123'
RulesLists:
SELECT * FROM RulesLists WHERE AccountId = 'account123'
RulesListsItems:
SELECT * FROM RulesListsItems WHERE AccountId = 'account123' AND ListId = 'list123'
Rulesets:
SELECT * FROM Rulesets WHERE ZoneId = 'zone123'
RulesetVersions:
SELECT * FROM RulesetVersions WHERE ZoneId = 'zone123' AND RulesetId = 'ruleset123'
Spectrum:
SELECT * FROM Spectrum WHERE ZoneId = 'zone123'
StreamLiveInputs:
SELECT * FROM StreamLiveInputs WHERE AccountId = 'account123'
StreamStorageUsage:
SELECT * FROM StreamStorageUsage WHERE AccountId = 'account123'
StreamVideos:
SELECT * FROM StreamVideos WHERE AccountId = 'account123'
StreamWatermarks:
SELECT * FROM StreamWatermarks WHERE AccountId = 'account123'
TieredCache:
SELECT * FROM TieredCache WHERE ZoneId = 'zone123'
User:
SELECT * FROM User
UserAuditLogs:
SELECT * FROM UserAuditLogs
UserTokens:
SELECT * FROM UserTokens
VectorizeIndexes:
SELECT * FROM VectorizeIndexes WHERE AccountId = 'account123'
WaitingRoomEvents:
SELECT * FROM WaitingRoomEvents WHERE ZoneId = 'zone123' AND WaitingRoomId = 'waitingroom123'
WaitingRooms:
SELECT * FROM WaitingRooms WHERE ZoneId = 'zone123'
WorkersKvKeys:
SELECT * FROM WorkersKvKeys WHERE AccountId = 'account123' AND NamespaceId = 'namespace123'
WorkersKvNamespaces:
SELECT * FROM WorkersKvNamespaces WHERE AccountId = 'account123'
WorkersRoutes:
SELECT * FROM WorkersRoutes WHERE ZoneId = 'zone123'
WorkersScripts:
SELECT * FROM WorkersScripts WHERE AccountId = 'account123'
ZonePlans:
SELECT * FROM ZonePlans WHERE ZoneId = 'zone123'
Zones:
SELECT * FROM Zones
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| APIEmail | The email address associated with your Cloudflare account for API authentication. |
| APIKey | The API key or API token for authentication to Cloudflare. |
| AuthScheme | The scheme used for authentication. Accepted entries are APIKey or None. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT |
| KeyType | Specifies whether APIKey contains a Global API Key or API Token. |