Skip to content

Query a database endpoint supports filtering by timestamp #252

@KoditkarVedant

Description

@KoditkarVedant

When querying a database using filters, you previously were only able to build filters using properties that were explicitly defined in the database schema. Notion has added a new type of filter for the created timestamp and last edited timestamp of any page within the database. This means you can filter by these attributes, even if the database doesn't have a Created time or Last edited time property.

You can read more about this filter type here, but as a preview here is how you would filter by the created timestamp:

{
    "filter": {
        "timestamp": "created_time",
        "created_time": {
          "past_week": {}
        }
    }
}

And here's how you would filter by the last edited time:

{
    "filter": {
        "timestamp": "last_edited_time",
        "last_edited_time": {
          "after": "2021-05-10"
        }
    }
}

Note that you can also use this filter type within a compound filter.

Notion changelog: https://developers.notion.com/changelog/filter-databases-by-timestamp-even-if-they-dont-have-a-timestamp-property

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions