> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getpostchi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing requests

> Learn the request file format Postchi uses and how to write requests for any HTTP method.

## 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

<Note>
  Empty lines and lines starting with `//` are ignored. Use `//` comments freely to document your requests.
</Note>

### Request line

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

```http theme={null}
METHOD https://example.com/path
```

### Headers

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

```http theme={null}
Accept: application/json
Content-Type: application/json
Authorization: Bearer my-token
```

### Body

Place `@body` on its own line to start the body section. Everything after `@body` is sent as the request body. See [Request body](/requests/body) for details on supported formats.

***

## Examples

### GET request

```http theme={null}
GET https://api.example.com/users
Accept: application/json
Authorization: Bearer <api_token>
```

### POST request with a JSON body

```http theme={null}
POST https://api.example.com/users
Content-Type: application/json
@body
{
  "name": "<username>",
  "email": "<email>"
}
```

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

***

## Using comments

Lines that start with `//` are skipped when the request runs. Use them to explain the request or temporarily disable a header:

```http theme={null}
// Fetch all active users
GET https://api.example.com/users?status=active
Accept: application/json
// Authorization: Bearer <api_token>
```

<Tip>
  Use the keyboard shortcut <kbd>Cmd</kbd> OR (<kbd>Ctrl</kbd>) + <kbd>/</kbd> to toggle a line as a comment.
</Tip>

***

## 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](/concepts/collections) for details.

With `baseUrl` configured, you can write request files using a root-relative path:

```http theme={null}
GET /users
Accept: application/json
```

Postchi prepends the `baseUrl` automatically when the URL starts with `/`.

<Tip>
  You can set `baseUrl` to a variable like `<base_url>` and define it in your environment.
</Tip>
