How to grant page access to external users using Notion API

I’m working with the Notion API using the .NET SDK and I need to give external users access to specific pages by adding them via email. I’ve been trying to use the People property but I keep running into issues.

Here’s what I’m attempting:

var currentPage = await notionClient.Pages.RetrieveAsync(pageId);
currentPage.Properties.Add("collaborators", new PeoplePropertyValue() 
{ 
    Id = "Contributors", 
    People = userList.Results
});
await notionClient.Pages.UpdatePropertiesAsync(pageId, currentPage.Properties);

When the page has a database parent, I get this error:

Notion.Client.NotionApiException : collaborators is not a property that exists.
StatusCode: BadRequest
NotionApiErrorCode: InvalidJSON

For pages with page parents, the error is different:

Notion.Client.NotionApiException : body failed validation.
body.parent.database_id should be defined, instead was `undefined`.
body.properties.collaborators should be not present

I also tried creating new pages with people properties:

await notionClient.Pages.CreateAsync(new PagesCreateParameters()
{
    Parent = new ParentPageInput { PageId = mainPageId },
    Properties = new Dictionary<string, PropertyValue>
    {
        ["title"] = new TitlePropertyValue 
        {
            Title = new List<RichTextBase>() 
            {
                new RichTextText(){ Text = new Text() { Content = pageTitle } }
            }
        },
        ["collaborators"] = new PeoplePropertyValue()
        {
            Id = "Contributors",
            People = userList.Results
        }
    }
});

But this gives similar validation errors. Is there another approach to share pages with external users or modify access permissions for workspace members through the API?

It appears that you’re encountering validation errors due to the absence of the necessary properties in your page or database schema. Pages in Notion derive their properties from their parent database, meaning that to add a “collaborators” property, it must first be defined in the parent database schema. You can do this by either manually adding a People property to the database through the Notion interface or using the API’s database update endpoint.

For pages that are not part of a database, you’re limited to the default properties they can have, as custom properties aren’t supported in that context. To share those standalone pages with external users, you will need to use Notion’s sharing features rather than attempting to modify properties via the API, as direct manipulation of page permissions is not permitted.

you can’t add custom properties to standalone pages - only database pages support them. that’s why you’re seeing validation errors. the notion api doesn’t handle page sharing either, it just works with database schemas. use the web interface to share pages instead of trying to code it.

This happens because you’re trying to add properties that don’t exist in your schema. The ‘collaborators’ property needs to be set up in the parent database first - you can’t just create new properties on the fly through the API.

Also, the Notion API can’t modify page permissions or invite users directly. Those People properties you’re working with only track people in existing schemas - they don’t actually grant access.

Here’s what works: Create the People property in your database through Notion’s UI first, then use the API to update those fields. For actual sharing, you’ll have to send invites through Notion’s web interface or manage workspace members if your users are already in the workspace.