Skip to content
Start here

Produce records

POST/produce

Send to the stream’s endpoint, https://<stream_id>.k2.cloudflarestorage.com. Appends a batch of records to the stream. The batch is written atomically, so either every record is stored or none are. Requests are limited to 5 MB, compressed and decompressed, and each record to 1 MB. Gzip bodies are accepted when Content-Encoding is gzip. Requires an API token with K2 produce permission unless the stream’s HTTP input sets authentication to false. Errors use a success and error body instead of the errors array.

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Body ParametersJSONExpand Collapse
records: array of object { content, headers }
content: string

The record payload, encoded as standard base64. Empty content is valid.

headers: optional map[string]

Metadata about the record, as string keys and values.

ReturnsExpand Collapse
success: true

Produce records

curl "https://{stream_id}.k2.cloudflarestorage.com/produce" \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "records": [
            {
              "content": "eyJvcmRlcl9pZCI6MTAwMX0="
            }
          ]
        }'
{
  "success": true
}
Returns Examples
{
  "success": true
}