Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

URL path parameters are named values embedded in a route, such as /users/34. A router matches the fixed parts of the path, captures the value at the parameter position, and passes it to your handler. Use path parameters when the value identifies the resource being requested; use query parameters after ? for filtering, sorting, pagination, and other options.

For example, /users/:userId/books/:bookId in Express captures 34 and 8989 as req.params.userId and req.params.bookId. FastAPI writes the same idea as /users/{user_id}, while Django uses converters such as <int:user_id>.

What is a URL path parameter?

The URI path is the portion after the authority (for example, example.com) and before the first question mark, number sign, or the end of the URI. MDN defines it as the component “terminated by the first question mark (?), number sign (#), or the end of the URI” (MDN URI path reference).

A path parameter is a named variable inside that path. In /orders/8472, 8472 can be the order ID. In /teams/acme/members/17, both acme and 17 are parameters. Express describes these as “named URL segments that are used to capture the values specified at their position in the URL.” Captured values normally arrive as strings unless the framework converts them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Path parameter versus query parameter

Concern Path parameter Query parameter
Location /users/42 /users?role=admin
Typical meaning Selects a specific resource or hierarchy Changes a collection response or operation
Routing Usually participates in route matching Does not participate in an Express route path
Examples ID, slug, year, file path Filter, sort, page, limit

Do not put a filter such as status=paid into a path parameter merely because it is convenient. A useful rule is: if removing the value changes which resource is addressed, it belongs in the path; if it changes how a collection is presented, it usually belongs in the query string.

Express route parameters

Declare and read named segments

Express uses a colon before each parameter name:

const express = require('express');
const app = express();

app.get('/users/:userId/books/:bookId', (req, res) => {
  const { userId, bookId } = req.params;
  res.json({ userId, bookId });
});

app.listen(3000);

A request to /users/34/books/8989 produces { userId: "34", bookId: "8989" }. Convert and validate before using the values:

app.get('/users/:userId', (req, res) => {
  const userId = Number.parseInt(req.params.userId, 10);
  if (!Number.isInteger(userId) || userId < 1) {
    return res.status(400).json({ error: 'userId must be a positive integer' });
  }
  // Check authorization and fetch the user here.
  res.json({ userId });
});

Wildcards, optional segments, and precedence

Current Express routing uses path-to-regexp v8. Named wildcards can capture trailing path segments when a resource may contain slashes. Optional segments are useful only when both URL shapes have a clear meaning; otherwise use separate routes for explicit behavior. Regular-expression characters are not supported inside string paths in the current routing guide, so do not assume an old Express pattern will continue to work.

Express selects the first matching route. Put fixed exceptions before broad parameters:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
app.get('/book/create', createBook);
app.get('/book/:bookId', getBook);

If the order is reversed, the word create can be captured as bookId. Query strings such as /book/12?format=short do not change which Express route matches.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

FastAPI path parameters

Brace syntax and automatic conversion

FastAPI declares variables with the same brace syntax used by Python format strings (FastAPI path-parameter documentation):

from fastapi import FastAPI

app = FastAPI()

@app.get('/items/{item_id}')
def read_item(item_id: int):
    return {'item_id': item_id}

Calling /items/3 passes the integer 3. Calling /items/not-a-number produces FastAPI’s validation response instead of entering the handler. Type annotations therefore provide conversion, validation, and generated interactive API documentation.

Static routes must come first

FastAPI evaluates path operations in declaration order. Declare /users/me before /users/{user_id}; otherwise me can be interpreted as a user ID:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
@app.get('/users/me')
def current_user():
    return {'name': 'signed-in user'}

@app.get('/users/{user_id}')
def user(user_id: int):
    return {'user_id': user_id}

Capturing slashes

The default variable captures one path segment. For a file-like value that can contain slashes, use Starlette’s path converter:

@app.get('/files/{file_path:path}')
def read_file(file_path: str):
    return {'path': file_path}

FastAPI notes that OpenAPI does not natively provide a way to declare a path parameter containing an entire path, because such definitions are difficult to test and describe. Document this behavior explicitly for clients.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Django converters and URL patterns

Built-in converters

Django’s path() function makes the expected type part of the route:

from django.urls import path
from . import views

urlpatterns = [
    path('articles/<int:year>/', views.year_archive),
    path('posts/<slug:slug>/', views.post),
    path('accounts/<uuid:id>/', views.account),
    path('files/<path:file_path>/', views.file),
]
  • str (the default) matches any non-empty string except /.
  • int matches a nonnegative integer and passes an integer to the view.
  • slug accepts ASCII letters and numbers plus hyphens and underscores.
  • uuid matches a formatted lowercase UUID.
  • path includes slashes and can match a complete URL path.

When built-in converters are insufficient, register a custom converter. Use re_path() for a regular expression that cannot be expressed cleanly with a converter. A nonmatching converter normally results in Django’s 404 handling rather than a view call.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Designing reliable parameterized routes

Choose stable resource paths

  • Use nouns and consistent hierarchy: /customers/{customerId}/invoices/{invoiceId}.
  • Keep identifiers in the path when they select one resource.
  • Use query parameters for collection controls such as ?page=2&sort=-created.
  • Pick one spelling and casing convention; changing a public path is an API compatibility event.

Treat every captured value as untrusted

Validation is not authorization. First enforce type, format, range, and allowed values; then verify that the authenticated caller may access the selected resource. Return a clear 4xx response for malformed input and avoid leaking whether sensitive identifiers exist.

One segment or many?

Decide whether a parameter may contain /. Encode reserved characters correctly, and test encoded separators, Unicode, empty values, and trailing slashes against the exact router and proxy configuration. A wildcard can be useful for storage keys, but it also creates ambiguity and makes caching and documentation harder.

Trailing slashes and decoding

Express, FastAPI/Starlette, Django, reverse proxies, and CDNs can differ on whether /items/3 and /items/3/ are equivalent and when percent-decoding occurs. Set a deliberate policy, test both forms, and avoid using a decoded slash as an identifier delimiter.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Route precedence and common bugs

Dynamic routes swallow static routes

Symptom: /users/me reaches the numeric user handler. Fix: register the static route first (FastAPI and Express), or constrain the dynamic converter to integers (Django or a typed FastAPI parameter).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Everything arrives as text

Symptom: arithmetic or strict comparisons fail. Express gives strings, so parse and validate explicitly. FastAPI and Django converters can perform conversion before the handler.

Query data is mistaken for path data

Symptom: a route expecting /products/:id is called with /products?id=7. These are different URLs. Either change the client to /products/7 or define a query-based collection endpoint.

Encoded values do not match expectations

Symptom: spaces, Unicode, or slashes are truncated or decoded twice. Log the raw request and the framework’s captured value, then apply one consistent encoding/decoding policy. Never concatenate untrusted path text into filesystem paths or shell commands.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Testing and documenting parameters

  1. List every route shape, including static exceptions and wildcard forms.
  2. Test valid values, wrong types, minimum and maximum bounds, empty values, Unicode, percent-encoded reserved characters, and both trailing-slash forms.
  3. Assert the status code and error body for malformed and unauthorized requests.
  4. Test precedence explicitly: static paths must not be captured by dynamic parameters.
  5. Document each parameter’s name, type, format, allowed values, example, and whether it may contain slashes.

FastAPI derives OpenAPI documentation from declarations. Express and Django projects generally need an explicit OpenAPI schema or equivalent documentation. Keep examples synchronized with the actual router; a stale example is an integration bug.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Browser-side matching with URLPattern

The browser URLPattern API matches URL components using literal text, wildcards such as /posts/*, named groups such as /books/:id, optional groups, and regular-expression groups. Its syntax is based on path-to-regexp. MDN labels URLPattern “Baseline 2025,” meaning support across the latest devices and browser versions since September 2025; verify compatibility before using it for older browsers. It is a client-side matching tool, not a replacement for server authorization or route dispatch.

Or skip the browser setup

If you need screenshots of parameterized routes for documentation, tests, or release checks, ScreenshotNeo provides a website screenshot API and MCP server. It accepts a URL in one GET request and can return PNG, JPEG, WebP, or PDF. It can accept consent banners before capture and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.

Use the URL-encoded path you want to verify. For options such as a viewport, selector, wait condition, custom CSS or JavaScript, cookies, headers, PDF settings, caching, bulk jobs, or webhooks, see the ScreenshotNeo documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/users/34/books/8989 -o shot.webp

The same request in Python:

import requests
r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com/users/34/books/8989"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)

And Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com/users/34/books/8989' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Cost, performance, and operational notes

  • Keep path parameters short and cache-friendly; very large wildcard values increase log, cache-key, and observability costs.
  • Use stable IDs or slugs rather than mutable display names when links must survive renames.
  • Reject invalid values at the edge or framework validation layer to avoid unnecessary database work.
  • Do not log secrets embedded in paths. URLs often appear in access logs, browser history, analytics, and referrer headers.
  • When changing a route, provide redirects or a versioned endpoint and update generated documentation and client tests together.

Quick framework reference

Framework Declaration Captured value Type behavior
Express /users/:userId req.params.userId String by default; parse and validate
FastAPI /users/{user_id} Handler argument Python annotation converts and validates
Django users/<int:user_id>/ View argument Converter controls matching and conversion

Frequently Asked Questions

Can a path parameter be optional?

Some routers support optional syntax, but separate explicit routes are usually clearer and easier to document. Check the exact version of your framework before relying on optional-segment behavior.

Should IDs be numeric or strings?

Use the identifier format that is stable for your domain. Validate its exact format and authorize access; do not assume a numeric-looking value is safe or meaningful without those checks.

Are path parameters visible to users?

Yes. They appear in the address bar and commonly in server logs, browser history, analytics, and referrer data. Never place passwords, access tokens, or other secrets in them.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.