Get page by slug #5241

Closed
opened 2026-02-05 09:50:58 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @TomSpidge on GitHub (Apr 1, 2025).

API Endpoint or Feature

Ability to get a page from the API when you don't know the ID.

Use-Case

I have a system that records the URL for pages in a bookstack instance, but need to modify the page properties based on that URL. I can extract the slug from the URL, but can't get the page ID to modify other than listing all the pages in the book and filtering from there. I can't find a way using /api/pages/search to use the slug directly.

It would be more efficient & quicker to be able to just get the page with e.g. https://docs.doulos.com/api/pages/search?slug=page-slug, or another search query that specifically references the slug.

Additional context

No response

Originally created by @TomSpidge on GitHub (Apr 1, 2025). ### API Endpoint or Feature Ability to get a page from the API when you don't know the ID. ### Use-Case I have a system that records the URL for pages in a bookstack instance, but need to modify the page properties based on that URL. I can extract the slug from the URL, but can't get the page ID to modify other than listing all the pages in the book and filtering from there. I can't find a way using /api/pages/search to use the slug directly. It would be more efficient & quicker to be able to just get the page with e.g. https://docs.doulos.com/api/pages/search?slug=page-slug, or another search query that specifically references the slug. ### Additional context _No response_
OVERLORD added the 🔩 API Request label 2026-02-05 09:50:58 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Apr 1, 2025):

Hi @TomSpidge,

Try using a filter on the pages-list endpoint:

GET /api/pages?filter[slug]=page-slug

Keep in mind that a page slug is only unique within the context of a book, not globally.
View the "Listing Endpoints" part of the API guidance for more info about filters.

@ssddanbrown commented on GitHub (Apr 1, 2025): Hi @TomSpidge, Try using a filter on the pages-list endpoint: ```http GET /api/pages?filter[slug]=page-slug ``` Keep in mind that a page slug is only unique within the context of a book, not globally. View the "Listing Endpoints" part of the API guidance for more info about filters.
Author
Owner

@TomSpidge commented on GitHub (Apr 2, 2025):

Filters! I missed that bit somehow. That makes a lot of sense and works perfectly (I'll filter on book as well as slug to make sure I get the right one, since in this case I know which book it will be).

Thanks.

@TomSpidge commented on GitHub (Apr 2, 2025): Filters! I missed that bit somehow. That makes a lot of sense and works perfectly (I'll filter on book as well as slug to make sure I get the right one, since in this case I know which book it will be). Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5241