# TENANT.CREATE

> Register a tenant with an ID, a display name and optional quota values.

URL: https://docs.hotkv.com/commands/tenant-create/

```
TENANT.CREATE id name [MAX_MEMORY bytes] [MAX_KEYS count] [MAX_CONNECTIONS count] [MAX_COMMANDS_SEC count] [MAX_DATABASES count] [MAX_EGRESS bytes]
```

- Group: Tenancy
- Complexity: O(1)
- HotKV Cloud: Scale plan
- On-Premise: requires the multi-tenancy license feature


`TENANT.CREATE` adds a tenant to the server's tenant registry. A tenant has
an ID, a display name, a state (`active` when created), a set of quota
values and a list of bound users (see [TENANT.BIND](https://docs.hotkv.com/commands/tenant-bind/index.md)).
The registry is the same on every node of a cluster: a change made on one
node reaches the others, and it is saved with the data and replicated.

A server holds up to 256 tenants.

> **Note**
> The quota values are informational: HotKV records them with the tenant and
> shows them in [TENANT.STATS](https://docs.hotkv.com/commands/tenant-stats/index.md), but it does not
> enforce them on client commands. Keep each tenant's users to their own keys
> with ACL rules.

## Options

| Option | Meaning | Default |
| --- | --- | --- |
| `MAX_MEMORY bytes` | Memory limit | 0 (unlimited) |
| `MAX_KEYS count` | Key limit | 0 (unlimited) |
| `MAX_CONNECTIONS count` | Connection limit | 0 (unlimited) |
| `MAX_COMMANDS_SEC count` | Commands per second | 0 (unlimited) |
| `MAX_DATABASES count` | Databases | 16 |
| `MAX_EGRESS bytes` | Outgoing traffic limit | 0 (unlimited) |

Option names are not case sensitive. A value that is not a non-negative
integer is ignored and the default stays, and so are unknown options.

## Return value

Simple string `OK` in RESP2 and RESP3, or one of these errors:

| Case | Error |
| --- | --- |
| The ID exists, or 256 tenants already exist | `ERR tenant already exists or limit reached` |
| A limit value that is not a number | `ERR invalid OPTION value`, with the option's name, for example `ERR invalid MAX_KEYS value` |
| An option the command does not know | `ERR unknown option 'name'` |
| An option without a value | `ERR syntax error` |
| No license that includes `multi-tenancy` | `NOLICENSE multi-tenancy requires a HotKV license. Contact sales@hotkv.com` |

In each of these cases the tenant is not created.

## Examples

```
127.0.0.1:6379> TENANT.CREATE acme "Acme Corp" MAX_MEMORY 1073741824 MAX_KEYS 1000000
OK
127.0.0.1:6379> TENANT.CREATE acme "Acme again"
(error) ERR tenant already exists or limit reached
```

## Compatibility

HotKV-only command.

## See also

[TENANT.INFO](https://docs.hotkv.com/commands/tenant-info/index.md), [TENANT.BIND](https://docs.hotkv.com/commands/tenant-bind/index.md),
[TENANT.DROP](https://docs.hotkv.com/commands/tenant-drop/index.md), [TENANT.LIST](https://docs.hotkv.com/commands/tenant-list/index.md)