Skip to main content

Request file format

A request file has three parts:
  1. Request line — the HTTP method and URL on the first non-comment line
  2. Headers — one header per line in Header-Name: value format
  3. Body — everything after the @body directive
Empty lines and lines starting with // are ignored. Use // comments freely to document your requests.

Request line

The first line must be the HTTP method followed by the URL, separated by a space:

Headers

Add headers on the lines immediately after the request line, before @body. Each header follows the standard Name : value format:

Body

Place @body on its own line to start the body section. Everything after @body is sent as the request body. See Request body for details on supported formats.

Examples

GET request

POST request with a JSON body

Start typing json and a snippet suggestion will show up, select it and it will add an empty json to the request

Using comments

Lines that start with // are skipped when the request runs. Use them to explain the request or temporarily disable a header:
Use the keyboard shortcut Cmd OR (Ctrl) + / to toggle a line as a comment.

Setting a base URL

Instead of repeating the full URL in every request file, you can set a baseUrl using folder settings at the folder level: see Folder Settings for details. With baseUrl configured, you can write request files using a root-relative path:
Postchi prepends the baseUrl automatically when the URL starts with /.
You can set baseUrl to a variable like <base_url> and define it in your environment.