Setting up API calls to insert records into Notion database

Hey everyone! I’m new here and could really use some help. I’ve been working on adding entries to my Notion database through their API but keep running into issues.

I have my database ID ready and I’m trying to create a new record with an activity name and set a dropdown field called “Project Status” to “In Progress”. Here’s what I’m attempting:

{
  "parent": { "type": "database_id", "database_id": "abc123" },
  
  "properties": {
    "Activity": {
      "type": "title", 
      "title": [{ "type": "text", "text": { "content": "API test entry" } }]
    },
    "Project Status": {
      "type": "select",
      "select": { "name": "In Progress" }
    }
  }
}

I keep getting this JSON parsing error and I can’t figure out what’s wrong with my structure. After fixing some syntax issues I’m now seeing a validation error saying the select property isn’t properly defined.

Any ideas what I’m missing here? Really appreciate any help!

I faced similar issues while using Notion’s API initially. The error could be because the “In Progress” option you are trying to use in the “Project Status” select field might not exist in your database. Notion requires an exact match for select property names. It’s helpful to perform a GET request to confirm the available select options in your database. If “In Progress” is not listed, you may need to create it directly in Notion or use an existing option. Furthermore, ensure you include all necessary headers, especially the Authorization bearer token and Content-Type set to application/json, as any missing headers can result in unusual parsing errors. Lastly, double-check the format of your database ID; it should be a 32-character hex string from your database URL, free of dashes.

Yeah, this tripped me up too! Check that your bearer token has insert permissions for that database. Sometimes it’ll read fine but can’t write if you didn’t set up the permissions right. Try posting just the title first to see if it’s the select field causing issues.

Your JSON looks mostly right. I hit the exact same validation error with Notion’s API last month - turns out I wasn’t including the Notion-Version header. Add Notion-Version: 2022-06-28 to your headers with your auth token.

Also, some databases have required properties that aren’t obvious. Do a GET request to /v1/databases/{database_id} first to check the schema and see what’s actually required. I’ve been burned by hidden required fields that need values even for basic inserts.

Double-check your database ID too - make sure it’s the raw 32-character string from the URL, not the one with dashes.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.