Skip to main content

X-Request-ID

BothActive

X-Request-ID is a custom header (not standardized) that carries a unique identifier for each HTTP request, enabling request tracing across distributed systems. Clients or API gateways generate a UUID, pass it in the request, and servers propagate it through downstream calls and include it in logs and responses.

X-Request-ID: <uuid>

Description

X-Request-ID enables distributed tracing by correlating logs across multiple services. The standard pattern is for API gateways to inject a UUID v4 if the client doesn't provide one, then pass it to all downstream services. Including it in error responses lets clients correlate their request with server-side logs.

Examples

Client sends
http
GET /api/users HTTP/1.1
X-Request-ID: 550e8400-e29b-41d4-a716-446655440000
Server echoes back
http
HTTP/1.1 200 OK
X-Request-ID: 550e8400-e29b-41d4-a716-446655440000

Specification

Custom header (no RFC)X-Request-ID specification →