ื“ืœื’ ืœืชื•ื›ืŸ ื”ืจืืฉื™

Tenant Endpoints

Manage tenants, tenant settings, and tenant API keys. Tenants are the top-level isolation boundary in Ever Gauzy โ€” all data is scoped to a tenant.

Base Pathsโ€‹

ResourcePath
Tenant/api/tenant
Tenant Setting/api/tenant-setting
Tenant API Key/api/tenant-api-key

Tenantโ€‹

Get Current Tenantโ€‹

Retrieves the tenant for the currently authenticated user.

GET /api/tenant
Authorization: Bearer {token}

Response 200 OK:

{
"id": "uuid",
"name": "My Company",
"logo": "https://...",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}

Create Tenantโ€‹

Creates a new tenant. The user who creates the tenant is assigned the SUPER_ADMIN role. A user can only create one tenant โ€” if the user already has a tenantId or roleId, a 400 Bad Request is returned.

POST /api/tenant
Authorization: Bearer {token}
Content-Type: application/json

{
"name": "New Company",
"logo": "https://..."
}

Response 201 Created.

Update Tenantโ€‹

Updates the current tenant. Requires SUPER_ADMIN role.

PUT /api/tenant
Authorization: Bearer {token}
Content-Type: application/json

{
"name": "Updated Company Name"
}

Response 202 Accepted.

Delete Tenantโ€‹

Deletes the current tenant. Requires SUPER_ADMIN role. This is a destructive operation that removes all organization data.

DELETE /api/tenant
Authorization: Bearer {token}

Response 200 OK.

Tenant Settingsโ€‹

Tenant settings store global configuration values for a tenant (e.g., date format, currency, file storage provider).

Get Tenant Settingsโ€‹

GET /api/tenant-setting
Authorization: Bearer {token}

Update Tenant Settingsโ€‹

POST /api/tenant-setting
Authorization: Bearer {token}
Content-Type: application/json

{
"name": "SETTING_KEY",
"value": "setting_value"
}

Tenant API Keysโ€‹

Tenant API keys provide programmatic access to the API without user authentication. See Tenant API Keys for security details.

List API Keysโ€‹

GET /api/tenant-api-key
Authorization: Bearer {token}

Create API Keyโ€‹

POST /api/tenant-api-key
Authorization: Bearer {token}
Content-Type: application/json

{
"name": "CI/CD Integration Key",
"expiresAt": "2025-12-31T00:00:00.000Z"
}

Delete API Keyโ€‹

DELETE /api/tenant-api-key/:id
Authorization: Bearer {token}

Data Modelโ€‹

interface ITenant {
id: string;
name: string;
logo?: string;
createdAt: Date;
updatedAt: Date;
}

interface ITenantSetting {
id: string;
name: string;
value: string;
tenantId: string;
}

interface ITenantApiKey {
id: string;
name: string;
apiKey: string; // Hashed in DB
tenantId: string;
expiresAt?: Date;
}

Permissionsโ€‹

ActionRequired Role/Permission
Get tenantAuthenticated user
Create tenantAuthenticated (no existing tenant)
Update/Delete tenantSUPER_ADMIN
Manage tenant settingsSUPER_ADMIN
Manage API keysSUPER_ADMIN