How to filter and modify table rows in Notion Page using API based on environment column?

I need to use Notion’s API to modify specific rows in a table that exists inside a Notion page. My goal is to filter rows by checking the Environment column value, then update three other columns: Last Deployed, Deployed By, and Branch Deploy.

I attempted to filter rows using this approach:

RESULT=$(curl -s -X POST "https://api.notion.com/v1/databases/$DB_ID/query" \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Notion-Version: 2022-06-28" \
  -d '{
    "filter": {
      "property": "Environment",
      "rich_text": {
        "equals": "'"$ENV_VAR"'"
      }
    }
  }')

But I think I’m using the wrong endpoint. This API call is for querying databases, but my table is embedded within a page, not a standalone database. What’s the correct way to filter and update rows in a page-embedded table? Which API endpoint should I use for this scenario?

Your database query approach is correct. Tables in Notion pages are just databases rendered inline. The problem’s probably with how you’re identifying property types. First, make a GET request to https://api.notion.com/v1/databases/$DB_ID to check the actual schema. This’ll show you if Environment is select, multi-select, title, or rich_text. I’ve seen tons of cases where something looks like plain text but it’s actually a select property. Once you know the right property type, your filter should work fine. For updates, you’ll need to loop through the returned page IDs and use PATCH requests to https://api.notion.com/v1/pages/{page_id} with the right property objects for Last Deployed, Deployed By, and Branch Deploy. Just make sure you format dates correctly if Last Deployed is a date property.

the database query endpoint works fine with inline tables. your filter’s probably the problem - check if Environment is a select property, not rich_text. try "select": {"equals": "'"$ENV_VAR"'"} in your filter. once you’ve got the page ids from the query, update them using the pages endpoint like the other person said.

The confusion comes from not understanding how Notion works. When you create a table inside a page, it’s still a database - just displayed inline instead of full-page. The API treats them the same way, so using the database query endpoint is right. Your filter syntax might be wrong though. If your Environment column has plain text, try ‘title’ instead of ‘rich_text’ in your filter. Also double-check you’re using the right database ID - grab it from the URL when you open the table in full-page view. After you filter the rows, use the PATCH endpoint for each page ID: ‘https://api.notion.com/v1/pages/{page_id}’. Your update payload needs those three target columns with their property types. Pro tip: check the exact property types in your database schema first. It’ll save you tons of debugging headaches.