# Tenant

Manage tenant settings.

## Get a list of tenants.

> Retrieve a list of tenants and their details.

```json
{"openapi":"3.0.3","info":{"title":"NVIDIA Run:ai","version":"2.24"},"tags":[{"name":"Tenant","description":"Manage tenant settings."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"deleted":{"name":"deleted","in":"query","description":"Include soft-deleted tenants in the response when `true`.","schema":{"type":"boolean","default":false}}},"schemas":{"Tenants":{"type":"array","items":{"$ref":"#/components/schemas/Tenant"}},"Tenant":{"type":"object","required":["id","uuid","name","status","contractType","createdAt","updatedAt","smg"],"properties":{"id":{"$ref":"#/components/schemas/TenantId"},"mimirId":{"type":"string"},"uuid":{"type":"string","format":"uuid","description":"The universally unique identifier of the tenant."},"name":{"type":"string","description":"The internal system name of the tenant."},"displayName":{"type":"string","description":"The name of the tenant as shown to users within the tenant."},"smg":{"type":"boolean"},"status":{"type":"string","enum":["Creating","Failed","Updating","Deleted","Deleting","Ready"],"description":"The current status of the tenant.\nPossible values:\n- Creating\n- Failed\n- Updating\n- Deleted\n- Deleting\n- Ready\n"},"createdAt":{"type":"string","format":"date-time","description":"The date and time when the tenant was created."},"updatedAt":{"type":"string","format":"date-time","description":"The date and time when the tenant was last updated."},"contractType":{"type":"string","enum":["normal","trial"]},"eula":{"type":"string","description":"The signer details for the tenant's EULA (End User License Agreement)."}}},"TenantId":{"description":"The id of the tenant.","type":"integer","format":"int32"},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"400BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500InternalServerError":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/tenants":{"get":{"summary":"Get a list of tenants.","description":"Retrieve a list of tenants and their details.","operationId":"get_tenants","tags":["Tenant"],"parameters":[{"$ref":"#/components/parameters/deleted"}],"responses":{"200":{"description":"Executed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenants"}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## POST /api/v1/tenants

> Create tenant

```json
{"openapi":"3.0.3","info":{"title":"NVIDIA Run:ai","version":"2.24"},"tags":[{"name":"Tenant","description":"Manage tenant settings."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"TenantCreationRequest":{"type":"object","required":["name","email"],"properties":{"name":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$","description":"The name of the tenant.","minLength":2,"maxLength":255},"email":{"type":"string","pattern":"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$","description":"The email of the tenant's admin user.","minLength":5,"maxLength":254},"password":{"type":"string","description":"The password for the tenant's admin user. Must contain at least 1 special character, 1 uppercase letter, 1 lowercase letter, 1 digit, and be at least 8 characters long.","minLength":8,"maxLength":255},"contractType":{"type":"string","enum":["normal","trial",""]},"role":{"$ref":"#/components/schemas/Roles"},"metricStore":{"writeOnly":true,"nullable":true,"type":"object","allOf":[{"$ref":"#/components/schemas/MetricStore"}]}}},"Roles":{"type":"string","description":"The role assigned to the tenant's admin user. Possible value: System administrator.","nullable":true,"enum":["System administrator","Cloud operator"]},"MetricStore":{"required":["read","write"],"type":"object","properties":{"read":{"$ref":"#/components/schemas/MetricStoreEndpoint"},"write":{"$ref":"#/components/schemas/MetricStoreEndpoint"}}},"MetricStoreEndpoint":{"required":["url"],"type":"object","properties":{"url":{"type":"string","format":"uri","minLength":1,"maxLength":2048},"auth":{"nullable":true,"type":"object","properties":{"basic":{"nullable":true,"type":"object","properties":{"username":{"type":"string","minLength":1,"maxLength":255},"password":{"type":"string","minLength":1,"maxLength":500}}}}},"headers":{"nullable":true,"type":"object","additionalProperties":{"type":"string","maxLength":1000},"minProperties":0,"maxProperties":50}}},"TenantCreationResponse":{"type":"object","required":["tenant"],"properties":{"tenant":{"$ref":"#/components/schemas/Tenant"},"additionalData":{"description":"additional data for tenant creation","type":"object","nullable":true}}},"Tenant":{"type":"object","required":["id","uuid","name","status","contractType","createdAt","updatedAt","smg"],"properties":{"id":{"$ref":"#/components/schemas/TenantId"},"mimirId":{"type":"string"},"uuid":{"type":"string","format":"uuid","description":"The universally unique identifier of the tenant."},"name":{"type":"string","description":"The internal system name of the tenant."},"displayName":{"type":"string","description":"The name of the tenant as shown to users within the tenant."},"smg":{"type":"boolean"},"status":{"type":"string","enum":["Creating","Failed","Updating","Deleted","Deleting","Ready"],"description":"The current status of the tenant.\nPossible values:\n- Creating\n- Failed\n- Updating\n- Deleted\n- Deleting\n- Ready\n"},"createdAt":{"type":"string","format":"date-time","description":"The date and time when the tenant was created."},"updatedAt":{"type":"string","format":"date-time","description":"The date and time when the tenant was last updated."},"contractType":{"type":"string","enum":["normal","trial"]},"eula":{"type":"string","description":"The signer details for the tenant's EULA (End User License Agreement)."}}},"TenantId":{"description":"The id of the tenant.","type":"integer","format":"int32"},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"400BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404NotFound":{"description":"The specified resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409Conflict":{"description":"The specified resource already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500InternalServerError":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/tenants":{"post":{"summary":"Create tenant","operationId":"create_tenant","tags":["Tenant"],"requestBody":{"description":"The tenant to create.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantCreationRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantCreationResponse"}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"404":{"$ref":"#/components/responses/404NotFound"},"409":{"$ref":"#/components/responses/409Conflict"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## GET /api/v1/tenants/{tenantId}

> Get tenant

```json
{"openapi":"3.0.3","info":{"title":"NVIDIA Run:ai","version":"2.24"},"tags":[{"name":"Tenant","description":"Manage tenant settings."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"tenantId":{"name":"tenantId","in":"path","required":true,"description":"The id of the tenant to retrieve","schema":{"type":"integer","format":"int32","minimum":0}}},"schemas":{"Tenant":{"type":"object","required":["id","uuid","name","status","contractType","createdAt","updatedAt","smg"],"properties":{"id":{"$ref":"#/components/schemas/TenantId"},"mimirId":{"type":"string"},"uuid":{"type":"string","format":"uuid","description":"The universally unique identifier of the tenant."},"name":{"type":"string","description":"The internal system name of the tenant."},"displayName":{"type":"string","description":"The name of the tenant as shown to users within the tenant."},"smg":{"type":"boolean"},"status":{"type":"string","enum":["Creating","Failed","Updating","Deleted","Deleting","Ready"],"description":"The current status of the tenant.\nPossible values:\n- Creating\n- Failed\n- Updating\n- Deleted\n- Deleting\n- Ready\n"},"createdAt":{"type":"string","format":"date-time","description":"The date and time when the tenant was created."},"updatedAt":{"type":"string","format":"date-time","description":"The date and time when the tenant was last updated."},"contractType":{"type":"string","enum":["normal","trial"]},"eula":{"type":"string","description":"The signer details for the tenant's EULA (End User License Agreement)."}}},"TenantId":{"description":"The id of the tenant.","type":"integer","format":"int32"},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"400BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500InternalServerError":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/tenants/{tenantId}":{"get":{"summary":"Get tenant","operationId":"get_tenant_by_id","tags":["Tenant"],"parameters":[{"$ref":"#/components/parameters/tenantId"}],"responses":{"200":{"description":"Executed successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tenant"}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## DELETE /api/v1/tenants/{tenantId}

> soft/hard delete tenant

```json
{"openapi":"3.0.3","info":{"title":"NVIDIA Run:ai","version":"2.24"},"tags":[{"name":"Tenant","description":"Manage tenant settings."}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"tenantId":{"name":"tenantId","in":"path","required":true,"description":"The id of the tenant to retrieve","schema":{"type":"integer","format":"int32","minimum":0}},"isHardDelete":{"name":"isHardDelete","in":"query","description":"Boolean indicator for soft/hard delete","schema":{"type":"boolean"}}},"responses":{"400BadRequest":{"description":"Bad request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401Unauthorized":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403Forbidden":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404NotFound":{"description":"The specified resource was not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500InternalServerError":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/api/v1/tenants/{tenantId}":{"delete":{"summary":"soft/hard delete tenant","operationId":"delete_tenant_by_id","tags":["Tenant"],"parameters":[{"$ref":"#/components/parameters/tenantId"},{"$ref":"#/components/parameters/isHardDelete"}],"responses":{"200":{"description":"tenant uid that was deleted.","content":{"application/json":{"schema":{"type":"object","required":["uid"],"properties":{"uid":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"404":{"$ref":"#/components/responses/404NotFound"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```
