# Restrict Sign-ups and Organization Creation

Source: https://agenta.ai/docs/self-host/access-control/restrict-organization-creation

By default, anyone who can reach your Agenta instance can sign up. Without a paid license key, the instance has one organization, and new people join it by invitation. This guide shows how to control who can sign up and who can create organizations. All settings on this page work on every plan.

## One organization without a paid key

An instance without a paid [license key](https://agenta.ai/docs/self-host/reference/license-keys.md) can have 1 organization. This applies with no key and with the free key.

- The first person who signs up gets the organization, as long as the settings below allow them to create one.
- After that, a person who signs up is signed up with no organization. They see "You are not in an organization yet" and "This instance has one organization. Ask its admin to invite you." An organization admin invites them, as in [How restricted users join](#how-restricted-users-join).
- Creating a second organization is refused. The app says "A second organization needs an Enterprise license. To work with the people already here, ask the owner of an existing organization to invite you."

An instance that already had more than one organization before the upgrade to v0.131.1 keeps them all. Only new ones are refused.

A paid key removes this limit. The settings below still apply on top of it, with or without a key.

## Restrict who can create organizations

Set `AGENTA_ACCESS_ALLOWED_OWNER_EMAILS` to a comma-separated list of emails allowed to create organizations:

```bash
AGENTA_ACCESS_ALLOWED_OWNER_EMAILS=admin@company.com,ops@company.com
```

When this variable is set, only the listed emails get an organization on signup and can create new ones. Everyone else must be invited to an existing organization. When it is not set, any user who signs up gets their own organization (the default), as long as the instance is below its organization limit. Without a paid key, only the first person who signs up gets one. See [One organization without a paid key](#one-organization-without-a-paid-key).

The legacy names `AGENTA_ORG_CREATION_ALLOWLIST` and `AGENTA_ACCESS_ORG_CREATION_ALLOWLIST` are still parsed as aliases.

:::caution First user must be in the allowlist
The first user to sign up needs to be in the allowlist. Otherwise, they will not be able to create the initial organization.
:::

To cap how many organizations one user can own, set `AGENTA_ACCESS_MAX_OWNED_ORGANIZATIONS`:

```bash
AGENTA_ACCESS_MAX_OWNED_ORGANIZATIONS=3
```

A user who already owns that many organizations cannot create another one until they delete one. Organizations the user joined by invitation do not count. When the variable is not set, there is no limit.

## Restrict who can sign up

To limit sign-ups to your own domains, set `AGENTA_ACCESS_ALLOWED_DOMAINS`:

```bash
AGENTA_ACCESS_ALLOWED_DOMAINS=company.com
```

Subdomains match too (`user@team.company.com` is allowed by `company.com`). Any email outside the listed domains is denied at sign-in and sign-up.

To block specific addresses or domains instead, use the block lists:

```bash
AGENTA_ACCESS_BLOCKED_EMAILS=spammer@example.com
AGENTA_ACCESS_BLOCKED_DOMAINS=example.org
```

Blocked domains match their subdomains too (`user@mail.example.org` is blocked by `example.org`). A user on a blocked domain also cannot create new organizations, even with a session that started before the block.

When `AGENTA_ACCESS_ALLOWED_DOMAINS` is set, the block lists for domains are not consulted; the allowlist wins.

Restart your Agenta deployment after changing any of these variables.

## How restricted users join

Users who pass the sign-up checks but are not allowed to create an organization can still sign in. They have no organization until someone invites them:

1. As an organization member with invite rights, go to **Settings > Members**, click **Invite members**, enter their email, and click **Send invitation**.
2. The user accepts the invitation and becomes a member of that organization.

With a paid key, you can also enable auto-join for a verified domain from **Settings > Access & Security**, so users from that domain join the organization automatically on signup.

## Reference

| Variable | Effect |
|---|---|
| `AGENTA_ACCESS_ALLOWED_OWNER_EMAILS` | Only listed emails can create organizations |
| `AGENTA_ACCESS_MAX_OWNED_ORGANIZATIONS` | Most organizations one user can own. The limit of 1 organization per instance without a paid key applies too |
| `AGENTA_ACCESS_ALLOWED_DOMAINS` | Only listed domains (and subdomains) can sign up |
| `AGENTA_ACCESS_BLOCKED_DOMAINS` | Listed domains cannot sign up |
| `AGENTA_ACCESS_BLOCKED_EMAILS` | Listed emails cannot sign up |

See the [configuration reference](https://agenta.ai/docs/self-host/reference/configuration.md) for the full list of environment variables.
