> ## Documentation Index
> Fetch the complete documentation index at: https://pipedream.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Allowed email domains

> Restrict Connect account connections to accounts whose email belongs to domains you allow

An email domain allowlist lets you control which accounts your end users can connect. When an allowlist is set, Pipedream only lets an account connect if the account's email address belongs to one of the allowed domains.

For example, if your customer only wants their employees to connect company-owned accounts, you can allow `example.com`. An end user who tries to connect a personal account like `jane@gmail.com` can't complete the connection.

## How the check works

When an end user connects an account, Pipedream makes a test request to the app to verify the credentials. For many apps, that test request also returns the email address of the connected account.

If your workspace or project has an allowlist, Pipedream compares the domain of that email address against the allowed domains:

* **The domain is allowed**: the account connects as usual.
* **The domain isn't allowed**: Pipedream rejects the connection.
* **The app doesn't return an email**: Pipedream rejects the connection by default. See [Apps that don't return an email](#apps-that-dont-return-an-email).

Pipedream compares domains case-insensitively, and the domain must match an allowed domain exactly. Subdomains don't inherit from their parent domain. For example, allowing `example.com` doesn't allow `eng.example.com`. Add each subdomain you want to allow to the list.

## Configure allowed domains

You can set an allowlist on your workspace, on a project, or on both. If both have one, the account's email domain must be on both lists to connect.

### Set the workspace allowlist

The workspace allowlist applies to every project in the workspace. Only workspace admins and owners can change it.

**1. Open your workspace's General settings**

In the [Pipedream UI](https://connect.pipedream.com), open **Settings → General**. You can also press **⌘K** and search for **Allowed domains**.

**2. Add your domains**

Under **Allowed email domains for connected accounts**, type a domain in the **Domains** field and press **Enter**, **Tab**, or a comma. You can also paste a list of domains separated by commas, spaces, semicolons, or new lines.

Enter only the domain, like `example.com`. The field refuses wildcards (`*.example.com`), email addresses, and URLs.

**3. Choose how to handle accounts without an email**

Turn on **Allow accounts without an email** to let apps that don't return an account email connect. This is the same as `skip_missing_email`. See [Apps that don't return an email](#apps-that-dont-return-an-email).

**4. Save**

Click **Save allowed domains**. The allowlist takes effect immediately.

![Workspace General settings with acme.com and eng.acme.com in the Domains field and the Allow accounts without an email switch turned off](https://mintcdn.com/pipedream/Rjy7nuE52Ay2uAyn/images/connect-allowed-domains-workspace.png?fit=max\&auto=format\&n=Rjy7nuE52Ay2uAyn\&q=85\&s=02ee9633f54b71643599bbfb51eabff2)

To remove the workspace allowlist, remove every domain and save. With no domains listed, end users can connect accounts with any email domain.

### Set a project allowlist

A project allowlist narrows the workspace allowlist for one project. Any workspace member who can edit the project can change it.

1. Open the project, then open **Configuration → General**.
2. Under **Allowed email domains for connected accounts**, add domains to the **Domains** field.
3. Set **Allow accounts without an email**, then click **Save allowed domains**.

If your workspace has an allowlist, the **Domains** field lists only the workspace's domains, and you pick from that list. You can't add a domain that isn't on the workspace list, because accounts with that domain can't connect. If you leave the project list empty, the project uses the full workspace list.

![Project General settings with the Domains picker open, listing the workspace domains acme.com and eng.acme.com, with acme.com selected](https://mintcdn.com/pipedream/Rjy7nuE52Ay2uAyn/images/connect-allowed-domains-project.png?fit=max\&auto=format\&n=Rjy7nuE52Ay2uAyn\&q=85\&s=b31292e1dea315fc5ca11ecb14da29d6)

If your workspace has no allowlist, you type domains into the project's field the same way as on the workspace.

> [!NOTE]
>
> If the workspace doesn't allow accounts without an email, the project's **Allow accounts without an email** switch is locked off and shows **Set by workspace**. Pipedream checks the workspace and project settings separately, so an account without an email can connect only if both allow it.

### Use the API

You can also set `allowed_email_domains` on a project with the [Update Project](https://pipedream.com/docs/connect/api-reference/update-project.md) endpoint:

```sh theme={null}
curl -X PATCH https://api.pipedream.com/v1/connect/projects/{project_id} \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "allowed_email_domains": ["example.com", "acme.com"]
  }'
```

Get `{access_token}` by [creating an OAuth token](https://pipedream.com/docs/connect/api-reference/create-oauth-token.md) with your Pipedream OAuth client credentials.

Set `allowed_email_domains` to `null` to remove the project allowlist.

## Apps that don't return an email

Some apps don't return an account email in their test request. This includes most apps that authenticate with an API key. With an allowlist in place, Pipedream can't verify these accounts, so it rejects them by default.

To let end users connect these apps anyway, turn on **Allow accounts without an email** in the workspace or project settings. See [Configure allowed domains](#configure-allowed-domains). If both the workspace and the project have an allowlist, turn it on in both.

With the API, set `skip_missing_email` to `true` on the project with the [Update Project](https://pipedream.com/docs/connect/api-reference/update-project.md) endpoint:

```sh theme={null}
curl -X PATCH https://api.pipedream.com/v1/connect/projects/{project_id} \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "skip_missing_email": true
  }'
```

When `skip_missing_email` is `true`, Pipedream skips the domain check for accounts that don't return an email and lets them connect. Accounts that do return an email are still checked against the allowlist.

## Errors

When Pipedream rejects a connection, the end user sees an error in the Connect flow. If you passed a `webhook_uri` when you [created the Connect token](https://pipedream.com/docs/connect/managed-auth/tokens.md), Pipedream also sends a `CONNECTION_ERROR` event to your [connection webhook](https://pipedream.com/docs/connect/webhooks.md#connection-webhooks).

| Reason | Error message |
| - | - |
| The email domain isn't allowed | `This account's email domain is not allowed by the organization or project.` |
| The app didn't return an account email | `This app did not return an account email. An account email is required by the organization or project domain allowlist.` |

For example:

```json theme={null}
{
  "event": "CONNECTION_ERROR",
  "connect_token": "ctok_xxxxxxx",
  "environment": "production",
  "connect_session_id": 1.4058727315359677e+38,
  "error": "This account's email domain is not allowed by the organization or project."
}
```

## Limitations

> [!WARNING]
>
> The email domain allowlist is a best-effort control, not a guarantee. It relies on the email address the app reports for the account.

Keep these limits in mind:

* **Pipedream checks the email periodically, not on every request.** Pipedream runs the check when the account connects, and again when it refreshes the account's credentials in the background. Background refreshes happen at least once an hour, typically on a schedule based on when the app's access token expires.
* **Some apps let users change their account email.** If an end user changes an account's email to a domain that isn't allowed, the account keeps working until Pipedream's next background refresh. If an app lets users change their email freely, don't rely on the allowlist for that app.
* **An email domain doesn't prove ownership.** An account with an allowed email domain isn't necessarily managed or authorized by the organization that owns the domain.
* **`skip_missing_email` bypasses the check.** Accounts for apps that don't return an email connect without any domain verification.
