Skip to main content
Every request to your fal App passes through the fal gateway before reaching your runner. The gateway injects headers like the request ID and caller identity, and forwards any custom headers the caller included. You can read all of these inside your endpoint handler via self.current_request.headers.get(). Request headers are per-request context, complementing environment variables which are per-runner context. Use headers when you need to identify the specific request or caller (for logging, tracing, or per-user logic), and environment variables for runner-wide information like FAL_APP_NAME or FAL_KEY.

Available Headers

Custom headers passed by the caller are also forwarded to your app. Headers starting with x-fal- are reserved for the gateway and cannot be set by callers.

Correlating with External Tools

Sentry

Attach the request ID to Sentry events so you can find the exact fal request that caused an error:

Structured Logging

Include the request ID in your log output for correlation with fal’s built-in logs:

Custom Headers

Callers can pass custom headers that are forwarded to your app:
Header names are case-insensitive. X-My-Header and x-my-header both work.

Response Header Size Limit

The total size of all response headers returned by your app is limited to 16 KB. This includes platform headers injected by fal (like x-fal-request-id and X-Fal-Billable-Units) and any custom headers your app sets, such as billing units or routing hints from provide_hints(). If the combined headers exceed 16 KB, the response will fail. Keep custom header values short. If you use provide_hints(), avoid returning large lists of model names or long strings — each hint value contributes to the total header size.
Platform headers like X-Fal-Request-Timeout, X-Fal-No-Retry, X-Fal-Retry-Config, and X-Fal-Store-IO are processed by the gateway before reaching your runner. They are not available in self.current_request.headers. Only identity headers (x-fal-request-id, x-fal-caller-user-id, x-fal-endpoint) and custom caller headers are forwarded to your app.

Environment Variables

Per-runner context: FAL_KEY, FAL_APP_NAME, FAL_RUNNER_STATE, and more