Skip to content

Collections

Servers

You can define multiple servers for different environments such as development, staging, or production.

servers:
  - url: http://localhost:3000/api/v1
    name: development
    description: Development server
  - url: http://example.com/api/v1
    name: staging
    description: Staging server

Variables

You can define global or environment-specific (local) variables.

Global Variables

variables:
  key: key_value # Global variable

Local Variables (Per Environment)

You can define variables scoped to specific environments.

variables:
  development:
    token: key_value # Local variable, available only for the development environment

To access variables, use this syntax:

paths:
  - endpoint: /posts
    name: getPosts
    auth:
      type: bearer
      token: "{{token}}"

Headers

To define request headers (such as Content-Type), you can configure them per path.

paths:
  - endpoint: /posts
    name: getPosts
    headers:
      Content-Type: application/json
      # Content-Type: application/x-www-form-urlencoded

Authentication

You can define authentication for each endpoint as follows:

Bearer Token

paths:
  - endpoint: /posts
    name: getPosts
    auth:
      type: bearer
      token: "{{token}}"

Basic Auth

paths:
  - endpoint: /posts
    name: getPosts
    auth:
      type: basic
      username: "{{username}}"
      password: "{{password}}"

API Key (Header)

paths:
  - endpoint: /posts
    name: getPosts
    auth:
      type: apikey
      api_key: abc123
      api_key_header: X-API-Key

This will send the header:
X-API-Key: abc123

You can customize the header name using api_key_header.

Digest Authentication

paths:
  - endpoint: /posts
    name: getPosts
    auth:
      type: digest
      username: admin
      password: secret

Multipart Form Data

To send multipart/form-data (typically for file upload), define the body fields and file paths:

paths:
  - endpoint: /upload
    name: upload
    method: POST
    headers:
      Content-Type: multipart/form-data
    body:
      title: lorem
      file: "./path/file.png"
  • headers.Content-Type: Should be set to multipart/form-data to indicate file upload.
  • body: Key-value pairs to be sent. For file fields, use a relative or absolute path to the file.

Note: Files are automatically detected if the value is a valid path to a local file.