Homeglossary

Request Body

A request body is an HTTP message component that carries data from a client application to a server. It commonly contains information the server needs to create, update, or process a resource, such as form fields, JSON data, or uploaded files. Its format must match the request's Content-Type header so the server can interpret it correctly.

Build API-powered apps with Emergent.

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

  1. A user action or app feature creates a request.
  2. The client sends headers, including Content-Type, followed by the body.
  3. The server parses the body according to its declared format.
  4. 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.

PartPurposeExample
BodyStructured input{"name":"Ava"}
HeaderMetadata and formatContent-Type: application/json
Path or queryResource or filter/users/42?active=true

Common Request Body Formats

FormatBest use
application/jsonMost web APIs
application/x-www-form-urlencodedSimple form submissions
multipart/form-dataForms with file uploads
text/plainUnstructured text

Which HTTP Methods Use a Request Body?

MethodTypical body use
POSTCreate or submit data
PUTReplace a resource representation
PATCHApply partial changes
DELETEPossible, but API-specific
GETAvoid 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.

Frequently Asked Questions

Your Questions, Answered

This will automatically populate, don't change

Don't change this element unless you know what you are doing

What is a request body in an API?

It is the payload sent from a client to a server, usually to create, update, or process data.

What is the difference between a request body and a request header?

The body contains the main input data. Headers provide metadata, such as the body format and authorization details.

Can a GET request have a body?

Technically some HTTP systems may accept one, but developers should avoid it because support and semantics vary.

Can PUT requests have a body?

Yes. PUT commonly sends a body representing the resource state to create or replace.

What formats can a request body use?

Common formats include JSON, URL-encoded form data, multipart form data, and plain text.

Why is req.body undefined?

The server may lack the correct body parser, receive the wrong Content-Type, or receive an empty or already consumed request stream.

Start Building
on Emergent today
Start Building