← Back to Overview

CLI

Running Collections

Execute collection requests from the command line — sequential or parallel, with filtering, environment selection, and CI/CD-ready output.

Basic Usage

Run all requests in a collection with a single command:

openpost run "My API"

Runs all requests in the collection named "My API"

openpost run "My API" --env production

Run with a specific environment for variable resolution

Collection matched by name (case-sensitive)
Full pipeline per request: auth → pre-script → cookies → HTTP → post-script → tests → history

Sequential Mode (default)

Requests execute one after another in array order, sharing environment context throughout the run.

Shared environment context — setVariables from request N are available to request N+1
Enables chaining — login → extract token → use token in subsequent requests
Scripts run in order — pre-request and test scripts execute sequentially
openpost run "My API" --env staging --verbose

Parallel Mode

Run requests concurrently for faster execution of independent tests:

openpost run "My API" --mode parallel --concurrency 10
Concurrent execution — default concurrency: 5
Separate environment copies — each request gets its own copy (no chaining)
Faster for independent requests — ideal for smoke tests and health checks
openpost run "Smoke Tests" --mode parallel --concurrency 20

Filtering Requests

Use --filter <glob> to run a subset of requests from a collection:

FilterMatches
--filter "GET*"All GET requests
--filter "*users*"Requests with "users" in the name
--filter "Auth*"Requests starting with "Auth"

Useful for running just login flows or specific endpoints without executing the entire collection.

Output & Reporting

Control how results are displayed and saved:

FlagDescription
(default)Pretty terminal output with ✓/✗ per request
--jsonMachine-readable JSON output
--output-file results.jsonSave full results to file
--verboseShow headers, body, timing per request
--quietMinimal output (just pass/fail summary)

Output includes: method, URL, status, time, test results, and errors.

Sample terminal output:

⚡ Running My API (12 requests, sequential)
  Environment: production

  ✓ GET  /users         200  45ms
    ✓ status equals 200
  ✓ POST /users         201 120ms
  ✗ GET  /users/999     404  32ms
    ✗ status equals 200 (got: 404)

  ──────────────────────
  11 passed  1 failed  1.2s total

CI/CD Examples

Integrate collection runs into your CI/CD pipelines. Exit code 0 = all pass, 1 = one or more failures.

GitHub Actions

- name: Install API Studio CLI
  run: npm install -g openpost

- name: Run API tests
  run: openpost run "My API" --env production --output-file results.json

- name: Upload results
  uses: actions/upload-artifact@v4
  with:
    name: api-test-results
    path: results.json

GitLab CI

api-tests:
  image: node:20
  script:
    - npm install -g openpost
    - openpost run "My API" --env production --output-file results.json
  artifacts:
    paths:
      - results.json

Tips

Use --output-file for artifact storage and test reporting
Use --retry 2 for flaky tests that may need retries
Exit code 0 = all passed, 1 = one or more failures

Next

Ko-fi