Request id
A unique id for one request, put in every log line and the response, so its trail can be found later.
A parcel carries a tracking number so anyone can find it among millions. Give every request a request id for the same reason. Generate one at the edge, or accept one from the caller or load balancer. Then put it in every log line for that request, return it in an
X-Request-Idresponse header, and include it in error bodies. Support can then ask for that id and find the exact trail in seconds. Anthropic's API does this: every response carries arequest-idheader.
Try it now
This is how you deploy ten times a day and nobody notices.
Learn it properly
Running APIs in production · Versioning, CORS, caching, request ids and health checks. About 40 minutes.
Other terms from the same lesson
- CDN: Servers around the world that keep copies of content close to users, so it loads faster.
- CORS: Headers a server sends to tell browsers which other websites may read its responses.
- load balancer: A service that spreads incoming requests across several copies of a server.
Never trained an AI?
Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.