Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt

Use this file to discover all available pages before exploring further.

Use Cloudflare through Corsair: one client, typed API calls against Cloudflare API v4, and optional local DB sync for zones, DNS, Workers, and rulesets. What you get:
  • 24 typed API operations
  • Local search via corsair.cloudflare.db.* (synced on API calls when a database is configured)

Setup

1

Install

pnpm install @corsair-dev/cloudflare
2

Add the plugin

corsair.ts
import { createCorsair } from 'corsair';
import { cloudflare } from '@corsair-dev/cloudflare';

export const corsair = createCorsair({
	// ... other config options,
	multiTenancy: false,
    plugins: [cloudflare()],
});
3

Get credentials

Follow Get Credentials if you need help getting keys.
4

Store credentials

pnpm corsair setup --plugin=cloudflare
Use the key names documented in Get Credentials (for example api_key=).

Authentication

Each tab shows how to register the plugin for that authentication method. The default authType from the plugin does not need to appear in the factory call.
corsair.ts
cloudflare()
Store credentials with pnpm corsair setup --plugin=cloudflare (see Get Credentials for field names).More: API Key

Example API calls

Read-style (read): dns.get
await corsair.cloudflare.api.dns.get({
	zone_id: 'your-zone-id',
	dns_record_id: 'your-record-id',
});
Write-style (write): dns.create
await corsair.cloudflare.api.dns.create({
	zone_id: 'your-zone-id',
	type: 'A',
	name: 'www.example.com',
	content: '192.0.2.1',
});
See the full list on the API page. Use pnpm corsair list --plugin=cloudflare and pnpm corsair schema <path> locally to inspect schemas.

Hooks

Use hooks on API calls to add logging, approvals, or side effects. See Hooks.

Reference

TopicLink
APIAPI
CredentialsGet credentials