Entry patterns: six ways to send data into edge-response for Cloudflare

The Ingest kit has one front door and six ways through it. All six are in the code, each with its own tests and guide. None has been deployed or run against a real Cloudflare account. Only the first answers by default: the setting ENABLED_ENTRIES (a comma-separated list) turns on the signed webhook, the keyed batch and the shared-secret header, and a pattern that is not listed is a 404. The Worker-to-Worker pattern has no web address and the scheduled pull has no inbound door at all. They all share the same steps afterwards: check who is sending, cap the size, convert to the record envelope, remove secrets, and store.

A source declares which pattern it uses, and a source can only be written through its own pattern, so a key or secret for one pattern never writes a source of another.

Six entry patterns, one front door Six kinds of sender enter one front door. Accepted events are stored in the records stream and refused events go to the rejects stream with their reasons. Cloudflare logs Signed webhook Keyed batch API Shared-secret header Worker-to-Worker Scheduled pull Front door check, cap, clean, shape records: stored rejects: with reasons
Six ways in, one set of rules, two places out.

1. Cloudflare logs: built

Logpush is Cloudflare's service that pushes your logs to a destination. Here the destination is the front door, over HTTPS, at POST /v1/logpush/{dataset}, with a source key in the Authorization header. Four datasets are handled: firewall events, HTTP requests (security and bot fields only), DNS logs and audit logs. Only the firewall events source is marked live; the other three are declared as planned, so the health check does not judge them.

In order, the front door:

  1. Refuses anything but POST.
  2. Checks the key against its stored digest before it reads a byte of the body. Every kind of bad key is the same 401.
  3. Checks the key is allowed to write the dataset's source.
  4. Reads the body with a cap on bytes read (10 MB as sent and 48 MB inflated by default), inflating gzip once.
  5. Answers Logpush's own destination check without storing anything.
  6. Stores accepted events and answers 202 with counts. A failed write is 503 with a retry hint, so Logpush retries and no event is lost.

Set the Logpush job's upload size to 5 MB, well inside the caps. A person mints the key, and only its digest is stored. This pattern is the worked example for building your own.

2. Signed webhook: built, off by default

POST /v1/webhook/{source}. The sender signs the timestamp and raw body with its own shared secret. The front door checks the headers and a five-minute window before it reads the body, verifies the signature in constant time, and answers 409 to a delivery id it has seen. A GitHub mode checks GitHub's signature instead; it has no timestamp, so a captured delivery can be replayed for ten minutes. The record of seen ids is not atomic, so two deliveries of one id at the same moment can both pass.

3. Keyed batch API: built, off by default

POST /v1/batch, for senders that push batches. It needs two proofs: an Access service token, which is Cloudflare's machine identity, and a per-source key. Without the Access team domain and audience settings it answers 503. If any source in the batch is not one the key may write, the whole batch is refused and nothing is stored.

4. Shared-secret header: built, off by default

POST /v1/hook/{source}, for tools that can only add one fixed header. It is the weakest pattern: no replay protection and no integrity check on the body. Prefer the signed webhook whenever the sender can sign.

5. Worker-to-Worker: built

Another Worker on your account hands records over through a service binding to the capability entrypoint IngestWrite, which has one method, accept, for sources declared with a service-binding entry. The binding is the grant, so any Worker bound to it may write every service-binding source. The kit's tests prove it locally and in the Workers runtime; a live deploy is not proven. See How kits join.

6. Scheduled pull: built

The front door fetches from an API on a timer and keeps a cursor, which moves only after the records are stored. The one connector shipped reads Cloudflare account audit logs with a read-only token, every 15 minutes, and does nothing until its account id and token are set.

What happens after the door

Events that pass are written to the records stream and stored as tables in R2, Cloudflare's object storage, through Basin's catalogue. Events that fail go to the rejects stream with the reasons, never the values. Sanitising runs before the record id is made, so a secret never reaches an id, a stream or a reject row. A read-only query server at POST /mcp reads the data back; it answers only people signed in through Access, runs every query through a guard, and audits every call.