What is the Date format in the Notion API?

6.6k Views Asked by At
{
    "object": "error",
    "status": 400,
    "code": "validation_error",
    "message": "{Bal has an invalid date value."
}

I tried many types and always failed.Why not just write it in the document.

2021/05/14
2021/14/05
2021/5/14
2021/05/14 00:00:00
3

There are 3 best solutions below

0
On
            "date": {
                "start": "2021-05-17T12:00:00Z",
                "end": "2021-05-17T12:00:00Z"
            }

"end" value If null, this property's date value is not a range. date type link

0
On

Notion API is using the ISO 8601 standard for date. https://en.wikipedia.org/wiki/ISO_8601

0
On

You can see the documentation here

https://developers.notion.com/reference/property-value-object

The example itself is an object property.

as a request body example

...
{
    "Created Date": {
         "date": {
            "start": "2022-02-14",
            "end": "2022-02-18"
         }
    }
}
...

as a request body for notion client JS SDK

...
{
    'Created Date': {
         date: {
            start: 2022-02-14,
            end: 2022-02-18,
         },
    },
}
...

Date format can be 'yyyy-mm-dd' or 'yyyy-mm-dd hh:mm:ss' or using ISO8601 format

Hopefully can answer your question.