# Departments

Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. A Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended that a Department's quota be the total, or more than of all the Project quotas in the Department. For further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).

## Get departments

> list departments

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"DepartmentsFilterBy":{"name":"filterBy","in":"query","required":false,"description":"Filter results by a parameter. Use the format field-name operator value. Operators are == Equals, != Not equals, <= Less than or equal, >= Greater than or equal, =@ contains, !@ Does not contains, =^ Starts with and =$ Ends with. Dates are in ISO 8601 timestamp format and available for operators ==, !=, <= and >=.","schema":{"type":"array","items":{"type":"string","pattern":"^(name|clusterId|totalGpuQuota|gpuAllocated|createdAt|avgGpuAllocation24h|avgGpuUtilization24h|avgGpuAllocation7d|avgGpuUtilization7d|avgGpuAllocation30d|avgGpuUtilization30d)(==|!=|<=|>=|=@|!@|=\\^|=\\$).+$"}},"explode":false},"DepartmentsSortBy":{"name":"sortBy","in":"query","required":false,"description":"Sort results by a parameters.","schema":{"$ref":"#/components/schemas/DepartmentFilterSortFields"}},"DepartmentsVerbosity":{"name":"verbosity","in":"query","required":false,"description":"Departments verbosity. If it is set to \"verbose\", status will be returned. If it is not defined or set to \"brief\" only unit specific data will be returned.","schema":{"$ref":"#/components/schemas/Verbosity"}},"SortOrder":{"name":"sortOrder","in":"query","required":false,"description":"Sort results in descending or ascending order.","schema":{"type":"string","enum":["asc","desc"],"default":"asc"}},"Offset":{"name":"offset","in":"query","required":false,"description":"The offset of the first item returned in the collection.","schema":{"type":"integer","format":"int32"}},"Limit":{"name":"limit","in":"query","required":false,"description":"The maximum number of entries to return.","schema":{"type":"integer","format":"int32","default":50,"minimum":1,"maximum":500}}},"schemas":{"DepartmentFilterSortFields":{"type":"string","enum":["name","clusterId","totalGpuQuota","gpuAllocated","createdAt","avgGpuAllocation24h","avgGpuUtilization24h","avgGpuAllocation7d","avgGpuUtilization7d","avgGpuAllocation30d","avgGpuUtilization30d"]},"Verbosity":{"type":"string","enum":["meta","brief","verbose"]},"DepartmentForList":{"allOf":[{"$ref":"#/components/schemas/DataDepartmentFields"},{"type":"object","required":["id","createdAt","updatedAt","totalResources"],"properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"children":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/DepartmentProjectChild"}},"status":{"type":"object","nullable":true,"properties":{"quotaStatus":{"$ref":"#/components/schemas/QuotaStatus"}}},"totalResources":{"$ref":"#/components/schemas/TotalResources","nullable":true}}}]},"DataDepartmentFields":{"allOf":[{"$ref":"#/components/schemas/DataUpdatableDepartmentFields"},{"type":"object","required":["name","clusterId"],"properties":{"name":{"type":"string"},"clusterId":{"$ref":"#/components/schemas/ClusterId"},"overtimeData":{"$ref":"#/components/schemas/OvertimeData"}}}]},"DataUpdatableDepartmentFields":{"type":"object","description":"Updatable fields","required":["resources"],"properties":{"description":{"type":"string","description":"department's description"},"resources":{"type":"array","items":{"$ref":"#/components/schemas/Resources"},"description":"Resources assigned to this Organization per Node Pool"},"schedulingRules":{"$ref":"#/components/schemas/SchedulingRules"},"defaultNodePools":{"description":"default order of node pools for workloads. will be enforced if no list is defined in workload policy","type":"array","nullable":true,"items":{"type":"string"}},"nodeTypes":{"description":"default node types configuration for workloads. will be enforced if no node type is configured in workload policy","nullable":true,"$ref":"#/components/schemas/NodeTypesPerWorkload"}}},"Resources":{"required":["gpu"],"properties":{"nodePool":{"required":["id"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}},"description":"the node pool which the resources refer to","type":"object","nullable":true},"gpu":{"allOf":[{"$ref":"#/components/schemas/NonNullResource"},{"description":"GPU number to the project in the node pool"}]},"cpu":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"description":"CPU in Millicores to the project in the node pool"}]},"memory":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","description":"Memory to the project in the node pool","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"NonNullResource":{"required":["deserved"],"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources"},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"Resource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"units":{"type":"string","enum":["Mib","MB","GB"]},"SchedulingRules":{"type":"object","nullable":true,"properties":{"interactiveJobTimeLimitSeconds":{"type":"integer","description":"interactive job time limit in seconds","nullable":true,"minimum":1},"interactiveJobMaxIdleDurationSeconds":{"type":"integer","description":"interactive job max idle duration in seconds","nullable":true,"minimum":1},"interactiveJobPreemptIdleDurationSeconds":{"type":"integer","description":"interactive job preempt idle duration in seconds","nullable":true,"minimum":1},"trainingJobMaxIdleDurationSeconds":{"type":"integer","description":"training job max idle duration in seconds","nullable":true,"minimum":1},"trainingJobTimeLimitSeconds":{"type":"integer","description":"training job time limit in seconds","nullable":true,"minimum":1}}},"NodeTypesPerWorkload":{"properties":{"training":{"type":"array","description":"ids of the node types for training workloads","items":{"type":"string"}},"workspace":{"type":"array","description":"ids of the node types for workspace workloads","items":{"type":"string"}},"names":{"nullable":true,"type":"object","additionalProperties":{"type":"string"},"description":"mapping of ids to names"}}},"ClusterId":{"description":"The id of the cluster.","type":"string","format":"uuid"},"OvertimeData":{"type":"object","properties":{"range24hData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]},"range7dData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]},"range30dData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]}}},"OvertimeRangeData":{"type":"object","description":"Average data for the specified time range, or for the lifetime of the project/department if it exists for less than the time range.","properties":{"averageGpuAllocation":{"type":"number","description":"The average gpu devices allocation of the project/department."},"averageGpuUtilization":{"type":"number","description":"The average gpu utilization percentage of the project/department."},"updatedAt":{"type":"string","format":"date-time"}}},"DepartmentProjectChild":{"type":"object","description":"Department or project child","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"children":{"type":"array","items":{"$ref":"#/components/schemas/DepartmentProjectChild"}}}},"QuotaStatus":{"type":"object","description":"Sum of all quota statuses of all the node pools","properties":{"allocated":{"$ref":"#/components/schemas/QuotaStatusResource"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResource"},"requested":{"$ref":"#/components/schemas/QuotaStatusResource"}}},"QuotaStatusResource":{"type":"object","properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in MB (allocated/requested/...)."}}},"TotalResources":{"type":"object","properties":{"gpuQuota":{"type":"number","description":"Total gpu quota of the org unit","nullable":true},"cpuQuota":{"type":"number","description":"Total cpu quota of the org unit in Millicores","nullable":true},"memoryQuota":{"type":"number","description":"Total memory quota of the org unit in MB","nullable":true}}},"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"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/org-unit/departments":{"get":{"summary":"Get departments","operationId":"get_departments","description":"list departments","tags":["Departments"],"parameters":[{"$ref":"#/components/parameters/DepartmentsFilterBy"},{"$ref":"#/components/parameters/DepartmentsSortBy"},{"$ref":"#/components/parameters/DepartmentsVerbosity"},{"$ref":"#/components/parameters/SortOrder"},{"$ref":"#/components/parameters/Offset"},{"$ref":"#/components/parameters/Limit"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","required":["departments"],"properties":{"departments":{"type":"array","items":{"$ref":"#/components/schemas/DepartmentForList"}},"next":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Create department

> Create Department

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"DepartmentCreationRequest":{"allOf":[{"$ref":"#/components/schemas/DataDepartmentFields"}]},"DataDepartmentFields":{"allOf":[{"$ref":"#/components/schemas/DataUpdatableDepartmentFields"},{"type":"object","required":["name","clusterId"],"properties":{"name":{"type":"string"},"clusterId":{"$ref":"#/components/schemas/ClusterId"},"overtimeData":{"$ref":"#/components/schemas/OvertimeData"}}}]},"DataUpdatableDepartmentFields":{"type":"object","description":"Updatable fields","required":["resources"],"properties":{"description":{"type":"string","description":"department's description"},"resources":{"type":"array","items":{"$ref":"#/components/schemas/Resources"},"description":"Resources assigned to this Organization per Node Pool"},"schedulingRules":{"$ref":"#/components/schemas/SchedulingRules"},"defaultNodePools":{"description":"default order of node pools for workloads. will be enforced if no list is defined in workload policy","type":"array","nullable":true,"items":{"type":"string"}},"nodeTypes":{"description":"default node types configuration for workloads. will be enforced if no node type is configured in workload policy","nullable":true,"$ref":"#/components/schemas/NodeTypesPerWorkload"}}},"Resources":{"required":["gpu"],"properties":{"nodePool":{"required":["id"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}},"description":"the node pool which the resources refer to","type":"object","nullable":true},"gpu":{"allOf":[{"$ref":"#/components/schemas/NonNullResource"},{"description":"GPU number to the project in the node pool"}]},"cpu":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"description":"CPU in Millicores to the project in the node pool"}]},"memory":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","description":"Memory to the project in the node pool","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"NonNullResource":{"required":["deserved"],"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources"},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"Resource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"units":{"type":"string","enum":["Mib","MB","GB"]},"SchedulingRules":{"type":"object","nullable":true,"properties":{"interactiveJobTimeLimitSeconds":{"type":"integer","description":"interactive job time limit in seconds","nullable":true,"minimum":1},"interactiveJobMaxIdleDurationSeconds":{"type":"integer","description":"interactive job max idle duration in seconds","nullable":true,"minimum":1},"interactiveJobPreemptIdleDurationSeconds":{"type":"integer","description":"interactive job preempt idle duration in seconds","nullable":true,"minimum":1},"trainingJobMaxIdleDurationSeconds":{"type":"integer","description":"training job max idle duration in seconds","nullable":true,"minimum":1},"trainingJobTimeLimitSeconds":{"type":"integer","description":"training job time limit in seconds","nullable":true,"minimum":1}}},"NodeTypesPerWorkload":{"properties":{"training":{"type":"array","description":"ids of the node types for training workloads","items":{"type":"string"}},"workspace":{"type":"array","description":"ids of the node types for workspace workloads","items":{"type":"string"}},"names":{"nullable":true,"type":"object","additionalProperties":{"type":"string"},"description":"mapping of ids to names"}}},"ClusterId":{"description":"The id of the cluster.","type":"string","format":"uuid"},"OvertimeData":{"type":"object","properties":{"range24hData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]},"range7dData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]},"range30dData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]}}},"OvertimeRangeData":{"type":"object","description":"Average data for the specified time range, or for the lifetime of the project/department if it exists for less than the time range.","properties":{"averageGpuAllocation":{"type":"number","description":"The average gpu devices allocation of the project/department."},"averageGpuUtilization":{"type":"number","description":"The average gpu utilization percentage of the project/department."},"updatedAt":{"type":"string","format":"date-time"}}},"Department":{"allOf":[{"$ref":"#/components/schemas/DataDepartmentFields"},{"type":"object","required":["id","name","description","createdAt","updatedAt","totalResources"],"properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"children":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/DepartmentProjectChild"}},"projectsAggregatedResources":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/AggregatedResources"}},"status":{"type":"object","properties":{"nodePoolQuotaStatuses":{"type":"array","items":{"$ref":"#/components/schemas/QuotaStatusNodePool"}},"quotaStatus":{"$ref":"#/components/schemas/QuotaStatus"}}},"totalResources":{"$ref":"#/components/schemas/TotalResources"}}}]},"DepartmentProjectChild":{"type":"object","description":"Department or project child","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"children":{"type":"array","items":{"$ref":"#/components/schemas/DepartmentProjectChild"}}}},"AggregatedResources":{"type":"object","description":"Sum of all resources assigned to the projects under this department per Node Pool","required":["nodePool"],"properties":{"nodePool":{"type":"object","description":"the node pool which the resources refer to","required":["id","name"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}}},"gpu":{"$ref":"#/components/schemas/DeservedResource"},"cpu":{"$ref":"#/components/schemas/DeservedResource"},"memory":{"allOf":[{"$ref":"#/components/schemas/DeservedResource"},{"type":"object","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"DeservedResource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true}}},"QuotaStatusNodePool":{"allOf":[{"$ref":"#/components/schemas/QuotaStatus"},{"type":"object","required":["nodePoolName","nodePoolId"],"properties":{"nodePoolName":{"type":"string","description":"The node pool name which the current quota status refers to"},"nodePoolId":{"type":"string","description":"The node pool id which the current quota status refers to"}}}]},"QuotaStatus":{"type":"object","description":"Sum of all quota statuses of all the node pools","properties":{"allocated":{"$ref":"#/components/schemas/QuotaStatusResource"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResource"},"requested":{"$ref":"#/components/schemas/QuotaStatusResource"}}},"QuotaStatusResource":{"type":"object","properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in MB (allocated/requested/...)."}}},"TotalResources":{"type":"object","properties":{"gpuQuota":{"type":"number","description":"Total gpu quota of the org unit","nullable":true},"cpuQuota":{"type":"number","description":"Total cpu quota of the org unit in Millicores","nullable":true},"memoryQuota":{"type":"number","description":"Total memory quota of the org unit in MB","nullable":true}}},"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"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/org-unit/departments":{"post":{"summary":"Create department","operationId":"create_department","description":"Create Department","tags":["Departments"],"requestBody":{"description":"Department to create.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentCreationRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Department"}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Get department

> Get department by Id

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"DepartmentId":{"name":"departmentId","in":"path","required":true,"description":"The id of the department.","schema":{"type":"string"}}},"schemas":{"Department":{"allOf":[{"$ref":"#/components/schemas/DataDepartmentFields"},{"type":"object","required":["id","name","description","createdAt","updatedAt","totalResources"],"properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"children":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/DepartmentProjectChild"}},"projectsAggregatedResources":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/AggregatedResources"}},"status":{"type":"object","properties":{"nodePoolQuotaStatuses":{"type":"array","items":{"$ref":"#/components/schemas/QuotaStatusNodePool"}},"quotaStatus":{"$ref":"#/components/schemas/QuotaStatus"}}},"totalResources":{"$ref":"#/components/schemas/TotalResources"}}}]},"DataDepartmentFields":{"allOf":[{"$ref":"#/components/schemas/DataUpdatableDepartmentFields"},{"type":"object","required":["name","clusterId"],"properties":{"name":{"type":"string"},"clusterId":{"$ref":"#/components/schemas/ClusterId"},"overtimeData":{"$ref":"#/components/schemas/OvertimeData"}}}]},"DataUpdatableDepartmentFields":{"type":"object","description":"Updatable fields","required":["resources"],"properties":{"description":{"type":"string","description":"department's description"},"resources":{"type":"array","items":{"$ref":"#/components/schemas/Resources"},"description":"Resources assigned to this Organization per Node Pool"},"schedulingRules":{"$ref":"#/components/schemas/SchedulingRules"},"defaultNodePools":{"description":"default order of node pools for workloads. will be enforced if no list is defined in workload policy","type":"array","nullable":true,"items":{"type":"string"}},"nodeTypes":{"description":"default node types configuration for workloads. will be enforced if no node type is configured in workload policy","nullable":true,"$ref":"#/components/schemas/NodeTypesPerWorkload"}}},"Resources":{"required":["gpu"],"properties":{"nodePool":{"required":["id"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}},"description":"the node pool which the resources refer to","type":"object","nullable":true},"gpu":{"allOf":[{"$ref":"#/components/schemas/NonNullResource"},{"description":"GPU number to the project in the node pool"}]},"cpu":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"description":"CPU in Millicores to the project in the node pool"}]},"memory":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","description":"Memory to the project in the node pool","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"NonNullResource":{"required":["deserved"],"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources"},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"Resource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"units":{"type":"string","enum":["Mib","MB","GB"]},"SchedulingRules":{"type":"object","nullable":true,"properties":{"interactiveJobTimeLimitSeconds":{"type":"integer","description":"interactive job time limit in seconds","nullable":true,"minimum":1},"interactiveJobMaxIdleDurationSeconds":{"type":"integer","description":"interactive job max idle duration in seconds","nullable":true,"minimum":1},"interactiveJobPreemptIdleDurationSeconds":{"type":"integer","description":"interactive job preempt idle duration in seconds","nullable":true,"minimum":1},"trainingJobMaxIdleDurationSeconds":{"type":"integer","description":"training job max idle duration in seconds","nullable":true,"minimum":1},"trainingJobTimeLimitSeconds":{"type":"integer","description":"training job time limit in seconds","nullable":true,"minimum":1}}},"NodeTypesPerWorkload":{"properties":{"training":{"type":"array","description":"ids of the node types for training workloads","items":{"type":"string"}},"workspace":{"type":"array","description":"ids of the node types for workspace workloads","items":{"type":"string"}},"names":{"nullable":true,"type":"object","additionalProperties":{"type":"string"},"description":"mapping of ids to names"}}},"ClusterId":{"description":"The id of the cluster.","type":"string","format":"uuid"},"OvertimeData":{"type":"object","properties":{"range24hData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]},"range7dData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]},"range30dData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]}}},"OvertimeRangeData":{"type":"object","description":"Average data for the specified time range, or for the lifetime of the project/department if it exists for less than the time range.","properties":{"averageGpuAllocation":{"type":"number","description":"The average gpu devices allocation of the project/department."},"averageGpuUtilization":{"type":"number","description":"The average gpu utilization percentage of the project/department."},"updatedAt":{"type":"string","format":"date-time"}}},"DepartmentProjectChild":{"type":"object","description":"Department or project child","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"children":{"type":"array","items":{"$ref":"#/components/schemas/DepartmentProjectChild"}}}},"AggregatedResources":{"type":"object","description":"Sum of all resources assigned to the projects under this department per Node Pool","required":["nodePool"],"properties":{"nodePool":{"type":"object","description":"the node pool which the resources refer to","required":["id","name"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}}},"gpu":{"$ref":"#/components/schemas/DeservedResource"},"cpu":{"$ref":"#/components/schemas/DeservedResource"},"memory":{"allOf":[{"$ref":"#/components/schemas/DeservedResource"},{"type":"object","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"DeservedResource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true}}},"QuotaStatusNodePool":{"allOf":[{"$ref":"#/components/schemas/QuotaStatus"},{"type":"object","required":["nodePoolName","nodePoolId"],"properties":{"nodePoolName":{"type":"string","description":"The node pool name which the current quota status refers to"},"nodePoolId":{"type":"string","description":"The node pool id which the current quota status refers to"}}}]},"QuotaStatus":{"type":"object","description":"Sum of all quota statuses of all the node pools","properties":{"allocated":{"$ref":"#/components/schemas/QuotaStatusResource"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResource"},"requested":{"$ref":"#/components/schemas/QuotaStatusResource"}}},"QuotaStatusResource":{"type":"object","properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in MB (allocated/requested/...)."}}},"TotalResources":{"type":"object","properties":{"gpuQuota":{"type":"number","description":"Total gpu quota of the org unit","nullable":true},"cpuQuota":{"type":"number","description":"Total cpu quota of the org unit in Millicores","nullable":true},"memoryQuota":{"type":"number","description":"Total memory quota of the org unit in MB","nullable":true}}},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"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"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/org-unit/departments/{departmentId}":{"get":{"summary":"Get department","operationId":"get_department","description":"Get department by Id","tags":["Departments"],"parameters":[{"$ref":"#/components/parameters/DepartmentId"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Department"}}}},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"404":{"$ref":"#/components/responses/404NotFound"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Update department

> Update department by Id

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"DepartmentId":{"name":"departmentId","in":"path","required":true,"description":"The id of the department.","schema":{"type":"string"}}},"schemas":{"DepartmentUpdateRequest":{"allOf":[{"$ref":"#/components/schemas/DataUpdatableDepartmentFields"}]},"DataUpdatableDepartmentFields":{"type":"object","description":"Updatable fields","required":["resources"],"properties":{"description":{"type":"string","description":"department's description"},"resources":{"type":"array","items":{"$ref":"#/components/schemas/Resources"},"description":"Resources assigned to this Organization per Node Pool"},"schedulingRules":{"$ref":"#/components/schemas/SchedulingRules"},"defaultNodePools":{"description":"default order of node pools for workloads. will be enforced if no list is defined in workload policy","type":"array","nullable":true,"items":{"type":"string"}},"nodeTypes":{"description":"default node types configuration for workloads. will be enforced if no node type is configured in workload policy","nullable":true,"$ref":"#/components/schemas/NodeTypesPerWorkload"}}},"Resources":{"required":["gpu"],"properties":{"nodePool":{"required":["id"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}},"description":"the node pool which the resources refer to","type":"object","nullable":true},"gpu":{"allOf":[{"$ref":"#/components/schemas/NonNullResource"},{"description":"GPU number to the project in the node pool"}]},"cpu":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"description":"CPU in Millicores to the project in the node pool"}]},"memory":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","description":"Memory to the project in the node pool","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"NonNullResource":{"required":["deserved"],"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources"},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"Resource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"units":{"type":"string","enum":["Mib","MB","GB"]},"SchedulingRules":{"type":"object","nullable":true,"properties":{"interactiveJobTimeLimitSeconds":{"type":"integer","description":"interactive job time limit in seconds","nullable":true,"minimum":1},"interactiveJobMaxIdleDurationSeconds":{"type":"integer","description":"interactive job max idle duration in seconds","nullable":true,"minimum":1},"interactiveJobPreemptIdleDurationSeconds":{"type":"integer","description":"interactive job preempt idle duration in seconds","nullable":true,"minimum":1},"trainingJobMaxIdleDurationSeconds":{"type":"integer","description":"training job max idle duration in seconds","nullable":true,"minimum":1},"trainingJobTimeLimitSeconds":{"type":"integer","description":"training job time limit in seconds","nullable":true,"minimum":1}}},"NodeTypesPerWorkload":{"properties":{"training":{"type":"array","description":"ids of the node types for training workloads","items":{"type":"string"}},"workspace":{"type":"array","description":"ids of the node types for workspace workloads","items":{"type":"string"}},"names":{"nullable":true,"type":"object","additionalProperties":{"type":"string"},"description":"mapping of ids to names"}}},"Department":{"allOf":[{"$ref":"#/components/schemas/DataDepartmentFields"},{"type":"object","required":["id","name","description","createdAt","updatedAt","totalResources"],"properties":{"id":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"children":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/DepartmentProjectChild"}},"projectsAggregatedResources":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/AggregatedResources"}},"status":{"type":"object","properties":{"nodePoolQuotaStatuses":{"type":"array","items":{"$ref":"#/components/schemas/QuotaStatusNodePool"}},"quotaStatus":{"$ref":"#/components/schemas/QuotaStatus"}}},"totalResources":{"$ref":"#/components/schemas/TotalResources"}}}]},"DataDepartmentFields":{"allOf":[{"$ref":"#/components/schemas/DataUpdatableDepartmentFields"},{"type":"object","required":["name","clusterId"],"properties":{"name":{"type":"string"},"clusterId":{"$ref":"#/components/schemas/ClusterId"},"overtimeData":{"$ref":"#/components/schemas/OvertimeData"}}}]},"ClusterId":{"description":"The id of the cluster.","type":"string","format":"uuid"},"OvertimeData":{"type":"object","properties":{"range24hData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]},"range7dData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]},"range30dData":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/OvertimeRangeData"}]}}},"OvertimeRangeData":{"type":"object","description":"Average data for the specified time range, or for the lifetime of the project/department if it exists for less than the time range.","properties":{"averageGpuAllocation":{"type":"number","description":"The average gpu devices allocation of the project/department."},"averageGpuUtilization":{"type":"number","description":"The average gpu utilization percentage of the project/department."},"updatedAt":{"type":"string","format":"date-time"}}},"DepartmentProjectChild":{"type":"object","description":"Department or project child","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"children":{"type":"array","items":{"$ref":"#/components/schemas/DepartmentProjectChild"}}}},"AggregatedResources":{"type":"object","description":"Sum of all resources assigned to the projects under this department per Node Pool","required":["nodePool"],"properties":{"nodePool":{"type":"object","description":"the node pool which the resources refer to","required":["id","name"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}}},"gpu":{"$ref":"#/components/schemas/DeservedResource"},"cpu":{"$ref":"#/components/schemas/DeservedResource"},"memory":{"allOf":[{"$ref":"#/components/schemas/DeservedResource"},{"type":"object","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"DeservedResource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true}}},"QuotaStatusNodePool":{"allOf":[{"$ref":"#/components/schemas/QuotaStatus"},{"type":"object","required":["nodePoolName","nodePoolId"],"properties":{"nodePoolName":{"type":"string","description":"The node pool name which the current quota status refers to"},"nodePoolId":{"type":"string","description":"The node pool id which the current quota status refers to"}}}]},"QuotaStatus":{"type":"object","description":"Sum of all quota statuses of all the node pools","properties":{"allocated":{"$ref":"#/components/schemas/QuotaStatusResource"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResource"},"requested":{"$ref":"#/components/schemas/QuotaStatusResource"}}},"QuotaStatusResource":{"type":"object","properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in MB (allocated/requested/...)."}}},"TotalResources":{"type":"object","properties":{"gpuQuota":{"type":"number","description":"Total gpu quota of the org unit","nullable":true},"cpuQuota":{"type":"number","description":"Total cpu quota of the org unit in Millicores","nullable":true},"memoryQuota":{"type":"number","description":"Total memory quota of the org unit in MB","nullable":true}}},"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"}}}},"503ServiceUnavailable":{"description":"unexpected error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/org-unit/departments/{departmentId}":{"put":{"summary":"Update department","operationId":"update_department","description":"Update department by Id","tags":["Departments"],"parameters":[{"$ref":"#/components/parameters/DepartmentId"}],"requestBody":{"description":"Department to update.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentUpdateRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Department"}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"404":{"$ref":"#/components/responses/404NotFound"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Delete department

> Delete department by Id

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"DepartmentId":{"name":"departmentId","in":"path","required":true,"description":"The id of the department.","schema":{"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"}}}},"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/org-unit/departments/{departmentId}":{"delete":{"summary":"Delete department","operationId":"delete_department","description":"Delete department by Id","tags":["Departments"],"parameters":[{"$ref":"#/components/parameters/DepartmentId"}],"responses":{"204":{"description":"Deleted"},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"404":{"$ref":"#/components/responses/404NotFound"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Update department resources

> Update department resources by Id

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"DepartmentId":{"name":"departmentId","in":"path","required":true,"description":"The id of the department.","schema":{"type":"string"}}},"schemas":{"ResourcesUpdateRequest":{"type":"array","items":{"$ref":"#/components/schemas/Resources"},"description":"Resources assigned to this Project per Node Pool"},"Resources":{"required":["gpu"],"properties":{"nodePool":{"required":["id"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}},"description":"the node pool which the resources refer to","type":"object","nullable":true},"gpu":{"allOf":[{"$ref":"#/components/schemas/NonNullResource"},{"description":"GPU number to the project in the node pool"}]},"cpu":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"description":"CPU in Millicores to the project in the node pool"}]},"memory":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","description":"Memory to the project in the node pool","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"NonNullResource":{"required":["deserved"],"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources"},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"Resource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"units":{"type":"string","enum":["Mib","MB","GB"]},"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"}}}},"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/org-unit/departments/{departmentId}/resources":{"put":{"summary":"Update department resources","operationId":"update_department_resources","description":"Update department resources by Id","tags":["Departments"],"parameters":[{"$ref":"#/components/parameters/DepartmentId"}],"requestBody":{"description":"Department resources to update.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourcesUpdateRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Resources"}}}}},"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"}}}}}}
```

## Patch department resources

> Partial updates to specific items in the list. Should be used for update one or more attributes of an item without modifying the entire resource.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"DepartmentId":{"name":"departmentId","in":"path","required":true,"description":"The id of the department.","schema":{"type":"string"}}},"schemas":{"ResourcesUpdateRequest":{"type":"array","items":{"$ref":"#/components/schemas/Resources"},"description":"Resources assigned to this Project per Node Pool"},"Resources":{"required":["gpu"],"properties":{"nodePool":{"required":["id"],"properties":{"id":{"type":"string","description":"node pool id"},"name":{"type":"string","description":"node pool name"}},"description":"the node pool which the resources refer to","type":"object","nullable":true},"gpu":{"allOf":[{"$ref":"#/components/schemas/NonNullResource"},{"description":"GPU number to the project in the node pool"}]},"cpu":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"description":"CPU in Millicores to the project in the node pool"}]},"memory":{"type":"object","nullable":true,"allOf":[{"$ref":"#/components/schemas/Resource"},{"type":"object","description":"Memory to the project in the node pool","required":["units"],"properties":{"units":{"$ref":"#/components/schemas/units"}}}]}}},"NonNullResource":{"required":["deserved"],"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources"},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"Resource":{"properties":{"deserved":{"type":"number","description":"The project resource allocation that it is deserved to get in case the cluster has those resources","nullable":true},"limit":{"type":"number","description":"Maximum amount of resources the project can get","nullable":true},"overQuotaWeight":{"type":"number","description":"The priority the project gets for over quota resources","nullable":true}}},"units":{"type":"string","enum":["Mib","MB","GB"]},"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"}}}},"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/org-unit/departments/{departmentId}/resources":{"patch":{"summary":"Patch department resources","operationId":"patch_department_resources","description":"Partial updates to specific items in the list. Should be used for update one or more attributes of an item without modifying the entire resource.","tags":["Departments"],"parameters":[{"$ref":"#/components/parameters/DepartmentId"}],"requestBody":{"description":"Department resources to update.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourcesUpdateRequest"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Resources"}}}}},"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"}}}}}}
```

## Count departments

> count departments

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"DepartmentsFilterBy":{"name":"filterBy","in":"query","required":false,"description":"Filter results by a parameter. Use the format field-name operator value. Operators are == Equals, != Not equals, <= Less than or equal, >= Greater than or equal, =@ contains, !@ Does not contains, =^ Starts with and =$ Ends with. Dates are in ISO 8601 timestamp format and available for operators ==, !=, <= and >=.","schema":{"type":"array","items":{"type":"string","pattern":"^(name|clusterId|totalGpuQuota|gpuAllocated|createdAt|avgGpuAllocation24h|avgGpuUtilization24h|avgGpuAllocation7d|avgGpuUtilization7d|avgGpuAllocation30d|avgGpuUtilization30d)(==|!=|<=|>=|=@|!@|=\\^|=\\$).+$"}},"explode":false}},"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"}}}},"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/org-unit/departments/count":{"get":{"summary":"Count departments","operationId":"count_departments","description":"count departments","tags":["Departments"],"parameters":[{"$ref":"#/components/parameters/DepartmentsFilterBy"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","required":["count"],"properties":{"count":{"type":"integer","format":"int64"}}}}}},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401Unauthorized"},"403":{"$ref":"#/components/responses/403Forbidden"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}}}}
```

## Get metrics for all departments.

> Get metrics for all departments in the cluster. Use a time range to return historical data (optional). \
> If you use a \`start\` date, an \`end\` date is required.<br>

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"ClusterUuid":{"name":"clusterUuid","in":"path","required":true,"description":"The Universally Unique Identifier (UUID) of the cluster.","schema":{"type":"string","format":"uuid","minLength":1}},"Start":{"name":"start","in":"query","description":"Start of time range to fetch data from in UTC format.","required":false,"schema":{"type":"string","format":"date-time"}},"End":{"name":"end","in":"query","description":"End of time range to fetch data from in UTC format.","required":false,"schema":{"type":"string","format":"date-time"}},"NumberOfSamples":{"name":"numberOfSamples","in":"query","description":"The number of samples to take in the specified time range.","required":false,"schema":{"type":"integer","maximum":1000,"minimum":0,"default":20}},"NodepoolName":{"in":"query","name":"nodepoolName","schema":{"type":"string"},"required":false,"description":"Filter by unique nodepool name."}},"schemas":{"departments":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/Department1"},{"properties":{"timeRange":{}}}]}},"timeRange":{"$ref":"#/components/schemas/TimeRange"}}},"Department1":{"type":"object","required":["metadata","current"],"properties":{"metadata":{"type":"object","required":["departmentId","departmentName","clusterId","clusterName"],"properties":{"departmentId":{"$ref":"#/components/schemas/DepartmentId"},"departmentName":{"$ref":"#/components/schemas/DepartmentName"},"clusterId":{"$ref":"#/components/schemas/ClusterId"},"clusterName":{"$ref":"#/components/schemas/ClusterName"}}},"current":{"type":"object","description":"Current reported metrics data. resources holds data that is summed up to the department level and projectResources explains the division of it to projects","required":["resources","projectResources"],"properties":{"resources":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/ResourcesData"},{"type":"object","required":["nodepoolName"],"properties":{"nodepoolName":{"$ref":"#/components/schemas/NodepoolName"}}}]}},"projectResources":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/ResourcesData"},{"type":"object","required":["projectName","nodepoolName"],"properties":{"projectName":{"$ref":"#/components/schemas/ProjectName1"},"nodepoolName":{"$ref":"#/components/schemas/NodepoolName"}}}]}}}},"timeRange":{"$ref":"#/components/schemas/TimeRange"}}},"DepartmentId":{"description":"The id of the department","type":"integer","format":"int32","minimum":1},"DepartmentName":{"type":"string"},"ClusterId":{"description":"The id of the cluster.","type":"string","format":"uuid"},"ClusterName":{"type":"string"},"ResourcesData":{"type":"object","required":["numberOfPendingWorkloads","gpu","cpu","memory"],"properties":{"numberOfPendingWorkloads":{"type":"integer"},"gpu":{"description":"GPU resources in fractions. 0.7 = 70% of a gpu","$ref":"#/components/schemas/ResourceData"},"cpu":{"description":"CPU resources in millicpus. 1000 = 1 cpu","$ref":"#/components/schemas/ResourceData"},"memory":{"description":"Memory resources in megabytes. 1 = 10^6  (1000*1000)","$ref":"#/components/schemas/ResourceData"}}},"ResourceData":{"type":"object","description":"quota equals to the given resources and allocated equal to the real count of used resources","required":["quota","allocated"],"properties":{"quota":{"type":"number"},"allocated":{"type":"number"},"utilization":{"type":"number"}}},"NodepoolName":{"type":"string"},"ProjectName1":{"type":"string"},"TimeRange":{"type":"object","description":"Overtime metrics data. Returned only if both start and end query parameters are set.","required":["resources"],"properties":{"resources":{"type":"array","items":{"$ref":"#/components/schemas/ResourcesDataOvertime"}}}},"ResourcesDataOvertime":{"allOf":[{"$ref":"#/components/schemas/ResourcesData"},{"type":"object","required":["timestamp"],"properties":{"timestamp":{"type":"string","format":"date-time"}}}]},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"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"}}}}}},"paths":{"/v1/k8s/clusters/{clusterUuid}/departments/metrics":{"get":{"tags":["Departments"],"deprecated":true,"summary":"Get metrics for all departments.","operationId":"getDepartmentsMetrics","description":"Get metrics for all departments in the cluster. Use a time range to return historical data (optional). \nIf you use a `start` date, an `end` date is required.\n","parameters":[{"$ref":"#/components/parameters/ClusterUuid"},{"$ref":"#/components/parameters/Start"},{"$ref":"#/components/parameters/End"},{"$ref":"#/components/parameters/NumberOfSamples"},{"$ref":"#/components/parameters/NodepoolName"}],"responses":{"200":{"description":"Successfully retrieved metrics for all departments.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/departments"}}}},"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"}}}}}}
```

## Get metrics for a specific department.

> Get metrics for a specific department in the cluster. \
> Use a time range to return historical data (optional). If you use a \`start\` date, an \`end\` date is required.<br>

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"parameters":{"ClusterUuid":{"name":"clusterUuid","in":"path","required":true,"description":"The Universally Unique Identifier (UUID) of the cluster.","schema":{"type":"string","format":"uuid","minLength":1}},"DepartmentId":{"name":"departmentId","in":"path","required":true,"description":"The id of the department.","schema":{"type":"string"}},"Start":{"name":"start","in":"query","description":"Start of time range to fetch data from in UTC format.","required":false,"schema":{"type":"string","format":"date-time"}},"End":{"name":"end","in":"query","description":"End of time range to fetch data from in UTC format.","required":false,"schema":{"type":"string","format":"date-time"}},"NumberOfSamples":{"name":"numberOfSamples","in":"query","description":"The number of samples to take in the specified time range.","required":false,"schema":{"type":"integer","maximum":1000,"minimum":0,"default":20}},"NodepoolName":{"in":"query","name":"nodepoolName","schema":{"type":"string"},"required":false,"description":"Filter by unique nodepool name."}},"schemas":{"department":{"type":"object","required":["metadata","current"],"properties":{"metadata":{"type":"object","required":["departmentId","departmentName","clusterId","clusterName"],"properties":{"departmentId":{"$ref":"#/components/schemas/DepartmentId"},"departmentName":{"$ref":"#/components/schemas/DepartmentName"},"clusterId":{"$ref":"#/components/schemas/ClusterId"},"clusterName":{"$ref":"#/components/schemas/ClusterName"}}},"current":{"type":"object","description":"Current reported metrics data. resources holds data that is summed up to the department level and projectResources explains the division of it to projects","required":["resources","projectResources"],"properties":{"resources":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/ResourcesData"},{"type":"object","required":["nodepoolName"],"properties":{"nodepoolName":{"$ref":"#/components/schemas/NodepoolName"}}}]}},"projectResources":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/ResourcesData"},{"type":"object","required":["projectName","nodepoolName"],"properties":{"projectName":{"$ref":"#/components/schemas/ProjectName1"},"nodepoolName":{"$ref":"#/components/schemas/NodepoolName"}}}]}}}},"timeRange":{"$ref":"#/components/schemas/TimeRange"}}},"DepartmentId":{"description":"The id of the department","type":"integer","format":"int32","minimum":1},"DepartmentName":{"type":"string"},"ClusterId":{"description":"The id of the cluster.","type":"string","format":"uuid"},"ClusterName":{"type":"string"},"ResourcesData":{"type":"object","required":["numberOfPendingWorkloads","gpu","cpu","memory"],"properties":{"numberOfPendingWorkloads":{"type":"integer"},"gpu":{"description":"GPU resources in fractions. 0.7 = 70% of a gpu","$ref":"#/components/schemas/ResourceData"},"cpu":{"description":"CPU resources in millicpus. 1000 = 1 cpu","$ref":"#/components/schemas/ResourceData"},"memory":{"description":"Memory resources in megabytes. 1 = 10^6  (1000*1000)","$ref":"#/components/schemas/ResourceData"}}},"ResourceData":{"type":"object","description":"quota equals to the given resources and allocated equal to the real count of used resources","required":["quota","allocated"],"properties":{"quota":{"type":"number"},"allocated":{"type":"number"},"utilization":{"type":"number"}}},"NodepoolName":{"type":"string"},"ProjectName1":{"type":"string"},"TimeRange":{"type":"object","description":"Overtime metrics data. Returned only if both start and end query parameters are set.","required":["resources"],"properties":{"resources":{"type":"array","items":{"$ref":"#/components/schemas/ResourcesDataOvertime"}}}},"ResourcesDataOvertime":{"allOf":[{"$ref":"#/components/schemas/ResourcesData"},{"type":"object","required":["timestamp"],"properties":{"timestamp":{"type":"string","format":"date-time"}}}]},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}},"responses":{"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"}}}}}},"paths":{"/v1/k8s/clusters/{clusterUuid}/departments/{departmentId}/metrics":{"get":{"tags":["Departments"],"deprecated":true,"summary":"Get metrics for a specific department.","operationId":"getDepartmentMetrics","description":"Get metrics for a specific department in the cluster. \nUse a time range to return historical data (optional). If you use a `start` date, an `end` date is required.\n","parameters":[{"$ref":"#/components/parameters/ClusterUuid"},{"$ref":"#/components/parameters/DepartmentId"},{"$ref":"#/components/parameters/Start"},{"$ref":"#/components/parameters/End"},{"$ref":"#/components/parameters/NumberOfSamples"},{"$ref":"#/components/parameters/NodepoolName"}],"responses":{"200":{"description":"Successfully retrieved metrics for the department.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/department"}}}},"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"}}}}}}
```

## Get a specific department.

> Retrieves the details of a specific department. Requires  the\`view\` permission for the department.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"Department2":{"allOf":[{"properties":{"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to the Department per node pool."},"tenantId":{"type":"integer","description":"The tenant id this cluster belongs to."},"clusterUuid":{"type":"string","description":"The cluster UUID this department belongs to."},"createdAt":{"type":"string","description":"The creation date of the department.","format":"date-time"},"id":{"type":"integer","format":"int32","description":"The unique id identifying the department."},"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project2"},"description":"Projects under this department."},"projectsDeservedGpus":{"type":"string","description":"Deprecated. Instead, use 'nodePoolsResources' field. Total deserved GPUs of the projects under this department - as string.","deprecated":true},"departmentAdmins":{"type":"array","items":{"type":"string"},"description":"Id's of users with department admin role that are assigned to managed the department"}}},{"$ref":"#/components/schemas/DepartmentCommonFields"}]},"NodePoolAssignedResources":{"required":["id"],"allOf":[{"properties":{"id":{"description":"The id of the assigned resources. Required in PUT when updating the assigned resources.","type":"number"}}},{"$ref":"#/components/schemas/NodePoolAssignedResourcesCreate"}]},"NodePoolAssignedResourcesCreate":{"required":["nodePool"],"properties":{"nodePool":{"allOf":[{"$ref":"#/components/schemas/NodePoolResources"}],"description":"The node pool which the assigned resources refer to."},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of GPUs assigned in the node pool."},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of CPU Millicores assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Amount of CPU Memory Mib assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."}}},"NodePoolResources":{"required":["id"],"properties":{"id":{"type":"number","description":"Node pool id."},"name":{"type":"string","description":"Node pool name."}}},"Resource1":{"properties":{"deserved":{"type":"number","description":"The amount of resources guaranteed to be allocated in case the cluster has those resources."},"maxAllowed":{"type":"number","description":"Maximum amount of resources that can be allocated. If equal to deserved, no over-quota will be allowed. Use \"-1\" for unlimited over quota."},"overQuotaWeight":{"type":"number","description":"The priority for over quota resources."}}},"Project2":{"allOf":[{"properties":{"name":{"type":"string","description":"Project name."},"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to this Project per Node Pool."},"namespace":{"type":"string","description":"The name of an existing namespace to use for the project in the cluster. Supported only for cluster versions 2.12 or higher."},"id":{"type":"integer","format":"int32","description":"Project id.","readOnly":true},"departmentId":{"type":"integer","format":"int32","description":"ID of the department that owns the project."},"tenantId":{"type":"integer","format":"int32","description":"ID of the tenant where the project is located."},"clusterUuid":{"type":"string","format":"uuid","description":"ID of the cluster where the project is located."},"departmentName":{"type":"string","description":"Name of the department where the project is located."},"interactiveNodeAffinity":{"type":"string"},"trainNodeAffinity":{"type":"string"},"createdAt":{"type":"string","description":"Creation date of the project.","format":"date-time"},"status":{"$ref":"#/components/schemas/ProjectStatus1"},"phase":{"type":"string","description":"project's phase"}}},{"$ref":"#/components/schemas/ProjectCommonFields"}]},"ProjectStatus1":{"properties":{"namespace":{"type":"string","description":"The namespace of the project"},"message":{"type":"string","description":"Detailed phase message"},"quotaStatuses":{"$ref":"#/components/schemas/NodePoolsQuotaStatuses"}}},"NodePoolsQuotaStatuses":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolQuotaStatus"},"description":"The current quota status for each node pool. Supported only for cluster versions 2.15+ or higher."},"NodePoolQuotaStatus":{"properties":{"nodePoolName":{"type":"string","description":"The node pool name which the current quota status refers to."},"allocated":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"requested":{"$ref":"#/components/schemas/QuotaStatusResourceList"}}},"QuotaStatusResourceList":{"properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in Mib (allocated/requested/...)."}}},"ProjectCommonFields":{"properties":{"deservedGpus":{"type":"number","description":"Deprecated. Use 'deserved' for the relevant resource type under `NodePoolResources`. The project's deserved GPU allocation in case the cluster has those resources.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. An upper limit for the amount of GPUs the project can get (Even if over quota is allowed and resources are available).","deprecated":true},"gpuOverQuotaWeight":{"type":"number","description":"Deprecated. Instead, use `overQuotaWeight` for the relevant resource type under `NodePoolResources`. The priority the project gets for over quota resources.","maximum":3,"minimum":0,"deprecated":true},"defaultNodePools":{"type":"array","description":"Default node pools list for workload submission for this project if a workload doesn't specify a node pools list.","items":{"type":"string"}},"interactiveJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of interactive jobs from this project."},"interactiveJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive job can be idle before being terminated."},"interactivePreemptibleJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive preemptible job can be idle before being terminated."},"trainingJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of training jobs from this project. Available only from cluster version 2.12"},"trainingJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that a training job can be idle before being terminated."},"nodeAffinity":{"allOf":[{"$ref":"#/components/schemas/JobsNodeAffinity"}],"description":"Node affinity configuration for jobs in the project."},"permissions":{"allOf":[{"$ref":"#/components/schemas/ResourcePermissions"}],"description":"Deprecated. Instead, use the `accessRules` API to add permissions to a specific subject in the project scope.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use `nodePoolsResources`. Total resources assigned to the Project. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in `GET` are the sum of all Node Pool Resources."}}},"JobsNodeAffinity":{"properties":{"train":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for training jobs."},"interactive":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for interactive jobs."}}},"NodeAffinity":{"properties":{"affinityType":{"type":"string","enum":["no_limit","only_selected"],"description":"The type of affinity of the jobs on the nodes."},"selectedTypes":{"type":"array","items":{"$ref":"#/components/schemas/NodeTypeForProject"}}}},"NodeTypeForProject":{"properties":{"id":{"type":"number"},"name":{"type":"string"}}},"ResourcePermissions":{"properties":{"users":{"type":"array","items":{"type":"string"},"description":"Names of users that have permissions to the project."},"groups":{"type":"array","items":{"type":"string"},"description":"Names of groups that have permissions to the project."},"applications":{"type":"array","items":{"type":"string"},"description":"Names of applications that have permissions to the project."}}},"AssignedResources":{"properties":{"id":{"type":"number"},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"GPU number assigned"},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Millicores assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Memory Mib assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."}}},"DepartmentCommonFields":{"properties":{"name":{"type":"string","description":"The name of the department."},"deservedGpus":{"type":"number","description":"Deprecated. Instead, use `deserved` for the relevant resource type under `NodePoolResources`. Deserved GPUs for the department.","deprecated":true},"allowOverQuota":{"type":"boolean","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Is over quota allowed for the department.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Max allowed GPUs for the department.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use 'nodePoolsResources'. Total resources assigned to the Department. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in GET are the sum of all Node Pool Resources."}}}}},"paths":{"/v1/k8s/clusters/{clusterId}/departments/{department-id}":{"get":{"tags":["Departments"],"deprecated":true,"summary":"Get a specific department.","operationId":"getDepartment","description":"Retrieves the details of a specific department. Requires  the`view` permission for the department.","parameters":[{"in":"path","name":"clusterId","schema":{"type":"string"},"required":true,"description":"The Universally Unique Identifier (UUID) of the cluster."},{"in":"path","name":"department-id","schema":{"type":"integer"},"required":true,"description":"The unique id of the department."},{"in":"query","name":"excludePermissions","schema":{"type":"boolean"},"required":false,"description":"backwards compatibility of the 'departmentAdmins' field. if 'true', will not set the 'departmentAdmins' field in the returned department. if 'false', will set the 'departmentAdmins' field in the returned department."}],"responses":{"200":{"description":"Successfully retrieved department details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Department2"}}}}}}}}}
```

## Update a department.

> Updates a department's details in the cluster. \n For example, node pools and other details.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"DepartmentUpdateRequest1":{"required":["name"],"allOf":[{"properties":{"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to this Department per Node Pool"}}},{"$ref":"#/components/schemas/DepartmentCommonFields"}]},"NodePoolAssignedResources":{"required":["id"],"allOf":[{"properties":{"id":{"description":"The id of the assigned resources. Required in PUT when updating the assigned resources.","type":"number"}}},{"$ref":"#/components/schemas/NodePoolAssignedResourcesCreate"}]},"NodePoolAssignedResourcesCreate":{"required":["nodePool"],"properties":{"nodePool":{"allOf":[{"$ref":"#/components/schemas/NodePoolResources"}],"description":"The node pool which the assigned resources refer to."},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of GPUs assigned in the node pool."},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of CPU Millicores assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Amount of CPU Memory Mib assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."}}},"NodePoolResources":{"required":["id"],"properties":{"id":{"type":"number","description":"Node pool id."},"name":{"type":"string","description":"Node pool name."}}},"Resource1":{"properties":{"deserved":{"type":"number","description":"The amount of resources guaranteed to be allocated in case the cluster has those resources."},"maxAllowed":{"type":"number","description":"Maximum amount of resources that can be allocated. If equal to deserved, no over-quota will be allowed. Use \"-1\" for unlimited over quota."},"overQuotaWeight":{"type":"number","description":"The priority for over quota resources."}}},"DepartmentCommonFields":{"properties":{"name":{"type":"string","description":"The name of the department."},"deservedGpus":{"type":"number","description":"Deprecated. Instead, use `deserved` for the relevant resource type under `NodePoolResources`. Deserved GPUs for the department.","deprecated":true},"allowOverQuota":{"type":"boolean","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Is over quota allowed for the department.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Max allowed GPUs for the department.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use 'nodePoolsResources'. Total resources assigned to the Department. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in GET are the sum of all Node Pool Resources."}}},"AssignedResources":{"properties":{"id":{"type":"number"},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"GPU number assigned"},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Millicores assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Memory Mib assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."}}},"Department2":{"allOf":[{"properties":{"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to the Department per node pool."},"tenantId":{"type":"integer","description":"The tenant id this cluster belongs to."},"clusterUuid":{"type":"string","description":"The cluster UUID this department belongs to."},"createdAt":{"type":"string","description":"The creation date of the department.","format":"date-time"},"id":{"type":"integer","format":"int32","description":"The unique id identifying the department."},"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project2"},"description":"Projects under this department."},"projectsDeservedGpus":{"type":"string","description":"Deprecated. Instead, use 'nodePoolsResources' field. Total deserved GPUs of the projects under this department - as string.","deprecated":true},"departmentAdmins":{"type":"array","items":{"type":"string"},"description":"Id's of users with department admin role that are assigned to managed the department"}}},{"$ref":"#/components/schemas/DepartmentCommonFields"}]},"Project2":{"allOf":[{"properties":{"name":{"type":"string","description":"Project name."},"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to this Project per Node Pool."},"namespace":{"type":"string","description":"The name of an existing namespace to use for the project in the cluster. Supported only for cluster versions 2.12 or higher."},"id":{"type":"integer","format":"int32","description":"Project id.","readOnly":true},"departmentId":{"type":"integer","format":"int32","description":"ID of the department that owns the project."},"tenantId":{"type":"integer","format":"int32","description":"ID of the tenant where the project is located."},"clusterUuid":{"type":"string","format":"uuid","description":"ID of the cluster where the project is located."},"departmentName":{"type":"string","description":"Name of the department where the project is located."},"interactiveNodeAffinity":{"type":"string"},"trainNodeAffinity":{"type":"string"},"createdAt":{"type":"string","description":"Creation date of the project.","format":"date-time"},"status":{"$ref":"#/components/schemas/ProjectStatus1"},"phase":{"type":"string","description":"project's phase"}}},{"$ref":"#/components/schemas/ProjectCommonFields"}]},"ProjectStatus1":{"properties":{"namespace":{"type":"string","description":"The namespace of the project"},"message":{"type":"string","description":"Detailed phase message"},"quotaStatuses":{"$ref":"#/components/schemas/NodePoolsQuotaStatuses"}}},"NodePoolsQuotaStatuses":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolQuotaStatus"},"description":"The current quota status for each node pool. Supported only for cluster versions 2.15+ or higher."},"NodePoolQuotaStatus":{"properties":{"nodePoolName":{"type":"string","description":"The node pool name which the current quota status refers to."},"allocated":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"requested":{"$ref":"#/components/schemas/QuotaStatusResourceList"}}},"QuotaStatusResourceList":{"properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in Mib (allocated/requested/...)."}}},"ProjectCommonFields":{"properties":{"deservedGpus":{"type":"number","description":"Deprecated. Use 'deserved' for the relevant resource type under `NodePoolResources`. The project's deserved GPU allocation in case the cluster has those resources.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. An upper limit for the amount of GPUs the project can get (Even if over quota is allowed and resources are available).","deprecated":true},"gpuOverQuotaWeight":{"type":"number","description":"Deprecated. Instead, use `overQuotaWeight` for the relevant resource type under `NodePoolResources`. The priority the project gets for over quota resources.","maximum":3,"minimum":0,"deprecated":true},"defaultNodePools":{"type":"array","description":"Default node pools list for workload submission for this project if a workload doesn't specify a node pools list.","items":{"type":"string"}},"interactiveJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of interactive jobs from this project."},"interactiveJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive job can be idle before being terminated."},"interactivePreemptibleJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive preemptible job can be idle before being terminated."},"trainingJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of training jobs from this project. Available only from cluster version 2.12"},"trainingJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that a training job can be idle before being terminated."},"nodeAffinity":{"allOf":[{"$ref":"#/components/schemas/JobsNodeAffinity"}],"description":"Node affinity configuration for jobs in the project."},"permissions":{"allOf":[{"$ref":"#/components/schemas/ResourcePermissions"}],"description":"Deprecated. Instead, use the `accessRules` API to add permissions to a specific subject in the project scope.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use `nodePoolsResources`. Total resources assigned to the Project. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in `GET` are the sum of all Node Pool Resources."}}},"JobsNodeAffinity":{"properties":{"train":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for training jobs."},"interactive":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for interactive jobs."}}},"NodeAffinity":{"properties":{"affinityType":{"type":"string","enum":["no_limit","only_selected"],"description":"The type of affinity of the jobs on the nodes."},"selectedTypes":{"type":"array","items":{"$ref":"#/components/schemas/NodeTypeForProject"}}}},"NodeTypeForProject":{"properties":{"id":{"type":"number"},"name":{"type":"string"}}},"ResourcePermissions":{"properties":{"users":{"type":"array","items":{"type":"string"},"description":"Names of users that have permissions to the project."},"groups":{"type":"array","items":{"type":"string"},"description":"Names of groups that have permissions to the project."},"applications":{"type":"array","items":{"type":"string"},"description":"Names of applications that have permissions to the project."}}}}},"paths":{"/v1/k8s/clusters/{clusterId}/departments/{department-id}":{"put":{"tags":["Departments"],"deprecated":true,"summary":"Update a department.","operationId":"updateDepartment","description":"Updates a department's details in the cluster. \\n For example, node pools and other details.","parameters":[{"in":"path","name":"clusterId","schema":{"type":"string"},"required":true,"description":"The unique uuid identifying the cluster."},{"in":"path","name":"department-id","schema":{"type":"integer"},"required":true,"description":"The unique id identifying the department."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentUpdateRequest1"}}}},"responses":{"200":{"description":"Department updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Department2"}}}}}}}}}
```

## Delete a department.

> Deletes a department from a specific cluster.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"Department2":{"allOf":[{"properties":{"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to the Department per node pool."},"tenantId":{"type":"integer","description":"The tenant id this cluster belongs to."},"clusterUuid":{"type":"string","description":"The cluster UUID this department belongs to."},"createdAt":{"type":"string","description":"The creation date of the department.","format":"date-time"},"id":{"type":"integer","format":"int32","description":"The unique id identifying the department."},"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project2"},"description":"Projects under this department."},"projectsDeservedGpus":{"type":"string","description":"Deprecated. Instead, use 'nodePoolsResources' field. Total deserved GPUs of the projects under this department - as string.","deprecated":true},"departmentAdmins":{"type":"array","items":{"type":"string"},"description":"Id's of users with department admin role that are assigned to managed the department"}}},{"$ref":"#/components/schemas/DepartmentCommonFields"}]},"NodePoolAssignedResources":{"required":["id"],"allOf":[{"properties":{"id":{"description":"The id of the assigned resources. Required in PUT when updating the assigned resources.","type":"number"}}},{"$ref":"#/components/schemas/NodePoolAssignedResourcesCreate"}]},"NodePoolAssignedResourcesCreate":{"required":["nodePool"],"properties":{"nodePool":{"allOf":[{"$ref":"#/components/schemas/NodePoolResources"}],"description":"The node pool which the assigned resources refer to."},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of GPUs assigned in the node pool."},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of CPU Millicores assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Amount of CPU Memory Mib assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."}}},"NodePoolResources":{"required":["id"],"properties":{"id":{"type":"number","description":"Node pool id."},"name":{"type":"string","description":"Node pool name."}}},"Resource1":{"properties":{"deserved":{"type":"number","description":"The amount of resources guaranteed to be allocated in case the cluster has those resources."},"maxAllowed":{"type":"number","description":"Maximum amount of resources that can be allocated. If equal to deserved, no over-quota will be allowed. Use \"-1\" for unlimited over quota."},"overQuotaWeight":{"type":"number","description":"The priority for over quota resources."}}},"Project2":{"allOf":[{"properties":{"name":{"type":"string","description":"Project name."},"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to this Project per Node Pool."},"namespace":{"type":"string","description":"The name of an existing namespace to use for the project in the cluster. Supported only for cluster versions 2.12 or higher."},"id":{"type":"integer","format":"int32","description":"Project id.","readOnly":true},"departmentId":{"type":"integer","format":"int32","description":"ID of the department that owns the project."},"tenantId":{"type":"integer","format":"int32","description":"ID of the tenant where the project is located."},"clusterUuid":{"type":"string","format":"uuid","description":"ID of the cluster where the project is located."},"departmentName":{"type":"string","description":"Name of the department where the project is located."},"interactiveNodeAffinity":{"type":"string"},"trainNodeAffinity":{"type":"string"},"createdAt":{"type":"string","description":"Creation date of the project.","format":"date-time"},"status":{"$ref":"#/components/schemas/ProjectStatus1"},"phase":{"type":"string","description":"project's phase"}}},{"$ref":"#/components/schemas/ProjectCommonFields"}]},"ProjectStatus1":{"properties":{"namespace":{"type":"string","description":"The namespace of the project"},"message":{"type":"string","description":"Detailed phase message"},"quotaStatuses":{"$ref":"#/components/schemas/NodePoolsQuotaStatuses"}}},"NodePoolsQuotaStatuses":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolQuotaStatus"},"description":"The current quota status for each node pool. Supported only for cluster versions 2.15+ or higher."},"NodePoolQuotaStatus":{"properties":{"nodePoolName":{"type":"string","description":"The node pool name which the current quota status refers to."},"allocated":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"requested":{"$ref":"#/components/schemas/QuotaStatusResourceList"}}},"QuotaStatusResourceList":{"properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in Mib (allocated/requested/...)."}}},"ProjectCommonFields":{"properties":{"deservedGpus":{"type":"number","description":"Deprecated. Use 'deserved' for the relevant resource type under `NodePoolResources`. The project's deserved GPU allocation in case the cluster has those resources.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. An upper limit for the amount of GPUs the project can get (Even if over quota is allowed and resources are available).","deprecated":true},"gpuOverQuotaWeight":{"type":"number","description":"Deprecated. Instead, use `overQuotaWeight` for the relevant resource type under `NodePoolResources`. The priority the project gets for over quota resources.","maximum":3,"minimum":0,"deprecated":true},"defaultNodePools":{"type":"array","description":"Default node pools list for workload submission for this project if a workload doesn't specify a node pools list.","items":{"type":"string"}},"interactiveJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of interactive jobs from this project."},"interactiveJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive job can be idle before being terminated."},"interactivePreemptibleJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive preemptible job can be idle before being terminated."},"trainingJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of training jobs from this project. Available only from cluster version 2.12"},"trainingJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that a training job can be idle before being terminated."},"nodeAffinity":{"allOf":[{"$ref":"#/components/schemas/JobsNodeAffinity"}],"description":"Node affinity configuration for jobs in the project."},"permissions":{"allOf":[{"$ref":"#/components/schemas/ResourcePermissions"}],"description":"Deprecated. Instead, use the `accessRules` API to add permissions to a specific subject in the project scope.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use `nodePoolsResources`. Total resources assigned to the Project. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in `GET` are the sum of all Node Pool Resources."}}},"JobsNodeAffinity":{"properties":{"train":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for training jobs."},"interactive":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for interactive jobs."}}},"NodeAffinity":{"properties":{"affinityType":{"type":"string","enum":["no_limit","only_selected"],"description":"The type of affinity of the jobs on the nodes."},"selectedTypes":{"type":"array","items":{"$ref":"#/components/schemas/NodeTypeForProject"}}}},"NodeTypeForProject":{"properties":{"id":{"type":"number"},"name":{"type":"string"}}},"ResourcePermissions":{"properties":{"users":{"type":"array","items":{"type":"string"},"description":"Names of users that have permissions to the project."},"groups":{"type":"array","items":{"type":"string"},"description":"Names of groups that have permissions to the project."},"applications":{"type":"array","items":{"type":"string"},"description":"Names of applications that have permissions to the project."}}},"AssignedResources":{"properties":{"id":{"type":"number"},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"GPU number assigned"},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Millicores assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Memory Mib assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."}}},"DepartmentCommonFields":{"properties":{"name":{"type":"string","description":"The name of the department."},"deservedGpus":{"type":"number","description":"Deprecated. Instead, use `deserved` for the relevant resource type under `NodePoolResources`. Deserved GPUs for the department.","deprecated":true},"allowOverQuota":{"type":"boolean","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Is over quota allowed for the department.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Max allowed GPUs for the department.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use 'nodePoolsResources'. Total resources assigned to the Department. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in GET are the sum of all Node Pool Resources."}}}}},"paths":{"/v1/k8s/clusters/{clusterId}/departments/{department-id}":{"delete":{"tags":["Departments"],"deprecated":true,"summary":"Delete a department.","operationId":"deleteDepartment","description":"Deletes a department from a specific cluster.","parameters":[{"in":"path","name":"clusterId","schema":{"type":"string"},"required":true,"description":"The unique uuid identifying the cluster."},{"in":"path","name":"department-id","schema":{"type":"integer"},"required":true,"description":"The unique id identifying the department."}],"responses":{"200":{"description":"Department deleted successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Department2"}}}}}}}}}
```

## List all departments.

> List all the departments managed by the tenant on a specific cluster.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"Department2":{"allOf":[{"properties":{"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to the Department per node pool."},"tenantId":{"type":"integer","description":"The tenant id this cluster belongs to."},"clusterUuid":{"type":"string","description":"The cluster UUID this department belongs to."},"createdAt":{"type":"string","description":"The creation date of the department.","format":"date-time"},"id":{"type":"integer","format":"int32","description":"The unique id identifying the department."},"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project2"},"description":"Projects under this department."},"projectsDeservedGpus":{"type":"string","description":"Deprecated. Instead, use 'nodePoolsResources' field. Total deserved GPUs of the projects under this department - as string.","deprecated":true},"departmentAdmins":{"type":"array","items":{"type":"string"},"description":"Id's of users with department admin role that are assigned to managed the department"}}},{"$ref":"#/components/schemas/DepartmentCommonFields"}]},"NodePoolAssignedResources":{"required":["id"],"allOf":[{"properties":{"id":{"description":"The id of the assigned resources. Required in PUT when updating the assigned resources.","type":"number"}}},{"$ref":"#/components/schemas/NodePoolAssignedResourcesCreate"}]},"NodePoolAssignedResourcesCreate":{"required":["nodePool"],"properties":{"nodePool":{"allOf":[{"$ref":"#/components/schemas/NodePoolResources"}],"description":"The node pool which the assigned resources refer to."},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of GPUs assigned in the node pool."},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of CPU Millicores assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Amount of CPU Memory Mib assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."}}},"NodePoolResources":{"required":["id"],"properties":{"id":{"type":"number","description":"Node pool id."},"name":{"type":"string","description":"Node pool name."}}},"Resource1":{"properties":{"deserved":{"type":"number","description":"The amount of resources guaranteed to be allocated in case the cluster has those resources."},"maxAllowed":{"type":"number","description":"Maximum amount of resources that can be allocated. If equal to deserved, no over-quota will be allowed. Use \"-1\" for unlimited over quota."},"overQuotaWeight":{"type":"number","description":"The priority for over quota resources."}}},"Project2":{"allOf":[{"properties":{"name":{"type":"string","description":"Project name."},"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to this Project per Node Pool."},"namespace":{"type":"string","description":"The name of an existing namespace to use for the project in the cluster. Supported only for cluster versions 2.12 or higher."},"id":{"type":"integer","format":"int32","description":"Project id.","readOnly":true},"departmentId":{"type":"integer","format":"int32","description":"ID of the department that owns the project."},"tenantId":{"type":"integer","format":"int32","description":"ID of the tenant where the project is located."},"clusterUuid":{"type":"string","format":"uuid","description":"ID of the cluster where the project is located."},"departmentName":{"type":"string","description":"Name of the department where the project is located."},"interactiveNodeAffinity":{"type":"string"},"trainNodeAffinity":{"type":"string"},"createdAt":{"type":"string","description":"Creation date of the project.","format":"date-time"},"status":{"$ref":"#/components/schemas/ProjectStatus1"},"phase":{"type":"string","description":"project's phase"}}},{"$ref":"#/components/schemas/ProjectCommonFields"}]},"ProjectStatus1":{"properties":{"namespace":{"type":"string","description":"The namespace of the project"},"message":{"type":"string","description":"Detailed phase message"},"quotaStatuses":{"$ref":"#/components/schemas/NodePoolsQuotaStatuses"}}},"NodePoolsQuotaStatuses":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolQuotaStatus"},"description":"The current quota status for each node pool. Supported only for cluster versions 2.15+ or higher."},"NodePoolQuotaStatus":{"properties":{"nodePoolName":{"type":"string","description":"The node pool name which the current quota status refers to."},"allocated":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"requested":{"$ref":"#/components/schemas/QuotaStatusResourceList"}}},"QuotaStatusResourceList":{"properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in Mib (allocated/requested/...)."}}},"ProjectCommonFields":{"properties":{"deservedGpus":{"type":"number","description":"Deprecated. Use 'deserved' for the relevant resource type under `NodePoolResources`. The project's deserved GPU allocation in case the cluster has those resources.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. An upper limit for the amount of GPUs the project can get (Even if over quota is allowed and resources are available).","deprecated":true},"gpuOverQuotaWeight":{"type":"number","description":"Deprecated. Instead, use `overQuotaWeight` for the relevant resource type under `NodePoolResources`. The priority the project gets for over quota resources.","maximum":3,"minimum":0,"deprecated":true},"defaultNodePools":{"type":"array","description":"Default node pools list for workload submission for this project if a workload doesn't specify a node pools list.","items":{"type":"string"}},"interactiveJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of interactive jobs from this project."},"interactiveJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive job can be idle before being terminated."},"interactivePreemptibleJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive preemptible job can be idle before being terminated."},"trainingJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of training jobs from this project. Available only from cluster version 2.12"},"trainingJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that a training job can be idle before being terminated."},"nodeAffinity":{"allOf":[{"$ref":"#/components/schemas/JobsNodeAffinity"}],"description":"Node affinity configuration for jobs in the project."},"permissions":{"allOf":[{"$ref":"#/components/schemas/ResourcePermissions"}],"description":"Deprecated. Instead, use the `accessRules` API to add permissions to a specific subject in the project scope.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use `nodePoolsResources`. Total resources assigned to the Project. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in `GET` are the sum of all Node Pool Resources."}}},"JobsNodeAffinity":{"properties":{"train":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for training jobs."},"interactive":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for interactive jobs."}}},"NodeAffinity":{"properties":{"affinityType":{"type":"string","enum":["no_limit","only_selected"],"description":"The type of affinity of the jobs on the nodes."},"selectedTypes":{"type":"array","items":{"$ref":"#/components/schemas/NodeTypeForProject"}}}},"NodeTypeForProject":{"properties":{"id":{"type":"number"},"name":{"type":"string"}}},"ResourcePermissions":{"properties":{"users":{"type":"array","items":{"type":"string"},"description":"Names of users that have permissions to the project."},"groups":{"type":"array","items":{"type":"string"},"description":"Names of groups that have permissions to the project."},"applications":{"type":"array","items":{"type":"string"},"description":"Names of applications that have permissions to the project."}}},"AssignedResources":{"properties":{"id":{"type":"number"},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"GPU number assigned"},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Millicores assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Memory Mib assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."}}},"DepartmentCommonFields":{"properties":{"name":{"type":"string","description":"The name of the department."},"deservedGpus":{"type":"number","description":"Deprecated. Instead, use `deserved` for the relevant resource type under `NodePoolResources`. Deserved GPUs for the department.","deprecated":true},"allowOverQuota":{"type":"boolean","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Is over quota allowed for the department.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Max allowed GPUs for the department.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use 'nodePoolsResources'. Total resources assigned to the Department. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in GET are the sum of all Node Pool Resources."}}}}},"paths":{"/v1/k8s/clusters/{clusterId}/departments":{"get":{"tags":["Departments"],"deprecated":true,"summary":"List all departments.","description":"List all the departments managed by the tenant on a specific cluster.","operationId":"getDepartments","parameters":[{"in":"path","name":"clusterId","schema":{"type":"string"},"required":true,"description":"The Universally Unique Identifier (UUID) of the cluster."},{"in":"query","name":"excludePermissions","schema":{"type":"boolean"},"required":false,"description":"Backward compatibility of the `departmentAdmins` field. If `true`, the `departmentAdmins` field in the returned departments is not set. If `false`, the `departmentAdmins` is set in the returned departments."},{"in":"query","name":"memoryUnitMb","schema":{"type":"boolean"},"required":false,"description":"Memory returned in MB. When set to `false` (default) memory will be returned in MiB."}],"responses":{"200":{"description":"Successfully retrieved a list of Departments.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Department2"}}}}}}}}}}
```

## Create a new department.

> Creates a new department in the cluster.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"DepartmentCreateRequest":{"required":["name"],"allOf":[{"properties":{"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResourcesCreate"},"description":"Resources assigned to this Department per Node Pool"}}},{"$ref":"#/components/schemas/DepartmentCommonFields"}]},"NodePoolAssignedResourcesCreate":{"required":["nodePool"],"properties":{"nodePool":{"allOf":[{"$ref":"#/components/schemas/NodePoolResources"}],"description":"The node pool which the assigned resources refer to."},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of GPUs assigned in the node pool."},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Number of CPU Millicores assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"Amount of CPU Memory Mib assigned in the node pool. Supported only if the 'CPU Resources Quota' feature flag is enabled."}}},"NodePoolResources":{"required":["id"],"properties":{"id":{"type":"number","description":"Node pool id."},"name":{"type":"string","description":"Node pool name."}}},"Resource1":{"properties":{"deserved":{"type":"number","description":"The amount of resources guaranteed to be allocated in case the cluster has those resources."},"maxAllowed":{"type":"number","description":"Maximum amount of resources that can be allocated. If equal to deserved, no over-quota will be allowed. Use \"-1\" for unlimited over quota."},"overQuotaWeight":{"type":"number","description":"The priority for over quota resources."}}},"DepartmentCommonFields":{"properties":{"name":{"type":"string","description":"The name of the department."},"deservedGpus":{"type":"number","description":"Deprecated. Instead, use `deserved` for the relevant resource type under `NodePoolResources`. Deserved GPUs for the department.","deprecated":true},"allowOverQuota":{"type":"boolean","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Is over quota allowed for the department.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. Max allowed GPUs for the department.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use 'nodePoolsResources'. Total resources assigned to the Department. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in GET are the sum of all Node Pool Resources."}}},"AssignedResources":{"properties":{"id":{"type":"number"},"gpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"GPU number assigned"},"cpu":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Millicores assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."},"memory":{"allOf":[{"$ref":"#/components/schemas/Resource1"}],"description":"CPU Memory Mib assigned. Supported only if 'CPU Resources Quota' feature flag is enabled."}}},"Department2":{"allOf":[{"properties":{"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to the Department per node pool."},"tenantId":{"type":"integer","description":"The tenant id this cluster belongs to."},"clusterUuid":{"type":"string","description":"The cluster UUID this department belongs to."},"createdAt":{"type":"string","description":"The creation date of the department.","format":"date-time"},"id":{"type":"integer","format":"int32","description":"The unique id identifying the department."},"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project2"},"description":"Projects under this department."},"projectsDeservedGpus":{"type":"string","description":"Deprecated. Instead, use 'nodePoolsResources' field. Total deserved GPUs of the projects under this department - as string.","deprecated":true},"departmentAdmins":{"type":"array","items":{"type":"string"},"description":"Id's of users with department admin role that are assigned to managed the department"}}},{"$ref":"#/components/schemas/DepartmentCommonFields"}]},"NodePoolAssignedResources":{"required":["id"],"allOf":[{"properties":{"id":{"description":"The id of the assigned resources. Required in PUT when updating the assigned resources.","type":"number"}}},{"$ref":"#/components/schemas/NodePoolAssignedResourcesCreate"}]},"Project2":{"allOf":[{"properties":{"name":{"type":"string","description":"Project name."},"nodePoolsResources":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolAssignedResources"},"description":"Resources assigned to this Project per Node Pool."},"namespace":{"type":"string","description":"The name of an existing namespace to use for the project in the cluster. Supported only for cluster versions 2.12 or higher."},"id":{"type":"integer","format":"int32","description":"Project id.","readOnly":true},"departmentId":{"type":"integer","format":"int32","description":"ID of the department that owns the project."},"tenantId":{"type":"integer","format":"int32","description":"ID of the tenant where the project is located."},"clusterUuid":{"type":"string","format":"uuid","description":"ID of the cluster where the project is located."},"departmentName":{"type":"string","description":"Name of the department where the project is located."},"interactiveNodeAffinity":{"type":"string"},"trainNodeAffinity":{"type":"string"},"createdAt":{"type":"string","description":"Creation date of the project.","format":"date-time"},"status":{"$ref":"#/components/schemas/ProjectStatus1"},"phase":{"type":"string","description":"project's phase"}}},{"$ref":"#/components/schemas/ProjectCommonFields"}]},"ProjectStatus1":{"properties":{"namespace":{"type":"string","description":"The namespace of the project"},"message":{"type":"string","description":"Detailed phase message"},"quotaStatuses":{"$ref":"#/components/schemas/NodePoolsQuotaStatuses"}}},"NodePoolsQuotaStatuses":{"type":"array","items":{"$ref":"#/components/schemas/NodePoolQuotaStatus"},"description":"The current quota status for each node pool. Supported only for cluster versions 2.15+ or higher."},"NodePoolQuotaStatus":{"properties":{"nodePoolName":{"type":"string","description":"The node pool name which the current quota status refers to."},"allocated":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"allocatedNonPreemptible":{"$ref":"#/components/schemas/QuotaStatusResourceList"},"requested":{"$ref":"#/components/schemas/QuotaStatusResourceList"}}},"QuotaStatusResourceList":{"properties":{"gpu":{"type":"number","description":"The number of GPUs (allocated/requested/...)."},"cpu":{"type":"number","description":"CPU in Millicores (allocated/requested/...)."},"memory":{"type":"number","description":"Memory in Mib (allocated/requested/...)."}}},"ProjectCommonFields":{"properties":{"deservedGpus":{"type":"number","description":"Deprecated. Use 'deserved' for the relevant resource type under `NodePoolResources`. The project's deserved GPU allocation in case the cluster has those resources.","deprecated":true},"maxAllowedGpus":{"type":"number","description":"Deprecated. Instead, use `maxAllowed` for the relevant resource type under `NodePoolResources`. An upper limit for the amount of GPUs the project can get (Even if over quota is allowed and resources are available).","deprecated":true},"gpuOverQuotaWeight":{"type":"number","description":"Deprecated. Instead, use `overQuotaWeight` for the relevant resource type under `NodePoolResources`. The priority the project gets for over quota resources.","maximum":3,"minimum":0,"deprecated":true},"defaultNodePools":{"type":"array","description":"Default node pools list for workload submission for this project if a workload doesn't specify a node pools list.","items":{"type":"string"}},"interactiveJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of interactive jobs from this project."},"interactiveJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive job can be idle before being terminated."},"interactivePreemptibleJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that an interactive preemptible job can be idle before being terminated."},"trainingJobTimeLimitSecs":{"type":"number","description":"A limit (in seconds) for the duration of training jobs from this project. Available only from cluster version 2.12"},"trainingJobMaxIdleDurationSecs":{"type":"number","description":"Maximum duration (in seconds) that a training job can be idle before being terminated."},"nodeAffinity":{"allOf":[{"$ref":"#/components/schemas/JobsNodeAffinity"}],"description":"Node affinity configuration for jobs in the project."},"permissions":{"allOf":[{"$ref":"#/components/schemas/ResourcePermissions"}],"description":"Deprecated. Instead, use the `accessRules` API to add permissions to a specific subject in the project scope.","deprecated":true},"resources":{"allOf":[{"$ref":"#/components/schemas/AssignedResources"}],"deprecated":true,"description":"Deprecated. Instead, use `nodePoolsResources`. Total resources assigned to the Project. Can only be used in PUT/POST when there is a single Node Pool in the system. The resources returned in `GET` are the sum of all Node Pool Resources."}}},"JobsNodeAffinity":{"properties":{"train":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for training jobs."},"interactive":{"allOf":[{"$ref":"#/components/schemas/NodeAffinity"}],"description":"Node affinity configuration for interactive jobs."}}},"NodeAffinity":{"properties":{"affinityType":{"type":"string","enum":["no_limit","only_selected"],"description":"The type of affinity of the jobs on the nodes."},"selectedTypes":{"type":"array","items":{"$ref":"#/components/schemas/NodeTypeForProject"}}}},"NodeTypeForProject":{"properties":{"id":{"type":"number"},"name":{"type":"string"}}},"ResourcePermissions":{"properties":{"users":{"type":"array","items":{"type":"string"},"description":"Names of users that have permissions to the project."},"groups":{"type":"array","items":{"type":"string"},"description":"Names of groups that have permissions to the project."},"applications":{"type":"array","items":{"type":"string"},"description":"Names of applications that have permissions to the project."}}}}},"paths":{"/v1/k8s/clusters/{clusterId}/departments":{"post":{"tags":["Departments"],"deprecated":true,"summary":"Create a new department.","description":"Creates a new department in the cluster.","operationId":"createDepartment","parameters":[{"in":"path","name":"clusterId","schema":{"type":"string"},"required":true,"description":"The unique uuid identifying the cluster."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentCreateRequest"}}}},"responses":{"200":{"description":"Department created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Department2"}}}}}}}}}
```

## Set the department admins.

> Deprecated. Instead, use the accessrules API to add the department-admin permissions to a specific subject.

```json
{"openapi":"3.0.3","info":{"title":"Runai API","version":"2.19"},"tags":[{"name":"Departments","description":"Departments, in the hierarchy of resource allocation, are above Projects. A Department can contain multiple Projects, and has its own quotas. \nA Department's quota supersedes the total of the Project quotas in the Department, so tt is recommended \nthat a Department's quota be the total, or more than of all the Project quotas in the Department. \nFor further information see, [Working with Departments](https://docs.run.ai/v2.19/admin/admin-ui-setup/department-setup/?h=departments#departments).\n"}],"servers":[{"url":"https://app.run.ai"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication"}},"schemas":{"DepartmentAccessControl":{"properties":{"departmentId":{"type":"integer","format":"int32","description":"The unique id identifying the department."},"departmentAdmins":{"type":"array","items":{"type":"string"},"description":"Id's of users with department admin role that are assigned to managed the department"}}},"Error":{"required":["code","message"],"properties":{"code":{"type":"integer","minimum":100,"maximum":599},"message":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/v1/k8s/clusters/{clusterId}/departments/{department-id}/access-control":{"put":{"tags":["Departments"],"summary":"Set the department admins.","description":"Deprecated. Instead, use the accessrules API to add the department-admin permissions to a specific subject.","operationId":"updateDepartmentAdmins","deprecated":true,"parameters":[{"in":"path","name":"clusterId","schema":{"type":"string"},"required":true,"description":"The unique uuid identifying the cluster."},{"in":"path","name":"department-id","schema":{"type":"integer"},"required":true,"description":"The unique id identifying the department."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentAccessControl"}}}},"responses":{"201":{"description":"Department admin set successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentAccessControl"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad request."},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthenticated"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Forbidden"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://run-ai-docs.nvidia.com/api/2.19/organizations/departments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
