I’m working with the Notion API to get info from a database. The problem is I’m not getting all the properties I expect. My database has 23 properties, but when I use the API to list or query it, I only see 16 or 14 properties. What’s going on with the missing ones?
Here’s a bit of my code:
class NotionFetcher:
def __init__(self):
self.client = None
self.db_list = {}
self.page_ids = []
def setup(self):
config = self.load_config()
self.client = Client(auth=config['api_key'])
def get_databases(self):
dbs = self.client.databases.list()
for db in dbs['results']:
print(db['title'][0]['plain_text'])
self.db_list[db['title'][0]['plain_text']] = db['id']
def fetch_db_pages(self, db_name):
pages = self.client.databases.query(database_id=self.db_list[db_name])
for page in pages['results']:
self.page_ids.append(page['id'])
I’ve tried listing databases and querying pages, but I’m still not seeing all 23 properties. Any ideas why some are missing?
I’ve faced this exact problem before. It’s frustrating, but there’s a reason for it. Notion’s API has a limit on the number of properties it returns by default. To get all 23 properties, you need to explicitly request them.
Try modifying your code to use the ‘retrieve_database’ method instead of ‘list’ or ‘query’. Then, specify all the property names you want in the ‘properties’ parameter. Something like this:
database = self.client.databases.retrieve(database_id=db_id, properties=['prop1', 'prop2', ...])
This should fetch all your properties. If you’re still missing some, double-check your integration’s permissions in the Notion workspace settings. Sometimes, certain properties are hidden due to access restrictions.
I’ve encountered a similar issue when working with the Notion API.
My experience showed that this behavior is often related to how Notion manages property visibility and permissions. Some properties might be hidden or have restricted access, which means they won’t appear in API responses unless the correct permissions are in place.
It can help to review your integration’s permissions in the Notion workspace. Additionally, try explicitly requesting all properties in your API call and use the ‘retrieve database’ endpoint, as it might return more complete data. If these approaches do not resolve the issue, reaching out to Notion support could provide further clarification on these quirks.
hey, i’ve run into this too. notion’s api can be tricky sometimes. have you tried using the ‘retrieve_database’ endpoint? it usually gives more complete info. also, check ur integration permissions in notion - some properties might be hidden. if that doesn’t work, u could try paginating through the results to see if more properties show up. good luck!