Request Body
What Is a Request Body?
A request body is the data a client sends to a server in an HTTP request. In an API, this payload commonly contains structured inputs, such as JSON fields, form values, or files.
How an HTTP Request Body Works
- A user action or app feature creates a request.
- The client sends headers, including Content-Type, followed by the body.
- The server parses the body according to its declared format.
- The server validates and processes the inputs, then returns a response.
Request Body vs Headers vs URL Parameters
A request header describes the request. Parameters identify or filter a resource, while the body supplies the main input.
| Part | Purpose | Example |
|---|---|---|
| Body | Structured input | {"name":"Ava"} |
| Header | Metadata and format | Content-Type: application/json |
| Path or query | Resource or filter | /users/42?active=true |
Common Request Body Formats
| Format | Best use |
|---|---|
| application/json | Most web APIs |
| application/x-www-form-urlencoded | Simple form submissions |
| multipart/form-data | Forms with file uploads |
| text/plain | Unstructured text |
Which HTTP Methods Use a Request Body?
| Method | Typical body use |
|---|---|
| POST | Create or submit data |
| PUT | Replace a resource representation |
| PATCH | Apply partial changes |
| DELETE | Possible, but API-specific |
| GET | Avoid it, support and meaning are inconsistent |
Request Body Example
A booking app might send Content-Type: application/json with {"date":"2026-10-22","guests":2}. The server checks those expected fields and returns a response body with the booking result.
Request Body Best Practices
- Match the body format to Content-Type.
- Validate required fields and types on the server.
- Set size limits and document the expected schema.
- Keep secrets out of URLs and return useful validation errors.
Common Request Body Problems
- Incorrect Content-Type or invalid JSON prevents parsing.
- Empty bodies and mismatched field names fail validation.
- req.body may be undefined when parsing middleware is missing.
- Streamed bodies generally cannot be read twice.
Request Bodies in Emergent Apps
Request bodies connect forms, integrations, and database actions in full-stack products. Learn more about an API request and app design and development; Emergent can help build API-powered apps from natural-language instructions.
on Emergent today

