Is there a way to retrieve Notion database entries in the same order as they appear visually?

Hey everyone,

I’m struggling to figure out how to get data from my Notion database in the same order as it’s displayed in the UI. You know, the order you see when you manually arrange items by dragging and dropping them.

I’ve looked through Notion’s API docs and searched online, but I can’t find a solution. It seems like the API doesn’t have a built-in way to respect the visual order we set up in the interface.

Has anyone found a workaround for this? Maybe there’s a hidden property or sorting method I’m missing? I’d really appreciate any tips or suggestions on how to match the API results with the order we see in Notion itself.

Thanks in advance for any help!

I’ve encountered this problem as well. Unfortunately, the Notion API doesn’t provide a direct method to retrieve database entries in the visual order. One potential workaround is to create a ‘Position’ property in your database. You’d need to manually update this value when rearranging items, but it allows you to sort entries programmatically. When querying the database via API, you can then use this property to sort the results. It’s not a perfect solution, but it’s the closest I’ve found to maintaining the visual order. Keep in mind this requires some manual maintenance on your part.

hey there, i’ve run into this issue too. it’s kinda frustrating tbh. from what i know, notion doesn’t have a way to get that visual order through the api :frowning: maybe u could add a manual ‘order’ property and update it whenever u rearrange stuff? not ideal, but it might work. good luck!

I’ve dealt with this issue in my projects, and it’s indeed a limitation of the Notion API. One approach that worked for me was implementing a custom sorting system. I created a ‘Sort Order’ column in my database and used a simple numbering system (1, 2, 3, etc.) to define the order. Then, in my API calls, I sorted the results based on this column.

It’s not perfect and requires some manual upkeep, but it’s been effective for maintaining a specific order. You could even automate the numbering process with a script that runs periodically to update the ‘Sort Order’ based on the visual layout in Notion.

Another trick I found useful was utilizing the ‘last_edited_time’ property. If you briefly edit each item in your desired order, you can then sort by this property in your API call. It’s a bit hacky, but it works in a pinch when you need to quickly match the visual order without setting up a separate system.