# Accounts ## Delete account (tenant) - [DELETE /resources/tenants/v1/{tenantId}](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv1_deletetenant.md): Remove an account (tenant) and all its users. If the account is part of a hierarchy, all sub-accounts are reassigned to the deleted account's parent. Requires an environment token obtained from the environment authentication route. ## Create an account (tenant) - [POST /resources/tenants/v1](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv1_createtenant.md): Create a new account (tenant). If an account with the given ID previously existed and was removed, this action will reactivate that account. Requires an environment token obtained from the environment authentication route. ## Delete current account (tenant) - [DELETE /resources/tenants/v1](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv1_deletecurrenttenant.md): Delete the current account (tenant) and all users belonging to that account. Only users with the fe.account-settings.delete.account permission can perform this action. A user token is required for this route and can be obtained after user authentication. ## Add account (tenant) metadata - [POST /resources/tenants/v1/{tenantId}/metadata](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv1_addtenantmetadata.md): Add metadata to an account (tenant). If a metadata key already exists, its value is overwritten. Provide the account (tenant) ID as a path parameter and the metadata object in the request body. An environment token is required for this route and can be obtained from the environment authentication route. ## Delete account (tenant) metadata - [DELETE /resources/tenants/v1/{tenantId}/metadata/{key}](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv1_deletetenantmetadata.md): Remove a key-value pair from an account's (tenant's) metadata. Provide the account (tenant) ID and the metadata key as path parameters. An environment token is required for this route and can be obtained from the environment authentication route. ## Get accounts (tenants) - [GET /resources/tenants/v2](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv2_gettenants.md): Retrieve all accounts (tenants) for an environment. Supports filtering, sorting, and pagination. You can filter by account name or account (tenant) ID, sort by createdAt, name, or tenantId, and specify the order (ASC or DESC). You can also provide specific account (tenant) IDs to retrieve only those accounts (tenants). The default limit is 50 accounts (tenants) per request; the maximum is 200. ## Get an account (tenant) - [GET /resources/tenants/v2/{tenantId}](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv2_gettenant.md): Retrieve an account (tenant) by its identifier. If the account (tenant) cannot be found, an empty array is returned. Provide the account (tenant) ID as a path parameter. An environment token is required for this route and can be obtained from the environment authentication route. ## Update an account (tenant) - [PUT /resources/tenants/v2/{tenantId}](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv2_updatetenant.md): Update an account (tenant). Provide the account (tenant) ID as a path parameter and the updated account (tenant) data in the request body. An environment token is required for this route and can be obtained from the environment authentication route. ## Get account (tenant) by ID (deprecated) - [GET /resources/tenants/v1/{tenantId}](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv1_gettenant.md): Use the V2 route for Get account (tenant). This route is no longer relevant. ## Update account (tenant) (deprecated) - [PUT /resources/tenants/v1/{tenantId}](https://developers.frontegg.com/ciam/api/tenants/accounts/tenantcontrollerv1_updatetenant.md): Use the V2 route for update account (tenant). This route is no longer relevant.