Published on

Sentry API: Get a List of All Users in Your Organization


At work, I came across a use case where I need to list down all the accounts a particular user (search by email) has access to.

Here is how we can do it in Sentry:


We need to configure SENTRY_AUTH_TOKEN to interact with the API. We can create it easily using the Sentry dashboard.

Since an older version of node.js does not support fetch out of the box, we'll use node-fetch package

npm install node-fetch


import fetch from 'node-fetch';
const YOUR_SENTRY_ORG_ID = 'example-org';
const SENTRY_API_TOKEN = '...'; // process.env.SENTRY_API_TOKEN

async function checkSentryUserExists(email) {
    try {
        const response = await fetch(`${YOUR_SENTRY_ORG_ID}/users/`, {
            headers: {
                'Authorization': `Bearer ${SENTRY_API_TOKEN}`

        const users = await response.json();

        for (let user of users) {
            if ( === email) {
                return user; // User exists

        return null; // User does not exist

    } catch (error) {

    .then(result => {
        if (result?.id) {
            console.log(`✅ Sentry:  account exists`);
        } else {
            console.log(`❌ Sentry does not account exists`);

Happy finding users!