I can't figure out how to add multi-select tags when creating a page in Notion API. Single select tags are extremely easy to add:
"City": {
"select": {
"name": "New York",
}
}
But my attempts to add multi-select tags end up failing.
"City": {
"multi_select": {
"options": [
{
"name": "New York",
"color": "red"
},
{
"name": "Tbilisi",
"color": "gray"
}
]},
}
Here's the error I get
{"object":"error","status":400,"code":"validation_error","message":"body failed validation. Fix one:\nbody.properties.City.title should be defined, instead was `undefined`.\nbody.properties.City.rich_text should be defined, instead was `undefined`.\nbody.properties.City.number should be defined, instead was `undefined`.\nbody.properties.City.url should be defined, instead was `undefined`.\nbody.properties.City.select should be defined, instead was `undefined`.\nbody.properties.City.multi_select should be an array, instead was `{\"options\":[{\"name\":\"apple\",\"color\":\"red\"},{\"name\":\"Ora...`.\nbody.properties.City.people should be defined, instead was `undefined`.\nbody.properties.City.email should be defined, instead was `undefined`.\nbody.properties.City.phone_number should be defined, instead was `undefined`.\nbody.properties.City.date should be defined, instead was `undefined`.\nbody.properties.City.checkbox should be defined, instead was `undefined`.\nbody.properties.City.relation should be defined, instead was `undefined`.\nbody.properties.City.files should be defined, instead was `undefined`.\nbody.properties.City.status should be defined, instead was `undefined`.\nbody.properties.Name.id should be defined, instead was `undefined`.\nbody.properties.Name.name should be defined, instead was `undefined`.\nbody.properties.Name.start should be defined, instead was `undefined`."}
Do you have a working example of how it should be done?
Here's the full payload
newPageData = {
"parent": { "database_id": 'some id' },
"properties": {
"Name": {
"title": [
{
"text": {
"content": "New page"
}
}
]
},
"City": {
"multi_select": {
"options": [
{
"name": "New York",
"color": "red"
},
{
"name": "Tbilisi",
"color": "gray"
}
]},
},
"Date": {
"date": {
"start": "2023-02-06",
"end": None,
}
},
"Link": {
"url": "example.info"
}
}
}
When populating / updating a Multi-Select property, you don't need to include "options"
or specify the option's colour so this should work -
"City": {
"multi_select": [
{
"name": "New York"
},
{
"name": "Tbilisi"
}
]
}
you should remove the first comma at the end of your list of options for the City property too -
]},
},