I’m having trouble with the Notion API when using JavaScript. When I query my database, I only get the id field for each property, but when I test the same request in Postman, everything works perfectly and I get all the data.
The console.log shows all my database properties as objects, but each object only contains an id field. I expected to see the actual values like I do in Postman. What am I missing here?
yeah this tripped me up too when i started. the notion js client doesnt automatically flatten the property values like postman might display them. you gotta dig deeper into each property object to get the actual data - like item.properties.PropertyName.rich_text[0]?.plain_text for text fields. each property type has diferent nested structure so check what type your dealing with first.
The Notion API returns properties as structured objects where you need to access the actual values through type-specific fields. Each property type has its own structure - for example, a title property requires accessing property.title[0].plain_text, rich text needs property.rich_text[0].plain_text, and numbers use property.number. The id you’re seeing is just the property identifier, not the actual content. You’ll need to extract values based on each property’s type. I ran into this same issue when I first started working with their API - the documentation shows the full property structure for each type. Try logging item.properties.YourPropertyName.title[0].plain_text for a title field to see the difference.
I encountered this exact frustration about six months ago when migrating from direct API calls to the official JavaScript client. The issue is that the Notion JavaScript SDK returns the raw API response structure, which includes metadata and type information for each property. When you see only the id field, you’re likely looking at the wrong level of the object hierarchy. The actual property values are nested within type-specific objects inside each property. For instance, if you have a text property called “Name”, the value would be at item.properties.Name.rich_text[0].plain_text rather than just item.properties.Name. The reason Postman appears to work differently is probably because you’re viewing the formatted JSON response, which shows the complete nested structure. I recommend adding a deeper console.log like console.log(JSON.stringify(item.properties, null, 2)) to see the full structure of your properties.