In Express.js, req.params is an object of values captured from named route segments. For /user/:name and a request to /user/tj, you get req.params.name === 'tj'.
Define placeholders in routes registered with app.get() (or other methods), then read them in the handler. For shared param logic, use app.param(). Query-string values belong on req.query, not here.
Syntax
Read req.params in your Express.js route handler. Start with this line.
Express
req.params
req.params.name
req.params[0] // capture group when the route is a RegExp
Call
What it does
req.params
Primary signature.
req.params.name
Related call form.
req.params[0] // capture group when the route is a RegExp
Related call form.
Install with npm install express. Create the app with const app = express() before you use this API in an Express.js tutorial project.
Library declarations
Express
const express = require("express");
const app = express();
req.params
req.params.name
req.params[0] // capture group when the route is a RegExp
Parameters
This Express.js property is read from the request or response — it has no call parameters.
Return Value
req.params is an object of route parameters. Values are strings — for example /users/34 on /users/:userId yields { userId: '34' }.
Express
app.get('/users/:userId', (req, res) => {
const id = Number(req.params.userId);
});
Express.js Examples
Example 1 — Read One Route Parameter
Capture :name from the path, as in the official API sample.
GET /files/images/logo.png
→ File: images/logo.png
GET /files/note.txt
→ File: note.txt
How It Works
Name the wildcard. Express 5 uses *file (not a bare *).
Segments become an array. Split on / into req.params.file.
Join when you need a path.join('/') rebuilds a relative file path.
Still validate. Never treat wildcard paths as trusted filesystem paths without checks.
Compatibility
Runtime Support
req.params is an Express.js request property. It runs on a Node.js server (Express 5 needs Node.js 18+). Browsers do not execute it — they only request URLs that your routes match.
✓ Server · Express 4 & 5
req.params
Works wherever Express runs: Node.js is the primary target. Bun and Deno can run many Express apps with compatibility layers. Not available in the browser.
ServerNode.js runtime API
Node.js18+ for Express 5 · 14+ typical for Express 4
Supported
BunExpress-compatible server apps
Supported
DenoVia npm compatibility / adapters
Supported
req.paramsExpress on Node.js
Bottom line: Study and run these examples with Node.js and the express package. Copy a snippet into a local file and start the server with node.
Frequently Asked Questions
It is an object of values captured from named route segments in the path, such as :id in /users/:id.
Named parameters are strings (and Express URL-decodes them). Wildcard parameters are arrays of path segments.
req.params comes from the route path pattern. req.query comes from the ?key=value query string.
The old req.param(name) helper is removed in modern Express. Read req.params, req.query, or req.body explicitly instead.
No. It is a server-side Express request property. Browsers only request a URL; your app fills req.params when the route matches.