Destination type
Cloudflare R2 Destination Configuration
Use Cloudflare R2 destinations to archive routed events as objects for audit logs, recovery, long-term inspection, or downstream batch processing. This destination configuration reference covers the fields and delivery behavior required to connect it to FastHook.
FastHook writes each event to the configured R2 bucket.
Cloudflare R2 dashboard fields
Account IDClient Cloudflare account ID.
BucketClient R2 bucket to write objects into.
S3 endpointOptional jurisdiction-specific R2 endpoint.
Access Key IDR2 S3 API access key ID.
Secret Access KeyR2 S3 API secret access key.
Session tokenOptional token for temporary credentials.
Object key templateR2 object key template using FastHook tokens such as {{team_id}}, {{source_id}}, {{event_id}}, and payload paths.
Content typeStored object media type, usually application/json or text/plain.
Body templateOptional custom stored body. Leave empty to store the standard metadata and payload JSON envelope.
Include metadataControls standard envelope metadata when body template is empty.
Max delivery rateOptional pacing for archive writes.
Cloudflare R2 API config
config.account_idRequired Cloudflare account ID for the client's R2 account.
config.endpointOptional R2 S3 endpoint. Defaults to https://<account_id>.r2.cloudflarestorage.com.
config.bucketRequired client R2 bucket name.
config.key_templateRequired R2 object key template. Defaults to archives/{{team_id}}/{{source_id}}/{{event_id}}.json.
config.content_typeObject content type. Defaults to application/json.
config.body_templateOptional archive body template. When omitted, FastHook stores a JSON envelope with metadata and payload.
config.include_metadataOptional boolean. When body_template is empty, controls whether metadata is included with the stored payload.
config.auth_typeUse R2_ACCESS_KEY.
config.auth.access_key_idRequired R2 Access Key ID.
config.auth.secret_access_keyRequired R2 Secret Access Key.
config.auth.session_tokenOptional session token for temporary R2 credentials.
config.rate_limitOptional delivery pacing for archive writes.
config.rate_limit_periodRate-limit period: second, minute, or hour.
{
"name": "event-r2-archive",
"type": "CLOUDFLARE_R2",
"config": {
"account_id": "d4bb10aba95850d72b7b92dc07783c17",
"endpoint": "https://d4bb10aba95850d72b7b92dc07783c17.r2.cloudflarestorage.com",
"bucket": "client-baket",
"auth_type": "R2_ACCESS_KEY",
"auth": {
"access_key_id": "your-r2-access-key-id",
"secret_access_key": "your-r2-secret-access-key"
}
}
}R2 reference See the shared destination reference for those controls.
Cloudflare R2 delivery behavior
- FastHook signs a PutObject request with AWS Signature Version 4 and writes the routed payload to the configured client R2 bucket.
- Without a body_template, the stored object is a JSON envelope with delivery metadata and the parsed payload when possible.
- With a body_template, FastHook renders the template and stores the rendered body using the configured content type.
- If a connection has no transformation, the archive stores the original routed payload. If a transformation runs first, the archive stores the transformed payload.
- Successful attempts store a requested URL like r2://bucket/archives/... so the object key is visible in delivery evidence.
Cloudflare R2 setup checklist
- Create or choose a client R2 bucket and an Object Read & Write R2 API token for that bucket.
- Create a FastHook destination and choose CLOUDFLARE_R2 as the destination type.
- Set account ID, bucket, access key ID, and secret access key.
- Set an object key template such as archives/{{team_id}}/{{source_id}}/{{event_id}}.json.
- Keep content type as application/json unless body_template produces another format.
- Leave body template empty to store the standard metadata and payload archive envelope.
- Connect one or more sources to the R2 destination, adding transformations only when you want to archive transformed payloads.
Cloudflare R2 troubleshooting
Attempts fail with 403 or SignatureDoesNotMatch.Check account_id, endpoint, bucket, access key ID, secret access key, and whether the R2 token has Object Read & Write access to the bucket.
Attempts fail with cloudflare_r2_key_invalid.Check config.key_template. It must render to a relative R2 object key, cannot be empty, and cannot contain .. path segments.
Archived body is not the original inbound request.Check the connection rules. A transformation before the destination changes the payload that R2 stores.
Object content type is wrong.Set config.content_type to match the rendered body, such as application/json for JSON or text/plain for plain text.