# How to pull a custom URL slug / permalink from a model?

**URL:** <https://forum.builder.io/t/how-to-pull-a-custom-url-slug-permalink-from-a-model/146>\
**Category:** CMS\
**Tags:** api\
**Created:** [July 22, 2020, 5:09pm UTC](https://forum.builder.io/t/how-to-pull-a-custom-url-slug-permalink-from-a-model/146 "2020-07-22T17:09:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![john](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/john/32/20_2.png) [@john](https://forum.builder.io/u/john)\
**Post date:** [July 22, 2020, 5:09pm UTC](https://forum.builder.io/t/how-to-pull-a-custom-url-slug-permalink-from-a-model/146/1 "2020-07-22T17:09:26Z")

</div>

Hey team, how can I have a Builder page pull its content (including a custom URL slug / permalink) dynamically from a separate model?

Context: I built a page that pulls its content from a separate model (called Story) in builder. Each time a new Story is published, a new version of the page becomes available to view the Story’s content. Currently, the page works by including the Story - Id in the URL path. However, I am trying to figure out a solution that allows us to customize the URL.

Here’s the page in builder: [https://builder.io/content/7358745c5aa6494da0bb79a7395c6aea](https://builder.io/content/7358745c5aa6494da0bb79a7395c6aea)

Here’s the Story model in builder: [https://builder.io/models/74d0f168c1b641d19941ac54e5d259ca](https://builder.io/models/74d0f168c1b641d19941ac54e5d259ca)

Here’s an example of a public page producing a Story: [https://thenewpaper.co/story/f67258133c154157b05d47cae83acf77](https://thenewpaper.co/story/f67258133c154157b05d47cae83acf77)

In this example above, the aim is to make the URL something like: “[https://thenewpaper.co/story/inda-coronavirus-cases](https://thenewpaper.co/story/inda-coronavirus-cases)”

---

<div class="post-metadata">

**Author:** ![kara](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/kara/32/80_2.png) [@kara](https://forum.builder.io/u/kara)\
**Post date:** [July 23, 2020, 4:28pm UTC](https://forum.builder.io/t/how-to-pull-a-custom-url-slug-permalink-from-a-model/146/3 "2020-07-23T16:28:28Z")

</div>

Hi John! Thanks for reaching out. Here are two docs that will be helpful: [https://www.builder.io/c/docs/guides/advanced-data](https://www.builder.io/c/docs/guides/advanced-data) and you can use our content API: [https://www.builder.io/c/docs/query-api](https://www.builder.io/c/docs/query-api).

For your use case, you can query by slug/handle like this `var url = https://cdn.builder.io/api/v2/content/story?query.data.slug=${state.location.path[1]}&apiKey=${YOUR_KEY}`

I hope this was helpful! If you have any questions, feel free to reach back out!

---

<div class="post-metadata">

**Author:** ![john](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/john/32/20_2.png) [@john](https://forum.builder.io/u/john)\
**Post date:** [July 23, 2020, 7:13pm UTC](https://forum.builder.io/t/how-to-pull-a-custom-url-slug-permalink-from-a-model/146/4 "2020-07-23T19:13:15Z")

</div>

Hi Kara, thanks for the response. This makes sense and should solve the issue!

---

<div class="post-metadata">

**Author:** ![kara](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/kara/32/80_2.png) [@kara](https://forum.builder.io/u/kara)\
**Post date:** [July 23, 2020, 7:24pm UTC](https://forum.builder.io/t/how-to-pull-a-custom-url-slug-permalink-from-a-model/146/5 "2020-07-23T19:24:10Z")

</div>

Great, thanks for your question! 😀
