/Knowledge/sources/honojs__hono/llms-full/request-id-middleware-usage--d14d72502999.md
Request ID Middleware: Usage - hono-docs
Request ID Middleware: Usage Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt usage Summary You can acc...
Request ID Middleware: Usage
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#usage
Summary
You can access the Request ID through the requestId variable in the handlers and middleware to which the Request ID Middleware is applied. ```ts const app = new Hono() app.use('*', requestId()) app.get('/', (c) => { return c.text(`Your...
Content
You can access the Request ID through the requestId variable in the handlers and middleware to which the Request ID Middleware is applied.
const app = new Hono()
app.use('*', requestId())
app.get('/', (c) => {
return c.text(`Your request id is ${c.get('requestId')}`)
})
If you want to explicitly specify the type, import RequestIdVariables and pass it in the generics of new Hono().
import type { RequestIdVariables } from 'hono/request-id'
const app = new Hono<{
Variables: RequestIdVariables
}>()
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#usage",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Request ID Middleware > Usage",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 339,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Request ID Middleware: Usage",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}