---
title: "Create Tenant"
method: POST
path: "/v2/facts/{proj_id}/{env_id}/tenants"
tags: ["Tenants"]
---

# Create Tenant

`POST /v2/facts/{proj_id}/{env_id}/tenants`

Creates a new tenant inside the Permit.io system.

If the tenant is already created: will return 200 instead of 201,
and will return the existing tenant object in the response body.

## Path parameters

- `proj_id` string, required — Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").
- `env_id` string, required — Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").

## Request body

- TenantCreate
  - `key` string, required — A unique id by which Permit will identify the tenant. The tenant key must be url-friendly (slugified).
  - `name` string, required — A descriptive name for the tenant
  - `description` string — an optional longer description of the tenant
  - `attributes` object — Arbitraty tenant attributes that will be used to enforce attribute-based access control policies.

## Response `200`

Successful Response

- TenantRead
  - `key` string, required — A unique id by which Permit will identify the tenant. The tenant key must be url-friendly (slugified).
  - `id` string, uuid, required — Unique id of the tenant
  - `organization_id` string, uuid, required — Unique id of the organization that the tenant belongs to.
  - `project_id` string, uuid, required — Unique id of the project that the tenant belongs to.
  - `environment_id` string, uuid, required — Unique id of the environment that the tenant belongs to.
  - `created_at` string, date-time, required — Date and time when the tenant was created (ISO_8601 format).
  - `updated_at` string, date-time, required — Date and time when the tenant was last updated/modified (ISO_8601 format).
  - `last_action_at` string, date-time, required — Date and time when the tenant was last active (ISO_8601 format). In other words, this is the last time a permission check was done on a resource belonging to this tenant.
  - `name` string, required — A descriptive name for the tenant
  - `description` string — an optional longer description of the tenant
  - `attributes` object — Arbitraty tenant attributes that will be used to enforce attribute-based access control policies.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/permit/apis/permit-io-api.md) · [All operations](https://skmtc.net/permit/apis/permit-io-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/permit/permit-io-api/versions/dd6be355a62e/schema)
