Get HTTP Request Body

The Get HTTP Request Body block returns the body of the incoming request, already turned into something you can work with. What you get depends on the content type the caller used.
When to use it
- Read the data a caller sent with a
POST,PUTorPATCH: a JSON document, a form, or an uploaded file. - Read the body again later in the flow. The Entrypoint also starts the flow with the body, but later blocks replace it.
- Don't use it for URL values. Use Get HTTP Param.
- Don't use it for headers or cookies. Use Get HTTP Header or Get Request Cookie.
Inputs
None. The block always reads the body of the request that started the workflow.
Outputs
| Handle | When it is used |
|---|---|
| Next (right) | Always. The next block receives the body, in the shape shown below. |
What you get depends on the content type the caller used:
| Caller sends | You get |
|---|---|
application/json | The parsed JSON — an object, an array, a number, whatever was sent |
application/x-www-form-urlencoded | An object of field names and text values |
multipart/form-data | An object where text fields are strings and uploaded files are file objects |
application/octet-stream | The raw binary body as a single Blob — or a ReadableStream<Uint8Array> in pipe-stream mode |
text/plain | The text, exactly as sent |
A GET or DELETE request | null — those methods carry no body |
Which types your route allows
A route accepts JSON only unless you say otherwise. Pick the formats you want under Accepted content types when you create the route. A request that arrives in any other format is rejected with 415 Unsupported Media Type before your workflow runs.
Repeated field names
If a form sends the same field name twice (tag=a&tag=b, or two files under docs), you get a list for that field instead of a single value. A name that appears once stays a single value.
{ "title": "Holiday photos", "tags": ["beach", "summer"] }Piping a large upload
For application/octet-stream, Pipe request body as a stream hands your workflow the live ReadableStream<Uint8Array> instead of a Blob. Fluxify does not buffer or size-limit the body in this mode, so it can be forwarded straight to Bun.write, an S3 multipart upload, or an fs stream:
const body = getRequestBody();
await Bun.write("/tmp/upload.bin", body);A stream route accepts only application/octet-stream, has no body schema, and cannot be called with x-fluxify-reply: async. Read the stream once: it is the request itself, not a copy.
Working with uploaded files
A file field is a file object, not text. In a JS Runner block you can read its name, size, type, and contents:
const body = getRequestBody();
const upload = body.avatar;
console.log(upload.name); // "profile.png"
console.log(upload.size); // 20481 (bytes)
console.log(upload.type); // "image/png"
const text = await upload.text(); // for text files
const bytes = await upload.arrayBuffer(); // for anything elseFiles are not JSON
A file object cannot be returned directly from a Response block — JSON has no way to represent one. Read what you need from it (its text, its size, a value you extract from it) and return that instead.
Size limit
Every buffered request body is capped, 8 MB by default. A larger request is rejected with 413 and your workflow never starts. A pipe-stream application/octet-stream route is not buffered or counted, so it is exempt. See request body size for how to change the cap and why large uploads need care.
Example
A caller sends POST /orders with Content-Type: application/json:
{ "orderId": "A-1024", "items": [{ "sku": "x1", "qty": 2 }] }The next block receives that same object, so it can read input.orderId.
How it behaves
- The caller's content type is checked against the formats the route accepts.
- The body is read and turned into the value shown in the table above.
- That value becomes the block's output, ready for the blocks after it.
- It replaces the flowing data. The next block's
inputis the body, not what came before. Store earlier data first with Set Variable. - No body is not an error. A request without a body gives
null.
Related blocks
- Entrypoint: the flow starts with this same body.
- Get HTTP Param: read query and path values.
- JS Runner: read files and work with the body in code.
- If Condition: check that a required field is present.
