sreq history

View, replay, and manage request history.

Synopsis

sreq history [id] [flags]

Description

sreq automatically saves all requests to a local history file. Use the history command to view past requests, replay them, or export them as curl/HTTPie commands.

Arguments

ArgumentDescription
idOptional request ID to view details or perform actions

Flags

FlagDescriptionDefault
--allShow all history entriesfalse
--serviceFilter by service name
--envFilter by environment
--methodFilter by HTTP method
--curlExport as curl commandfalse
--httpieExport as HTTPie commandfalse
--replayReplay the requestfalse
--clearClear historyfalse
--beforeClear entries older than duration

Examples

List Recent Requests

sreq history

Output:

ID    METHOD  PATH                            SERVICE          ENV     STATUS    TIME
------------------------------------------------------------------------------------------
1     GET     /api/v1/users                   auth-service     dev     200       145ms
2     POST    /api/v1/users                   auth-service     dev     201       230ms
3     GET     /api/v1/invoices                billing-service  prod    200       89ms
4     DELETE  /api/v1/users/123               auth-service     dev     404       67ms

Showing 4 of 4 entries. Use --all to see all.

List All History

sreq history --all

Filter by Service

sreq history --service auth-service

Filter by Environment

sreq history --env prod

Filter by Method

sreq history --method POST

View Request Details

sreq history 2

Output:

Request #2
========================================
Time:     2026-01-19T10:30:00Z
Service:  auth-service
Env:      dev
Method:   POST
Path:     /api/v1/users
Base URL: https://auth.example.com
Status:   201
Duration: 230ms

Request Headers:
  Content-Type: application/json

Request Body:
  {"name": "John Doe", "email": "john@example.com"}

Response: 201 Created (156 bytes)

Export: sreq history 2 --curl
Replay: sreq history 2 --replay

Export as curl

sreq history 2 --curl

Output:

curl -X POST 'https://auth.example.com/api/v1/users' \
  -H 'Content-Type: application/json' \
  -u 'api_user:password' \
  -d '{"name": "John Doe", "email": "john@example.com"}'

Export as HTTPie

sreq history 2 --httpie

Output:

http POST 'https://auth.example.com/api/v1/users' \
  Content-Type:application/json \
  -a api_user:password \
  name="John Doe" email="john@example.com"

Replay a Request

sreq history 2 --replay

Output:

Replaying request #2: POST /api/v1/users

{"id": "user_789", "name": "John Doe", ...}

Clear All History

sreq history --clear

Clear Old Entries

# Clear entries older than 7 days
sreq history --clear --before 7d

# Clear entries older than 24 hours
sreq history --clear --before 24h

Duration Format

For --before flag:

FormatMeaning
7d7 days
24h24 hours
30m30 minutes
1w1 week

Disabling History

Set the environment variable to disable history:

export SREQ_NO_HISTORY=1

History Storage

History is stored in ~/.sreq/history.json.

See Also

  • run — Make requests
  • cache — Manage credential cache