The HTTP X-Request-ID request header is an optional and unofficial HTTP header, used to trace individual HTTP requests from the client to the server and back again. It allows the client and server to correlate each HTTP request.
The HTTP X-Request-ID request header contains an identifier, sent by the client to the server, which then logs it with the HTTP request and passes it back to the client. The advantage of the HTTP X-Request-ID request header is that every HTTP request can be used by the webmaster to look up the corresponding log entries, without relying on timestamps and IP addresses, for example the client can include the identifier in a bug report.
When working with HTTP POST, PATCH and/or PUT requests, API providers often recommend and/or require that the HTTP request includes a unique HTTP X-Request-ID request header to ensure idempotent message processing in case of a retry.
The value for the X-Request-ID is a random token which is unique per HTTP request, except for a retry of a HTTP request. Often a UUID 4 string is used as identifier. The random identifier token has no inherent meaning, does not contain any sensitive information and as such does not violate the user's privacy nor enables tracking of users.
When receiving a token for the HTTP X-Request-ID request header, any reverse proxies are recommended to pass the identifier to the backend servers, which in turn are recommended to include it in the HTTP response generated and send the token back to the client. However, since this is an unofficial HTTP header no guarantees are made that this will happen.
Use the HTTP Status Tester to test if a website returns the token in the HTTP X-Request-ID request header.
The "X-" naming convention for HTTP headers, "X" referring to "experimental", has been deprecated and need to be transitioned to formal naming convention for HTTP headers.
In this example a UUID4 token is sent with the HTTP request from the client to the server and the server responds with a 200 OK which includes the same token in its HTTP response headers.
GET /index.html HTTP/1.1 Host: www.example.re X-Request-ID: 96a101dd-c49a-4fea-aee2-a76510f32190
HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 X-Request-ID: 96a101dd-c49a-4fea-aee2-a76510f32190
The HTTP X-Request-ID request header is an unofficial HTTP header, however frequently used by servers to pass an unique request identifier with the HTTP response from clients to send back and allow both the client and server to correlate each HTTP request.