Subrequests

Track outbound HTTP requests made by your functions during execution. Subrequest tracking gives you visibility into external API calls, database connections, and third-party service dependencies.

View subrequests

curl "https://api.fold.run/subrequests" \
  -H "Authorization: Bearer YOUR_TOKEN"

Response:

{
  "tenant_id": "my-tenant",
  "subrequests": [
    {
      "id": "sr_abc123",
      "function_id": "fn_xyz",
      "destination_host": "api.openai.com",
      "destination_path": "/v1/chat/completions",
      "method": "POST",
      "status": 200,
      "duration_ms": 1250,
      "timestamp": 1710460800000
    }
  ]
}

Filter by function

Get subrequests for a specific function:

curl "https://api.fold.run/subrequests?function_id=fn_xyz" \
  -H "Authorization: Bearer YOUR_TOKEN"

Filter by time

Get subrequests after a specific timestamp:

curl "https://api.fold.run/subrequests?since=1710460800000&limit=100" \
  -H "Authorization: Bearer YOUR_TOKEN"
Parameter Type Default Description
function_id string Filter to a specific function
since number Only return subrequests after this timestamp (ms)
limit number 50 Results per page (max 200)

Dashboard

Subrequests are displayed on the activation detail page. When you view an individual activation, the "Outbound Requests" section shows all external HTTP calls made during that invocation, including host, path, method, status code, and duration.

What gets tracked

Any outbound fetch() call made by your function is recorded:

  • Destination host and path
  • HTTP method
  • Response status code
  • Round-trip duration in milliseconds

Subrequests are recorded automatically during function execution — no code changes needed.

Use cases

  • Dependency monitoring — See which external APIs your functions depend on.
  • Latency diagnosis — Identify slow external calls that increase function duration.
  • Error correlation — Match failed activations to failed outbound requests.
  • Cost tracking — Monitor calls to metered APIs like AI providers.