Core Features

Multi-Environment Variables & Templating

Managing Development, Staging, and Production environments with dynamic variable resolution.

Environment Resolution Strategy

CAPost supports a strict hierarchical variable resolution engine that prioritizes runtime environment values over collection variables, and overrides collection variables over global defaults.

1. Precedence Hierarchy

  1. CLI Injection (Highest Priority): Values passed directly via capost-cli run --var TOKEN=xxx.
  2. Active Environment Preset: Values defined in the currently selected Environment Workspace (e.g., "Production").
  3. Collection Variables: Shared defaults stored directly inside the YAML collection file.
  4. Global Variables (Lowest Priority): Cross-collection defaults shared across the entire vault.

2. Templating Examples

// Requesting staging servers with dynamic paths
GET {{API_GATEWAY}}/v2/customers/{{customer_id}}/invoices?limit=10&active=true

Dynamically replace values based on JSON responses using the templating engine:

POST {{API_GATEWAY}}/checkout/complete
Authorization: Bearer {{JWT_ACCESS_TOKEN}}