Request Body

The Body tab lets you configure the request payload. Samvad supports five body modes to cover every API use case.


Body Modes

Mode Content-Type Use Case
JSON application/json REST APIs
Raw Custom Plain text, XML, GraphQL
Form Data application/x-www-form-urlencoded HTML form submissions
URL Encoded application/x-www-form-urlencoded Key-value pairs in URL form
Multipart multipart/form-data File uploads

JSON

The most common mode for modern REST APIs. The editor uses Monaco with full JSON syntax highlighting and validation.

{
  "name": "Alice",
  "email": "alice@example.com",
  "role": "admin"
}

The Content-Type: application/json header is automatically added.

Tips:

  • Use Cmd+Shift+F / Ctrl+Shift+F to auto-format JSON
  • JSON errors are highlighted inline
  • Reference environment variables: "token": "{{API_TOKEN}}"

Raw

Sends the body exactly as typed. You can set any Content-Type manually in the Headers tab.

Use this for:

  • XML
<?xml version="1.0" encoding="UTF-8"?>
<user>
  <name>Alice</name>
  <email>alice@example.com</email>
</user>
  • GraphQL queries
query {
  user(id: "1") {
    name
    email
  }
}
  • Plain text

Form Data (URL Encoded)

Sends key-value pairs encoded in the URL query string format. This is the default encoding for HTML <form> submissions.

Add rows with + and toggle each row enabled/disabled with the checkbox.

name=Alice&email=alice%40example.com&role=admin

The Content-Type: application/x-www-form-urlencoded header is automatically added.


Multipart

Used for file uploads. Supports mixed text fields and file attachments in a single request.

To upload a file:

  1. Select Multipart mode
  2. Click Add File
  3. Pick a file from the native file dialog
  4. Add any additional text fields
Content-Type: multipart/form-data; boundary=----FormBoundary

------FormBoundary
Content-Disposition: form-data; name="username"

alice
------FormBoundary
Content-Disposition: form-data; name="avatar"; filename="photo.png"
Content-Type: image/png

<binary data>
------FormBoundary--

Environment Variables in Body

You can use {{VARIABLE_NAME}} in any body field and it will be substituted with the value from the active environment at send time.

{
  "api_key": "{{API_KEY}}",
  "user_id": "{{USER_ID}}"
}

See Environments for setup instructions.