Skip to main content

It’s always bugged me that Notion’s official Zapier integration doesn’t provide a way to retrieve someone’s user ID using their email address. You can only retrieve a user by their ID, but often, all you have is their email address.

The reason for this is probably that Notion’s API doesn’t directly support retrieval of a user by their email address; you can only either list all users, or retrieve a single user by their ID.

Fortunately, Custom Actions provides a workaround, since it can combine API calls with light filtering to pull this off in a single action. It’s dead simple to use, and just requires a single input - the email address of the user whose ID you want to retrieve:

 

If you don’t want to use the AI Copilot builder in Custom Actions, you can just paste this into the Code box under the Advanced tab:

// Define an async function to retrieve all users in a Notion workspace
export async function getUsersByEmail(params: { email: string }): Promise<{ result: any[] }> {
// Extract the email from the input object
const { email } = params;

// Define the URL for the Notion API endpoint to list all users
const url = 'https://api.notion.com/v1/users';

// Use fetchWithZapier to make the API request
const response = await fetchWithZapier(url, {
method: 'GET',
headers: {
'Notion-Version': '2025-09-03' // Specify the Notion API version
}
});

// Throw an error if the response is not OK
await response.throwErrorIfNotOk();

// Parse the JSON response
const data = await response.json();

// Filter the users by the provided email address
const filteredUsers = data.results.filter((user: any) => {
return user.type === 'person' && user.person.email === email;
});

// Return the filtered users in a result property
return { result: filteredUsers };
}

This is fantastic ​@DennisWF! 🙌 Thanks so much for sharing this with the community - love it! 😍