gurl run

Execute a previously saved request by name.

Usage

gurl run [name] [flags]

Description

The run command executes a request that was previously saved with gurl save. You can override variables, switch environments, set timeouts, and validate responses with assertions.

If the saved request has auth settings, gurl run applies them automatically. Request URLs, headers, bodies, and auth parameters are template-substituted before the auth handler updates the outgoing request.

Flags

FlagShortDefaultDescription
--env-enoneEnvironment to use
--var-vnoneVariable as key=value (can be specified multiple times)
--format-fautoOutput format: auto, json, or table
--cache-cfalseUse cached response
--output-ononeWrite response to file
--forcefalseOverwrite output file if it exists
--timeout30sRequest timeout (e.g., 5s, 1m, 30s)
--chain-chfalseEnable request chaining
--persistfalsePersist extracted/script variables back to the selected environment
--assert-anoneAssertion to validate response
--data-dnoneData file for iteration

Aliases

  • r
  • execute

Examples

Basic run

gurl run "users"

Executes the “users” request.

Run with environment

gurl run "users" --env production

Executes the request using the “production” environment variables.

Run with variables

gurl run "users" --var "page=2" --var "limit=50"

Overrides the page and limit variables for this execution.

Run a request with saved auth

gurl save "profile" https://api.example.com/me \
  --auth bearer \
  --auth-param token='{{token}}'

gurl run "profile" --var token=abc123

The saved bearer auth handler adds the Authorization: Bearer abc123 header during execution. The token is supplied through normal variable substitution, so you don’t need to resupply --auth when running the request.

Run with JSON output

gurl run "api-users" --format json

Outputs the response in JSON format regardless of auto-detection.

Run with timeout and assertion

gurl run "create-user" --timeout 10s --assert "status=201"

Sets a 10-second timeout and asserts the response status is 201.

Run a chained request

gurl run "login" --chain --env staging

Enables request chaining for saved post-response scripts that call gurl.setNextRequest(...). Extracted variables and variables set by scripts become available to later requests in the chain.

Persist flow variables

gurl run "login" --chain --persist --env staging

Writes only extracted variables and script-set variables back to the selected environment. CLI variables, data-row values, and existing environment inputs are not persisted unless extraction or a script changes them.

See also