added

Update existing databases with PATCH /v1/databases

You can now use the Notion API to update databases!

Supported updates are:

  • renaming the database
  • adding and removing properties
  • renaming properties
  • updating property types.

Note that updating the name and color select and multi select options is not supported.

Example request

curl --location --request PATCH 'https://api.notion.com/v1/databases/668d797c-76fa-4934-9b05-ad288df2d136' \
--header 'Authorization: Bearer '"$NOTION_API_KEY"'' \
--header 'Content-Type: application/json' \
--header 'Notion-Version: 2021-07-27' \
--data '{
    "title": [
        {
            "text": {
                "content": "Today'\''s grocery list"
            }
        }
    ],
    "properties": {
        "+1": null,
        "Photo": {
            "url": {}
        },
        "Store availability": {
            "multi_select": {
                "options": [
                    {
                        "name": "Duc Loi Market"
                    },
                    {
                        "name": "Rainbow Grocery"
                    },
                    {
                        "name": "Gus'\''s Community Market"
                    },
                    {
                        "name": "The Good Life Grocery",
                        "color": "orange"
                    }
                ]
            }
        }
    }       
}'

Example response

{
  "object": "database",
  "id": "668d797c-76fa-4934-9b05-ad288df2d136",
  "created_time": "2020-03-17T19:10:00.000Z",
  "last_edited_time": "2021-08-11T17:26:00.000Z",
  "parent": {
    "type": "page_id",
    "page_id": "48f8fee9-cd79-4180-bc2f-ec0398253067"
  },
  "title": [
    {
      "type": "text",
      "text": {
        "content": "Today'\''s grocery list",
        "link": null
      },
      "annotations": {
        "bold": false,
        "italic": false,
        "strikethrough": false,
        "underline": false,
        "code": false,
        "color": "default"
      },
      "plain_text": "Today'\''s grocery list",
      "href": null
    }
  ],
  "properties": {
    "Name": {
      "id": "title",
      "type": "title",
      "title": {}
    },
    "Description": {
      "id": "J@cS",
      "type": "rich_text",
      "rich_text": {}
    },
    "In stock": {
      "id": "{xY`",
      "type": "checkbox",
      "checkbox": {}
    },
    "Food group": {
      "id": "TJmr",
      "type": "select",
      "select": {
        "options": [
          {
            "id": "96eb622f-4b88-4283-919d-ece2fbed3841",
            "name": "🥦Vegetable",
            "color": "green"
          },
          {
            "id": "bb443819-81dc-46fb-882d-ebee6e22c432",
            "name": "🍎Fruit",
            "color": "red"
          },
          {
            "id": "7da9d1b9-8685-472e-9da3-3af57bdb221e",
            "name": "💪Protein",
            "color": "yellow"
          }
        ]
      }
    },
    "Price": {
      "id": "cU^N",
      "type": "number",
      "number": {
        "format": "dollar"
      }
    },
    "Cost of next trip": {
      "id": "p:sC",
      "type": "formula",
      "formula": {
        "value": "if(prop(\"In stock\"), 0, prop(\"Price\"))"
      }
    },
    "Last ordered": {
      "id": "]\\R[",
      "type": "date",
      "date": {}
    },
    "Meals": {
      "type": "relation",
      "relation": {
        "database": "668d797c-76fa-4934-9b05-ad288df2d136",
        "synced_property_name": null
      }
    },
    "Number of meals": {
      "id": "Z\\Eh",
      "type": "rollup",
      "rollup": {
        "rollup_property_name": "Name",
        "relation_property_name": "Meals",
        "rollup_property_id": "title",
        "relation_property_id": "mxp^",
        "function": "count"
      }
    },
    "Store availability": {
      "type": "multi_select",
      "multi_select": {
        "options": [
          [
            {
              "id": "d209b920-212c-4040-9d4a-bdf349dd8b2a",
              "name": "Duc Loi Market",
              "color": "blue"
            },
            {
              "id": "70104074-0f91-467b-9787-00d59e6e1e41",
              "name": "Rainbow Grocery",
              "color": "gray"
            },
            {
              "id": "6c3867c5-d542-4f84-b6e9-a420c43094e7",
              "name": "Gus's Community Market",
              "color": "yellow"
            },
            {
							"id": "a62fbb5f-fed4-44a4-8cac-cba5f518c1a1",
              "name": "Good life grocery",
              "color": "orange"
           }
          ]
        ]
      }
    }
    "Photo": {
      "id": "aTIT",
      "type": "url",
      "url": {}
    }
  }
}