<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/reading-url-parameters-in-nestjs-ogg8b7qa7" -->

---
title: Reading URL Parameters in NestJS | daily.dev
description: A brief walkthrough of using the @Param decorator in NestJS to read dynamic URL segments such as an ID from a route. Demonstrates creating a GET endpoint that...
canonical: https://daily.dev/posts/reading-url-parameters-in-nestjs-ogg8b7qa7
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Reading URL Parameters in NestJS | daily.dev
og:description: A brief walkthrough of using the @Param decorator in NestJS to read dynamic URL segments such as an ID from a route. Demonstrates creating a GET endpoint that...
og:url: https://daily.dev/posts/reading-url-parameters-in-nestjs-ogg8b7qa7
og:image: https://api.daily.dev/og/posts/Ogg8b7Qa7.png
og:image:alt: Reading URL Parameters in NestJS
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Reading URL Parameters in NestJS

**[JavaScript Mastery](https://daily.dev/sources/javascriptmastery)** · 1 min read · 1 upvotes · 0 comments

## Summary

A brief walkthrough of using the @Param decorator in NestJS to read dynamic URL segments such as an ID from a route. Demonstrates creating a GET endpoint that extracts a route parameter and could be used to query a database for a specific user.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=fHWBczG3QUM>

## Questions this post answers

### How do I read a dynamic URL parameter like a user ID in NestJS?

Use the @Param decorator imported from @nestjs/common inside a GET route handler. Declaring a route such as user/:id and typing the parameter as a string lets the handler retrieve the value directly from the URL path, which can then be used to look up a record such as a user in a database.

_Developers building NestJS routes can find more hands-on API patterns like this through daily.dev._

## Similar posts on daily.dev

- [How To Use Query Parameters with Angular Router](https://daily.dev/posts/how-to-use-query-parameters-with-angular-router-uniqwnjiy) · DigitalOcean Community · 1 upvotes · 1 comments
- [Introduction to Dynamic Routing in Next.js \(App Router\) Part 01:](https://daily.dev/posts/introduction-to-dynamic-routing-in-next-js-app-router-part-01--hkznsic5a) · Medium · 1 upvotes · 0 comments
- [Your URL Is Your State](https://daily.dev/posts/your-url-is-your-state-z7hm6q7l8) · Lobsters · 2 upvotes · 1 comments

---

Tags: [#typescript](https://daily.dev/tags/typescript), [#rest-api](https://daily.dev/tags/rest-api), [#nestjs](https://daily.dev/tags/nestjs)

[View this post on daily.dev](https://daily.dev/posts/reading-url-parameters-in-nestjs-ogg8b7qa7)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Reading URL Parameters in NestJS","url":"https://daily.dev/posts/reading-url-parameters-in-nestjs-ogg8b7qa7","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/reading-url-parameters-in-nestjs-ogg8b7qa7"},"datePublished":"2026-07-09T05:31:57.542Z","dateModified":"2026-09-13T19:50:51.306Z","description":"A brief walkthrough of using the @Param decorator in NestJS to read dynamic URL segments such as an ID from a route. Demonstrates creating a GET endpoint that...","image":"https://i.ytimg.com/vi/fHWBczG3QUM/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/fHWBczG3QUM/sddefault.jpg","isAccessibleForFree":true,"articleSection":"JavaScript Mastery","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"JavaScript Mastery","logo":"https://media.daily.dev/image/upload/s--i6Ls5Q5_--/f_auto/v1724338715/logos/javascriptmastery","url":"https://daily.dev/sources/javascriptmastery"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/reading-url-parameters-in-nestjs-ogg8b7qa7","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"typescript,rest-api,nestjs","timeRequired":"PT1M","video":{"@type":"VideoObject","name":"Reading URL Parameters in NestJS","description":"A brief walkthrough of using the @Param decorator in NestJS to read dynamic URL segments such as an ID from a route. Demonstrates creating a GET endpoint that...","thumbnailUrl":"https://i.ytimg.com/vi/fHWBczG3QUM/sddefault.jpg","uploadDate":"2026-07-09T05:31:57.542Z","duration":"PT1M","url":"https://api.daily.dev/r/Ogg8b7Qa7","embedUrl":"https://www.youtube.com/embed/fHWBczG3QUM"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"JavaScript Mastery","item":"https://daily.dev/sources/javascriptmastery"},{"@type":"ListItem","position":3,"name":"Reading URL Parameters in NestJS"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/reading-url-parameters-in-nestjs-ogg8b7qa7#faq","mainEntity":[{"@type":"Question","name":"How do I read a dynamic URL parameter like a user ID in NestJS?","acceptedAnswer":{"@type":"Answer","text":"Use the @Param decorator imported from @nestjs/common inside a GET route handler. Declaring a route such as user/:id and typing the parameter as a string lets the handler retrieve the value directly from the URL path, which can then be used to look up a record such as a user in a database. Developers building NestJS routes can find more hands-on API patterns like this through daily.dev."}}]}
```

