Basic Structure
Every collection file follows this structure:
collection.yaml
version: '1.0' # Required: Format version
name: "Collection Name" # Required: Human-readable name
description: "Description" # Optional: Collection description
variables: # Optional: Global variables
base_url: "https://api.example.com"
timeout: 5000
tests: # Optional: REST API tests
- id: "test-id"
name: "Test Name"
request:
method: GET
url: ${base_url}/api/endpoint
assertions:
- status == 200Variables
Use variables to reuse values and manage environments:
collection.yaml
variables:
base_url: ${API_BASE_URL}
api_version: "v1"
timeout: 5000
tests:
- name: Get User
request:
url: ${base_url}/api/${api_version}/users
assertions:
- status == 200Request Configuration
Configure HTTP requests with method, URL, headers, and body:
collection.yaml
tests:
- id: create-user
name: Create User
request:
method: POST
url: ${base_url}/users
headers:
Content-Type: application/json
Authorization: Bearer ${API_TOKEN}
body:
name: "John Doe"
email: "john@example.com"
assertions:
- status == 201
- body.id existsAuthentication
Support for various authentication types:
collection.yaml
# Bearer Token
auth:
type: bearer
token: ${API_TOKEN}
# API Key
auth:
type: api-key
header: X-API-Key
value: ${API_KEY}
# Basic Auth
auth:
type: basic
username: ${USERNAME}
password: ${PASSWORD}