Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
450 changes: 394 additions & 56 deletions docs/api/.manifest

Large diffs are not rendered by default.

508 changes: 508 additions & 0 deletions docs/articles/accounts/d1.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/articles/accounts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class AccountService(ICloudflareApiClient cf)
| [Turnstile](turnstile.md) | `cf.Turnstile` | Manage Turnstile widgets |
| [R2 Buckets](r2/buckets.md) | `cf.Accounts` | Create and manage R2 buckets |
| [Workers KV](workers/kv.md) | `cf.Accounts.Kv` | Global key-value storage |
| [D1 Databases](d1.md) | `cf.Accounts.D1` | Serverless SQL databases |
| [Access Rules](security/access-rules.md) | `cf.Accounts.AccessRules` | Account-level IP access control |
| [Rulesets](security/rulesets.md) | `cf.Accounts.Rulesets` | Account-level WAF rules |

Expand Down Expand Up @@ -72,6 +73,9 @@ Console.WriteLine($"2FA Required: {account.Settings?.EnforceTwofactor}");
### Workers
- [Workers KV](workers/kv.md) - Global low-latency key-value storage

### D1 Databases
- [D1 Serverless Database](d1.md) - Serverless SQL databases with SQLite

### Security
- [Access Rules](security/access-rules.md) - Account-level IP firewall rules
- [WAF Rulesets](security/rulesets.md) - Account-level WAF custom rules
Expand All @@ -88,6 +92,7 @@ Console.WriteLine($"2FA Required: {account.Settings?.EnforceTwofactor}");
| Turnstile | Turnstile | Read/Write |
| R2 Buckets | Workers R2 Storage | Read/Write |
| Workers KV | Workers KV Storage | Read/Write |
| D1 Databases | D1 | Read/Write |
| Access Rules | Account Firewall Access Rules | Read/Write |
| Rulesets | Account Rulesets | Read/Write |

Expand Down
61 changes: 61 additions & 0 deletions docs/articles/api-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ This document provides a comprehensive overview of the Cloudflare API endpoints
<tr><td>DNS Records</td><td>12</td><td>Full DNS lifecycle including batch and BIND import/export</td></tr>
<tr><td>R2 Buckets</td><td>22</td><td>Bucket management, CORS, lifecycle, domains, and Sippy</td></tr>
<tr><td>Workers KV</td><td>19</td><td>Namespace and key-value CRUD, metadata, bulk operations</td></tr>
<tr><td>D1 Databases</td><td>11</td><td>Database CRUD, SQL queries, export/import operations</td></tr>
<tr><td>Subscriptions</td><td>6</td><td>Account, zone, and user subscription details</td></tr>
<tr><td>Turnstile</td><td>5</td><td>CAPTCHA widget configuration and secret rotation</td></tr>
<tr><td>User</td><td>11</td><td>Profile, invitations, and membership management</td></tr>
Expand Down Expand Up @@ -537,6 +538,66 @@ This document provides a comprehensive overview of the Cloudflare API endpoints

---

## D1 Databases

### Database Operations

<table class="api-table">
<colgroup>
<col style="width: 20%">
<col style="width: 28%">
<col style="width: 44%">
<col style="width: 8%">
</colgroup>
<thead><tr><th>Operation</th><th>Method</th><th>Endpoint</th><th>Status</th></tr></thead>
<tbody>
<tr><td>List Databases</td><td><code>D1.ListAsync</code></td><td><code>GET /accounts/{id}/d1/database</code></td><td>✅</td></tr>
<tr><td>List All Databases</td><td><code>D1.ListAllAsync</code></td><td><code>GET /accounts/{id}/d1/database</code> (auto)</td><td>✅</td></tr>
<tr><td>Create Database</td><td><code>D1.CreateAsync</code></td><td><code>POST /accounts/{id}/d1/database</code></td><td>✅</td></tr>
<tr><td>Get Database</td><td><code>D1.GetAsync</code></td><td><code>GET /accounts/{id}/d1/database/{uuid}</code></td><td>✅</td></tr>
<tr><td>Update Database</td><td><code>D1.UpdateAsync</code></td><td><code>PATCH /accounts/{id}/d1/database/{uuid}</code></td><td>✅</td></tr>
<tr><td>Delete Database</td><td><code>D1.DeleteAsync</code></td><td><code>DELETE /accounts/{id}/d1/database/{uuid}</code></td><td>✅</td></tr>
</tbody>
</table>

### Query Operations

<table class="api-table">
<colgroup>
<col style="width: 20%">
<col style="width: 28%">
<col style="width: 44%">
<col style="width: 8%">
</colgroup>
<thead><tr><th>Operation</th><th>Method</th><th>Endpoint</th><th>Status</th></tr></thead>
<tbody>
<tr><td>Execute Query</td><td><code>D1.QueryAsync</code></td><td><code>POST /accounts/{id}/d1/database/{uuid}/query</code></td><td>✅</td></tr>
<tr><td>Execute Query (typed)</td><td><code>D1.QueryAsync&lt;T&gt;</code></td><td><code>POST /accounts/{id}/d1/database/{uuid}/query</code></td><td>✅</td></tr>
<tr><td>Execute Query (raw)</td><td><code>D1.QueryRawAsync</code></td><td><code>POST /accounts/{id}/d1/database/{uuid}/raw</code></td><td>✅</td></tr>
</tbody>
</table>

### Export/Import Operations

<table class="api-table">
<colgroup>
<col style="width: 20%">
<col style="width: 28%">
<col style="width: 44%">
<col style="width: 8%">
</colgroup>
<thead><tr><th>Operation</th><th>Method</th><th>Endpoint</th><th>Status</th></tr></thead>
<tbody>
<tr><td>Start Export</td><td><code>D1.StartExportAsync</code></td><td><code>POST /accounts/{id}/d1/database/{uuid}/export</code></td><td>✅</td></tr>
<tr><td>Poll Export</td><td><code>D1.PollExportAsync</code></td><td><code>POST /accounts/{id}/d1/database/{uuid}/export</code></td><td>✅</td></tr>
<tr><td>Start Import</td><td><code>D1.StartImportAsync</code></td><td><code>POST /accounts/{id}/d1/database/{uuid}/import</code></td><td>✅</td></tr>
<tr><td>Complete Import</td><td><code>D1.CompleteImportAsync</code></td><td><code>POST /accounts/{id}/d1/database/{uuid}/import</code></td><td>✅</td></tr>
<tr><td>Poll Import</td><td><code>D1.PollImportAsync</code></td><td><code>POST /accounts/{id}/d1/database/{uuid}/import</code></td><td>✅</td></tr>
</tbody>
</table>

---

## Workers Route

<table class="api-table">
Expand Down
7 changes: 7 additions & 0 deletions docs/articles/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Page-based pagination uses `page` and `per_page` parameters. This pattern is use
- Zone Lockdown Rules
- User-Agent Rules
- Workers KV Namespaces
- D1 Databases

#### Automatic Pagination

Expand Down Expand Up @@ -285,6 +286,12 @@ if (bucket.StorageClass is { } sc && sc == R2StorageClass.InfrequentAccess)
| `ZoneStatus` | Zone activation status | `active`, `pending`, `initializing`, `moved`, `deleted`, `deactivated` |
| `ZoneSettingId` | Zone setting identifier | `ssl`, `min_tls_version`, `always_use_https`, `brotli`, `http2`, `http3`, `development_mode`, `security_level`, etc. |

#### D1 Databases

| Type | Purpose | Known Values |
|------|---------|--------------|
| `D1Jurisdiction` | D1 data residency | `eu`, `fedramp` |

#### Security & Firewall

| Type | Purpose | Known Values |
Expand Down
12 changes: 12 additions & 0 deletions docs/articles/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ Cloudflare uses a permission-based system for API tokens. To adhere to the princ
</tbody>
</table>

### D1 Databases

<table class="permissions-table">
<thead><tr><th>Feature</th><th>Permission</th><th>Level</th></tr></thead>
<tbody>
<tr><td>D1 Databases (read)</td><td>D1</td><td>Account: Read</td></tr>
<tr><td>D1 Databases (write)</td><td>D1</td><td>Account: Write</td></tr>
<tr><td>D1 Queries</td><td>D1</td><td>Account: Write</td></tr>
<tr><td>D1 Export/Import</td><td>D1</td><td>Account: Write</td></tr>
</tbody>
</table>

### Account Security

<table class="permissions-table">
Expand Down
134 changes: 68 additions & 66 deletions docs/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,78 +11,41 @@
href: conventions.md

- name: REST API
- name: Zones API
href: zones/index.md
items:
- name: Overview
href: zones/index.md
- name: Zone Management
href: zones/zone-management.md
- name: Zone Holds
href: zones/zone-holds.md
- name: Zone Settings
href: zones/zone-settings.md
- name: DNS Records
href: zones/dns-records.md
- name: DNS Scanning
href: zones/dns-scanning.md
- name: Worker Routes
href: zones/worker-routes.md
- name: Cache Purge
href: zones/cache-purge.md
- name: Custom Hostnames (SaaS)
href: zones/custom-hostnames.md
- name: Security
items:
- name: Access Rules
href: zones/security/access-rules.md
- name: WAF Rulesets
href: zones/security/rulesets.md
- name: Zone Lockdown
href: zones/security/lockdown.md
- name: User-Agent Rules
href: zones/security/ua-rules.md
- name: Subscriptions
href: subscriptions.md
- name: Accounts API
href: accounts/index.md
items:
- name: Overview
href: accounts/index.md
- name: Account Management
href: accounts/account-management.md
- name: Members
href: accounts/members.md
- name: Roles
href: accounts/roles.md
- name: API Tokens
href: accounts/api-tokens.md
- name: Audit Logs
href: accounts/audit-logs.md
- name: Turnstile
href: accounts/turnstile.md
- name: D1 Databases
href: accounts/d1.md
- name: Members
href: accounts/members.md
- name: R2 Buckets
items:
- name: Bucket Locks
href: accounts/r2/bucket-locks.md
- name: Bucket Management
href: accounts/r2/buckets.md
- name: Custom Domains
href: accounts/r2/custom-domains.md
- name: Managed Domains (r2.dev)
href: accounts/r2/managed-domains.md
- name: CORS Configuration
href: accounts/r2/cors.md
- name: Custom Domains
href: accounts/r2/custom-domains.md
- name: Lifecycle Policies
href: accounts/r2/lifecycle.md
- name: Bucket Locks
href: accounts/r2/bucket-locks.md
- name: Managed Domains (r2.dev)
href: accounts/r2/managed-domains.md
- name: Sippy Migration
href: accounts/r2/sippy.md
- name: Temporary Credentials
href: accounts/r2/temp-credentials.md
- name: Workers
items:
- name: Workers KV
href: accounts/workers/kv.md
- name: Roles
href: accounts/roles.md
- name: Security
items:
- name: Access Rules
Expand All @@ -91,49 +54,88 @@
href: accounts/security/rulesets.md
- name: Subscriptions
href: subscriptions.md
- name: Turnstile
href: accounts/turnstile.md
- name: Workers
items:
- name: Workers KV
href: accounts/workers/kv.md
- name: User API
href: user/index.md
items:
- name: Overview
href: user/index.md
- name: Profile
href: user/profile.md
- name: Memberships
href: user/memberships.md
- name: Invitations
href: user/invitations.md
- name: API Tokens
href: user/api-tokens.md
- name: Audit Logs
href: user/audit-logs.md
- name: Invitations
href: user/invitations.md
- name: Memberships
href: user/memberships.md
- name: Profile
href: user/profile.md
- name: Subscriptions
href: subscriptions.md
- name: Zones API
href: zones/index.md
items:
- name: Overview
href: zones/index.md
- name: Cache Purge
href: zones/cache-purge.md
- name: Custom Hostnames (SaaS)
href: zones/custom-hostnames.md
- name: DNS Records
href: zones/dns-records.md
- name: DNS Scanning
href: zones/dns-scanning.md
- name: Security
items:
- name: Access Rules
href: zones/security/access-rules.md
- name: User-Agent Rules
href: zones/security/ua-rules.md
- name: WAF Rulesets
href: zones/security/rulesets.md
- name: Zone Lockdown
href: zones/security/lockdown.md
- name: Subscriptions
href: subscriptions.md
- name: Worker Routes
href: zones/worker-routes.md
- name: Zone Holds
href: zones/zone-holds.md
- name: Zone Management
href: zones/zone-management.md
- name: Zone Settings
href: zones/zone-settings.md

- name: Extension Packages
- name: Analytics API
href: analytics/index.md
items:
- name: Overview
href: analytics/index.md
- name: GraphQL Queries
href: analytics/graphql.md
- name: R2 Object Storage
href: r2/index.md
items:
- name: Overview
href: r2/index.md
- name: Uploading Objects
href: r2/uploads.md
- name: Downloading Objects
href: r2/downloads.md
- name: Deleting Objects
href: r2/deletes.md
- name: Downloading Objects
href: r2/downloads.md
- name: Listing Objects
href: r2/listing.md
- name: Multipart Uploads
href: r2/multipart.md
- name: Presigned URLs
href: r2/presigned-urls.md
- name: Analytics API
href: analytics/index.md
items:
- name: Overview
href: analytics/index.md
- name: GraphQL Queries
href: analytics/graphql.md
- name: Uploading Objects
href: r2/uploads.md

- name: Reference
- name: API Coverage
Expand Down
14 changes: 11 additions & 3 deletions docs/template/public/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,15 @@ article .alert {
margin-bottom: revert;
}

/* Navigation expand indicator spacing */
.flex-fill .expand-stub {
margin-right: 0.5rem;
/* Navigation expand indicator spacing - align expandable and non-expandable items */
.sidetoc .nav li {
position: relative;
padding-left: 1.25rem;
}

.sidetoc .nav .expand-stub {
position: absolute;
left: 0;
width: 1.25rem;
text-align: center;
}
8 changes: 8 additions & 0 deletions src/Cloudflare.NET/Accounts/AccountsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Core;
using Core.Internal;
using Core.Models;
using D1;
using Kv;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
Expand All @@ -28,6 +29,9 @@ public class AccountsApi : ApiResource, IAccountsApi
/// <summary>The lazy-initialized Workers KV API resource.</summary>
private readonly Lazy<IKvApi> _kv;

/// <summary>The lazy-initialized D1 Database API resource.</summary>
private readonly Lazy<ID1Api> _d1;

#endregion


Expand All @@ -44,6 +48,7 @@ public AccountsApi(HttpClient httpClient, IOptions<CloudflareApiOptions> options
_accessRules = new Lazy<IAccountAccessRulesApi>(() => new AccountAccessRulesApi(httpClient, options, loggerFactory));
_rulesets = new Lazy<IAccountRulesetsApi>(() => new AccountRulesetsApi(httpClient, options, loggerFactory));
_kv = new Lazy<IKvApi>(() => new KvApi(httpClient, options, loggerFactory));
_d1 = new Lazy<ID1Api>(() => new D1Api(httpClient, options, loggerFactory));
}

#endregion
Expand All @@ -63,6 +68,9 @@ public AccountsApi(HttpClient httpClient, IOptions<CloudflareApiOptions> options
/// <inheritdoc />
public IKvApi Kv => _kv.Value;

/// <inheritdoc />
public ID1Api D1 => _d1.Value;

#endregion

#region Methods Impl - Legacy Bucket Operations (Delegating to Buckets API)
Expand Down
Loading