> For the complete documentation index, see [llms.txt](https://docs.langstack.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.langstack.com/welcome/get-started/learn-langstack/introduction-to-rest-api/request-and-response-body/request-body.md).

# Request body

* A Request body is the data received by a Langstack API application from the endpoint in the network (i.e. client).&#x20;
* A Request body in an API contains the details of the request received by the API.&#x20;
* The user can access the received request body through the Request variable (shown in the image below), which contains the request body(s) defined under the Request body section.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_4/ch4req1vartabrequest.png>" %}

* The Request variable holds the payload for the request (i.e., the actual message or data received in the request).&#x20;

## Request body fields

A Request body comprises the following fields:&#x20;

1. Request body Name: The name of the request body, this name will be used when accessing it in the Actions.
2. Content Type: The content type is the format of the content that is expected in the request body. For example if the content type is application/json then the sample section should contain a JSON.&#x20;
3. Character Set: The character set defines the content that the request is received with.&#x20;
4. Description: This field explains the purpose of the request body. This text is visible in the API documentation.&#x20;
5. Copy Sample from Entity: This field is used to copy a sample json object from an existing entity into the Sample Box.&#x20;
6. Sample Box: The Sample Box contains a sample of the request that matches the Content-Type. For example if the content type is application/json, the user must provide a Json sample which can be entered directly or copied from an existing entity by using the drop-down “Copy Sample from Entity”. The sample should be similar to the expected Json to be received.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_4/ch4req2reqbody.png>" %}

## Multiple Request bodies

Users may define multiple request bodies in an API to handle multiple content types. However, only one of the defined request bodies will contain the received request data depending on the Content-Type.&#x20;

For example, suppose a request can be received in XML and Json format. In that case, a request body may be defined to receive XML requests, and another request body may be defined to receive Json requests but for one request, only one of them will receive the request depending on the Content-Type received.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_4/ch4req4activityreqxml.png>" %}

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_4/ch4req3activityreqjs.png>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.langstack.com/welcome/get-started/learn-langstack/introduction-to-rest-api/request-and-response-body/request-body.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
