Skip to content
Documentation

Request Object

Complete reference for curl-runner request objects including all properties, methods, headers, body formats, and configuration options.

Complete reference for the request configuration and all available options for configuring HTTP requests.

Overview

The Request Object defines the configuration for individual HTTP requests in curl-runner. It supports all standard HTTP methods, authentication, headers, body content, retries, and response validation.

complete-request.yaml
# Complete Request Object Example
request:
  name: "Complete API Request"
  url: "https://api.example.com/users"
  method: POST
  headers:
    Content-Type: "application/json"
    Authorization: "Bearer ${API_TOKEN}"
    X-API-Version: "v2"
    User-Agent: "curl-runner/2.0"
  params:
    include: "profile,settings"
    sort: "created_at"
    limit: "10"
  body:
    username: "john_doe"
    email: "john@example.com"
    profile:
      firstName: "John"
      lastName: "Doe"
      age: 30
  timeout: 5000
  followRedirects: true
  maxRedirects: 3
  insecure: false
  output: "user-creation-result.json"
  retry:
    count: 3
    delay: 1000
  variables:
    USER_TYPE: "premium"
    REGION: "us-east"
  expect:
    failure: false  # Expect this request to succeed (default)
    status: 201
    headers:
      x-api-version: "v2"
    body:
      id: "^[0-9]+$"
      username: "john_doe"
      email: "john@example.com"

Properties Reference

PropertyTypeRequiredDescription
namestringOptionalHuman-readable name for the request
urlstringRequiredTarget URL for the HTTP request
methodstringOptionalHTTP method (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS). Defaults to GET
headersobjectOptionalHTTP headers to include (values are strings; numbers and booleans are converted)
paramsobjectOptionalURL query parameters, appended to the URL and URL-encoded
bodyanyOptionalRequest body: an object or array is sent as JSON, a string is sent as is
formDataobjectOptionalMultipart form data with file uploads (use it instead of body)
timeoutnumberOptionalRequest timeout in milliseconds (0 means no limit)
followRedirectsbooleanOptionalWhether to follow HTTP redirects (default true)
maxRedirectsnumberOptionalMaximum number of redirects to follow
authobjectOptionalAuthentication configuration (basic or bearer)
proxystringOptionalProxy server URL
insecurebooleanOptionalSkip SSL certificate verification
sslobjectOptionalSSL/TLS settings: verify, ca, cert, key
outputstringOptionalFile path to save the response body
http2booleanOptionalUse HTTP/2 for this request. See HTTP/2
retryobjectOptionalRetry configuration: count, delay, backoff, retryableStatuses
variablesobjectOptionalAccepted in the file, but not used for ${...} interpolation. Define variables in global.variables or collection.variables (see Request-Level Variables)
storeobjectOptionalSave values from the response for later requests. See Response Storage
whenstring | objectOptionalRun the request only when a condition holds. See Conditional Execution
expectobjectOptionalResponse validation rules including negative testing
snapshotboolean | objectOptionalSnapshot testing for this request. See Snapshots
diffboolean | objectOptionalResponse diffing for this request. See Response Diffing

HTTP Methods

curl-runner supports all standard HTTP methods. The default method is GET if not specified.

http-methods.yaml
# HTTP Methods Examples
requests:
  # GET - Retrieve data
  - name: "Get User Profile"
    url: "https://api.example.com/users/123"
    method: GET

  # POST - Create new resource
  - name: "Create New User"
    url: "https://api.example.com/users"
    method: POST
    body:
      username: "newuser"
      email: "newuser@example.com"

  # PUT - Complete resource replacement
  - name: "Update User (Complete)"
    url: "https://api.example.com/users/123"
    method: PUT
    body:
      id: 123
      username: "updated_user"
      email: "updated@example.com"
      profile:
        firstName: "Updated"
        lastName: "User"

  # PATCH - Partial resource update
  - name: "Update User (Partial)"
    url: "https://api.example.com/users/123"
    method: PATCH
    body:
      email: "new_email@example.com"

  # DELETE - Remove resource
  - name: "Delete User"
    url: "https://api.example.com/users/123"
    method: DELETE

  # HEAD - Get headers only
  - name: "Check Resource Exists"
    url: "https://api.example.com/users/123"
    method: HEAD

  # OPTIONS - Get allowed methods
  - name: "Check Allowed Methods"
    url: "https://api.example.com/users"
    method: OPTIONS
MethodUse
GETRetrieve data without side effects (safe)
POSTCreate new resources or submit data
PUTComplete resource replacement
PATCHPartial resource updates
DELETEDelete resources
HEADGet headers without a body
OPTIONSAsk which methods a resource allows

Headers Configuration

Configure HTTP headers for authentication, content type, custom metadata, and more.

headers-config.yaml
# Headers Configuration Examples
requests:
  # Basic headers
  - name: "JSON API Request"
    url: "https://api.example.com/data"
    method: POST
    headers:
      Content-Type: "application/json"
      Accept: "application/json"
    body:
      query: "example"

  # Authentication headers
  - name: "Authenticated Request"
    url: "https://api.example.com/protected"
    method: GET
    headers:
      Authorization: "Bearer ${ACCESS_TOKEN}"
      X-API-Key: "${API_KEY}"

  # Custom headers
  - name: "Custom Headers Request"
    url: "https://api.example.com/custom"
    method: GET
    headers:
      X-Request-ID: "${UUID}"
      X-Client-Version: "1.2.3"
      X-Environment: "production"
      User-Agent: "MyApp/1.0.0"

  # Cache control
  - name: "Cache-Controlled Request"
    url: "https://api.example.com/cached-data"
    method: GET
    headers:
      Cache-Control: "no-cache"
      If-None-Match: "${ETAG_VALUE}"
      If-Modified-Since: "Wed, 21 Oct 2026 07:28:00 GMT"

Note: Header names are case-insensitive according to the HTTP specification, but values are case-sensitive. Use variables for dynamic header values. When a request has a body and no Content-Type header, curl-runner sends Content-Type: application/json.

URL Parameters

Add query parameters to URLs using the params object. Parameters are appended to the URL and automatically URL-encoded.

url-parameters.yaml
# URL Parameters Examples
requests:
  # Query parameters as object
  - name: "Search with Parameters"
    url: "https://api.example.com/search"
    method: GET
    params:
      q: "search term"
      page: "1"
      limit: 20
      sort: "created_at"
      order: "desc"
      include: "author,tags"

  # Multiple values: use a comma-separated string
  - name: "Multi-value Parameters"
    url: "https://api.example.com/items"
    method: GET
    params:
      category: "electronics,books"
      status: "active"
      tags: "new,featured,sale"

  # Parameters with special characters
  - name: "Special Character Parameters"
    url: "https://api.example.com/search"
    method: GET
    params:
      q: "hello world"
      filter: "price>100"
      location: "New York, NY"

  # Parameters with variables
  - name: "Variable Parameters"
    url: "https://api.example.com/users"
    method: GET
    params:
      userId: "${USER_ID}"
      region: "${USER_REGION}"
      locale: "${USER_LOCALE}"
      apiVersion: "${API_VERSION}"

Parameter values are strings; numbers and booleans are converted. To send a list, join the values yourself (tags: "a,b,c").

Request Body

Configure request body content for POST, PUT, PATCH, and other methods that support body data.

request-body.yaml
# Request Body Examples
requests:
  # JSON object body
  - name: "JSON Object Body"
    url: "https://api.example.com/users"
    method: POST
    headers:
      Content-Type: "application/json"
    body:
      username: "johndoe"
      email: "john@example.com"
      profile:
        firstName: "John"
        lastName: "Doe"
        preferences:
          theme: "dark"
          notifications: true

  # JSON array body
  - name: "JSON Array Body"
    url: "https://api.example.com/batch-create"
    method: POST
    headers:
      Content-Type: "application/json"
    body:
      - name: "Item 1"
        type: "document"
      - name: "Item 2"
        type: "image"
      - name: "Item 3"
        type: "video"

  # Form data body (URL encoded)
  - name: "Form Data Body"
    url: "https://api.example.com/form-submit"
    method: POST
    headers:
      Content-Type: "application/x-www-form-urlencoded"
    body: "name=John+Doe&email=john%40example.com&message=Hello+World"

  # Plain text body
  - name: "Plain Text Body"
    url: "https://api.example.com/text-content"
    method: POST
    headers:
      Content-Type: "text/plain"
    body: "This is plain text content that will be sent as the request body."

  # Empty body (common for GET, DELETE)
  - name: "No Body Request"
    url: "https://api.example.com/resource/123"
    method: DELETE
    # No body field needed

  # Body with variables
  - name: "Variable Body"
    url: "https://api.example.com/dynamic"
    method: POST
    headers:
      Content-Type: "application/json"
    body:
      userId: "${USER_ID}"
      timestamp: "${TIMESTAMP}"
      environment: "${ENV}"
      data:
        value: "${DYNAMIC_VALUE}"
        reference: "${REF_ID}"

Body Content Types

TypeDescriptionExample
JSON ObjectStructured data as objectsbody: {key: 'value'}
JSON ArrayArray of data itemsbody: [item1, item2]
Form DataMultipart/form-data with file uploadsformData: {file: {file: "./doc.pdf"}}
Plain TextRaw text contentbody: "plain text"

Form Data & File Uploads

Use the formData property to send multipart/form-data requests with file uploads. This is mutually exclusive with the body property.

form-data.yaml
# Form Data and File Upload Examples
requests:
  # Simple file upload
  - name: "Single file upload"
    url: "https://api.example.com/upload"
    method: POST
    formData:
      document:
        file: "./report.pdf"

  # File with custom filename and content type
  - name: "File with options"
    url: "https://api.example.com/upload"
    method: POST
    formData:
      document:
        file: "./local-file.pdf"
        filename: "quarterly-report.pdf"
        contentType: "application/pdf"

  # Multiple files with form fields
  - name: "Mixed form data"
    url: "https://api.example.com/submit"
    method: POST
    formData:
      # Text fields
      title: "Document Submission"
      description: "Q4 Financial Reports"
      submitted_by: "john@example.com"

      # File attachments
      main_document:
        file: "./report.pdf"
        filename: "financial-report.pdf"
        contentType: "application/pdf"
      supporting_document:
        file: "./appendix.xlsx"
        contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

  # File upload with variables
  - name: "Dynamic file upload"
    url: "${API_URL}/users/${USER_ID}/avatar"
    method: POST
    formData:
      description: "Uploaded on ${DATE:YYYY-MM-DD}"
      request_id: "${UUID}"
      avatar:
        file: "./profile-photo.jpg"
        contentType: "image/jpeg"

File Attachment Properties

PropertyTypeRequiredDescription
filestringRequiredPath to the file (relative or absolute)
filenamestringOptionalCustom filename sent to the server
contentTypestringOptionalMIME type (detected from the file extension if not specified)

Note: File paths are resolved relative to the current working directory when running curl-runner. Files are checked to exist before the request is executed, and by default they must stay inside the working directory (see Security). See File Uploads for details.

Authentication

Configure authentication using the auth object or manual headers.

authentication.yaml
# Authentication Examples
requests:
  # Basic authentication
  - name: "Basic Auth Request"
    url: "https://api.example.com/protected"
    method: GET
    auth:
      type: basic
      username: "${BASIC_USER}"
      password: "${BASIC_PASS}"

  # Bearer token authentication
  - name: "Bearer Token Request"
    url: "https://api.github.com/user"
    method: GET
    auth:
      type: bearer
      token: "${GITHUB_TOKEN}"

  # Manual authorization header (alternative to auth object)
  - name: "Manual Auth Header"
    url: "https://api.example.com/protected"
    method: GET
    headers:
      Authorization: "Bearer ${ACCESS_TOKEN}"

  # API key authentication
  - name: "API Key Request"
    url: "https://api.example.com/data"
    method: GET
    headers:
      X-API-Key: "${API_KEY}"
      X-API-Secret: "${API_SECRET}"

  # Custom authentication scheme
  - name: "Custom Auth Request"
    url: "https://api.example.com/custom-auth"
    method: GET
    headers:
      Authorization: "Custom ${CUSTOM_TOKEN}"
      X-Signature: "${REQUEST_SIGNATURE}"
      X-Timestamp: "${REQUEST_TIMESTAMP}"
Auth TypeRequired FieldsGenerated Header
basicusername, passwordAuthorization: Basic <base64>
bearertokenAuthorization: Bearer <token>

Credentials and tokens are redacted in output by default. See Security.

Timeout & Retry Configuration

Configure request timeouts and retry behavior for handling network issues and unreliable services. Timeouts and delays are in milliseconds.

timeout-retry.yaml
# Timeout and Retry Configuration
requests:
  # Basic timeout
  - name: "Quick Request"
    url: "https://fast-api.example.com/data"
    method: GET
    timeout: 3000  # 3 seconds

  # Long timeout for slow endpoints
  - name: "Slow Processing Request"
    url: "https://api.example.com/heavy-processing"
    method: POST
    timeout: 60000  # 60 seconds
    body:
      processLargeDataset: true

  # Retry configuration
  - name: "Reliable Request with Retries"
    url: "https://unreliable-api.example.com/data"
    method: GET
    timeout: 5000
    retry:
      count: 5      # Retry up to 5 times
      delay: 2000   # Wait 2 seconds before the first retry
      backoff: 2    # Double the wait after each attempt

  # No retries (default behavior)
  - name: "One-Shot Request"
    url: "https://api.example.com/one-time-action"
    method: POST
    timeout: 10000
    retry:
      count: 0      # Explicitly no retries

  # Quick retry for flaky services
  - name: "Flaky Service Request"
    url: "https://flaky-service.example.com/endpoint"
    method: GET
    timeout: 2000
    retry:
      count: 3
      delay: 500    # Quick retry interval

Timeout values

  • Quick APIs: 1-5 seconds
  • Standard APIs: 5-15 seconds
  • Heavy processing: 30-120 seconds
  • File uploads: 300+ seconds

Retry strategy

FieldDescription
countNumber of retry attempts
delayWait time before a retry, in milliseconds
backoffExponential multiplier: the wait before attempt n is delay × backoff^(n-1)
retryableStatusesStatus codes that trigger a retry (default 429, 500, 502, 503, 504)

See Retry Mechanism for the full behavior.

Redirect Handling

Control how curl-runner handles HTTP redirects (3xx status codes).

redirects.yaml
# Redirect Handling Configuration
requests:
  # Follow redirects (default behavior)
  - name: "Follow Redirects"
    url: "https://example.com/redirect-me"
    method: GET
    followRedirects: true
    maxRedirects: 5

  # Don't follow redirects
  - name: "No Redirect Following"
    url: "https://example.com/redirect-me"
    method: GET
    followRedirects: false
    expect:
      status: [301, 302, 307, 308]  # Expect redirect status

  # Limited redirect following
  - name: "Limited Redirects"
    url: "https://example.com/redirect-chain"
    method: GET
    followRedirects: true
    maxRedirects: 2  # Only follow up to 2 redirects

  # POST request with redirect handling
  - name: "POST with Redirect"
    url: "https://example.com/form-submit"
    method: POST
    followRedirects: true
    maxRedirects: 3
    body:
      action: "submit"

Proxy & Security Configuration

Configure proxy settings and SSL/TLS security options. The proxy value is handed to libcurl, so it accepts the proxy URL forms libcurl understands, including socks5:// and user:password@ credentials.

proxy-security.yaml
# Proxy and Security Configuration
requests:
  # HTTP proxy
  - name: "HTTP Proxy Request"
    url: "https://api.example.com/data"
    method: GET
    proxy: "http://proxy.company.com:8080"

  # SOCKS proxy
  - name: "SOCKS Proxy Request"
    url: "https://api.example.com/data"
    method: GET
    proxy: "socks5://proxy.company.com:1080"

  # Proxy with authentication
  - name: "Authenticated Proxy Request"
    url: "https://api.example.com/data"
    method: GET
    proxy: "http://${PROXY_USER}:${PROXY_PASS}@proxy.company.com:8080"

  # Disable SSL verification (insecure)
  - name: "Insecure SSL Request"
    url: "https://self-signed-cert.example.com/api"
    method: GET
    insecure: true  # Skip SSL certificate verification

  # Secure request (default behavior)
  - name: "Secure Request"
    url: "https://api.example.com/secure-endpoint"
    method: GET
    insecure: false  # Verify SSL certificates (default)

Security Warning: Only use insecure: true for testing with self-signed certificates. Never use it in production environments.

SSL/TLS Certificate Configuration

Configure SSL/TLS certificates for custom CA, mutual TLS (mTLS), and enterprise environments.

ssl-config.yaml
# SSL/TLS Certificate Configuration
requests:
  # Custom CA certificate for enterprise environments
  - name: "Custom CA Certificate"
    url: "https://internal-api.company.com/data"
    method: GET
    ssl:
      ca: "./certs/company-ca.pem"

  # Mutual TLS (mTLS) authentication
  - name: "mTLS Client Authentication"
    url: "https://secure-api.example.com/protected"
    method: GET
    ssl:
      ca: "./certs/ca.pem"
      cert: "./certs/client.pem"
      key: "./certs/client-key.pem"

  # Disable verification via ssl config (equivalent to insecure: true)
  - name: "SSL Verification Disabled"
    url: "https://self-signed.example.com/api"
    method: GET
    ssl:
      verify: false

  # Self-signed cert with custom CA
  - name: "Self-Signed with CA"
    url: "https://dev-server.local/api"
    method: GET
    ssl:
      verify: true  # Enable verification
      ca: "./certs/dev-ca.pem"  # But use custom CA

  # Client certificate without custom CA (uses the system trust store)
  - name: "Client Cert Only"
    url: "https://api.example.com/mtls-endpoint"
    method: GET
    ssl:
      cert: "./certs/client.pem"
      key: "./certs/client-key.pem"

SSL Configuration Properties

PropertyTypeDefaultDescription
verifybooleantrueWhether to verify SSL certificates
castring-Path to CA certificate file
certstring-Path to client certificate file for mTLS
keystring-Path to client private key file for mTLS

Note: The insecure: true option is equivalent to ssl.verify: false. If both are specified, SSL verification will be disabled.

Request-Level Variables

Variables for ${...} interpolation come from global.variables and collection.variables (the collection wins), then from the environment. A variables block written on an individual request is accepted but is not used for interpolation: ${NAME} in that request stays unresolved. Put the variables one level up instead. See Variables for the precedence rules.

Values are used as written

A variable value is not interpolated itself: CACHE_KEY: "user_${USER_ID}" stays literal. Use plain values, and put ${...} references in the request fields.

request-variables.yaml
# Variables shared by the requests of a collection
global:
  variables:
    BASE_URL: "https://api.example.com"
    API_VERSION: "v1"

collection:
  name: "Variable Scopes"
  variables:
    API_VERSION: "v2"   # Overrides the global value for this collection
    LOCAL_USER_ID: "12345"
    REQUEST_TYPE: "profile"

  requests:
    - name: "Request with Collection Variables"
      url: "${BASE_URL}/${API_VERSION}/users/${LOCAL_USER_ID}"
      method: GET
      headers:
        X-Request-Type: "${REQUEST_TYPE}"

    - name: "Environment Variable with a Default"
      url: "${BASE_URL}/${API_VERSION}/data"
      method: GET
      timeout: ${REQUEST_TIMEOUT:8000}   # 8000 when REQUEST_TIMEOUT is not set

Response Validation

Configure response validation using the expect object to verify status codes, headers, and body content. It also supports negative testing with expect.failure. See Validation Rules for every rule.

validation-config.yaml
# Response Validation Examples
requests:
  # Standard success validation
  - name: "Success Response Validation"
    url: "https://api.example.com/users"
    method: POST
    body:
      username: "newuser"
      email: "newuser@example.com"
    expect:
      failure: false    # Expect success (default)
      status: 201       # Created
      headers:
        content-type: "application/json"
      body:
        id: "^[0-9]+$"
        username: "newuser"
        email: "newuser@example.com"
        created_at: "*"   # Any timestamp value

  # Negative testing - expect failure
  - name: "Invalid Input Validation"
    url: "https://api.example.com/users"
    method: POST
    body:
      username: ""      # Invalid: empty username
      email: "invalid"  # Invalid: malformed email
    expect:
      failure: true     # Expect this request to fail
      status: 400       # Bad Request
      body:
        error: "Validation failed"

  # Authentication failure testing
  - name: "Unauthorized Access Test"
    url: "https://api.example.com/protected"
    method: GET
    headers:
      authorization: "Bearer invalid-token"
    expect:
      failure: true     # Expect authentication to fail
      status: 401       # Unauthorized
      body:
        error: "Invalid token"

  # Several acceptable statuses
  - name: "Flexible Status Validation"
    url: "https://api.example.com/cached-resource"
    method: GET
    headers:
      if-none-match: "some-etag"
    expect:
      failure: false    # Expect success
      status: [200, 304] # OK or Not Modified

Negative testing with expect.failure

Set expect.failure: true to test scenarios where you expect the request to fail with a 4xx or 5xx status:

  • Authentication failures (401, 403)
  • Validation errors (400, 422)
  • Resource not found (404)
  • Rate limiting (429)
  • Server errors (5xx)

Validation Priority: Request-level validation rules override collection and global defaults. Use partial matching to validate only the fields that matter to your test.

Output Configuration

Configure where to save response data from individual requests.

output-config.yaml
# Output Configuration
requests:
  # Save response to file
  - name: "Save Response to File"
    url: "https://api.example.com/large-dataset"
    method: GET
    output: "dataset.json"

  # Save with dynamic filename
  - name: "Dynamic Output Filename"
    url: "https://api.example.com/reports/daily"
    method: GET
    output: "daily-report-${DATE:YYYY-MM-DD}.json"

  # Save to directory structure
  - name: "Organized Output"
    url: "https://api.example.com/user/${USER_ID}/profile"
    method: GET
    output: "data/users/${USER_ID}/profile.json"

  # No output file (default - display in console)
  - name: "Console Output"
    url: "https://api.example.com/status"
    method: GET
    # No output field - results shown in console

Output paths must stay inside the working directory unless you pass --allow-path.

Best Practices

  • Use Descriptive Names: Always include meaningful names for your requests to make logs and output easier to understand.
  • Set Appropriate Timeouts: Configure timeouts based on expected response times. Too short causes failures, too long delays error detection.
  • Use Variables for Dynamic Content: Leverage variables for API endpoints, tokens, and user IDs to make configurations reusable across environments.
  • Include Content-Type Headers: Specify Content-Type headers when sending body data to ensure proper server-side processing.