Replay bundles

GET /v1/replay/bundle returns everything needed to serve recorded responses with no network access, grouped by endpoint, then request shape, then response. It is what stubsmith pull writes to .stubsmith/bundle.json and what stubsmith.replay() reads. Authenticate with a project key.

Scope it to one endpoint with requestTypeId, or with method and path together. The path may be the concrete one your code calls (/admin/orders/1042); the server matches it against your recorded path patterns and resolves the request type itself.

Shell
# The whole project
curl -G "https://app.stubsmith.dev/api/v1/replay/bundle" \
  -H "Authorization: Bearer ${STUBSMITH_API_KEY}"

# One endpoint, every recorded sample of every response
curl -G "https://app.stubsmith.dev/api/v1/replay/bundle" \
  --data-urlencode "method=GET" \
  --data-urlencode "path=/admin/orders" \
  --data-urlencode "samples=all" \
  -H "Authorization: Bearer ${STUBSMITH_API_KEY}"

By default each response carries a single body: the most recent recording. That is all that is needed to serve a response, and it keeps a whole-project bundle small. Pass samples=N or samples=all and every response also carries a samples array holding its rolling window, newest first, each entry with its own capture_id, captured_at, headers and body. Use it to run a test against every recorded response for a shape rather than only the latest, which is how you find out your code breaks on the 500 your API returned last week.

samples above 1 requires a scope: fetching every sample for an entire project is rejected with a 400. The ceiling is 25, matching the largest plan's per-response window, and a larger request is clamped and reported in the response's truncated object rather than trimmed silently.

Always check truncated. A bundle is capped at 2,000 request shapes, 10 responses per shape, and 100 KB per body, and anything dropped is named there. A project larger than those caps needs per-endpoint bundles rather than one project-wide fetch.

If a recorded body cannot be read from storage, /v1/replay/bundle and /v1/fixtures fail the whole request rather than return a response without its body: 503 with a Retry-After header when storage is temporarily unreachable, so retry after that many seconds, and 500 when the body is gone. Both answer {"error":"body_unavailable"}. A response that genuinely had no body still comes back with body: null. stubsmith pull exits non-zero on either and leaves an existing bundle file untouched.