# Optimization Settings

## GET /v1/avatars/{projectId}/optimization-settings/{optimizationSettingsId}

> Get a set of Optimization Settings

```json
{"openapi":"3.0.0","info":{"title":"M-Serve","version":"0.1.0"},"servers":[{"url":"https://api.msquared.io"}],"paths":{"/v1/avatars/{projectId}/optimization-settings/{optimizationSettingsId}":{"get":{"summary":"Get a set of Optimization Settings","operationId":"v1_avatarsService_getOptimizationSettings","tags":["avatars","optimization_settings"],"parameters":[{"name":"projectId","in":"path","required":true,"description":"The ID of the Project the Optimization Settings belongs to","schema":{"type":"string"}},{"name":"optimizationSettingsId","in":"path","required":true,"description":"The ID of the Optimization Settings to get","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1_avatarsService_GetOptimizationSettingsResponse"}}}},"default":{"$ref":"#/components/responses/Error"}}}}},"components":{"schemas":{"v1_avatarsService_GetOptimizationSettingsResponse":{"allOf":[{"$ref":"#/components/schemas/OptimizationSettings"},{"type":"object","additionalProperties":false,"required":["canWrite"],"properties":{"canWrite":{"type":"boolean","description":"Whether the user has write permissions"}}}]},"OptimizationSettings":{"type":"object","additionalProperties":false,"required":["id","name","preset"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"preset":{"type":"string","enum":["low","medium","high"]},"createdAt":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserIdOrAPIKeyId"}}},"UserIdOrAPIKeyId":{"oneOf":[{"type":"object","additionalProperties":false,"required":["userId","type"],"properties":{"userId":{"type":"string"},"type":{"type":"string","enum":["user"]}}},{"type":"object","additionalProperties":false,"required":["apiKeyId","type"],"properties":{"apiKeyId":{"type":"string"},"type":{"type":"string","enum":["apiKey"]}}}]},"Error":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"message":{"type":"string"}}}},"responses":{"Error":{"description":"An error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

## GET /v1/avatars/{projectId}/optimization-settings

> List all Optimization Settings for a project

```json
{"openapi":"3.0.0","info":{"title":"M-Serve","version":"0.1.0"},"servers":[{"url":"https://api.msquared.io"}],"paths":{"/v1/avatars/{projectId}/optimization-settings":{"get":{"summary":"List all Optimization Settings for a project","operationId":"v1_avatarsService_listOptimizationSettings","tags":["avatars","optimization_settings"],"parameters":[{"name":"projectId","in":"path","required":true,"description":"The ID of the Project the Optimization Settings belongs to","schema":{"type":"string"}},{"name":"offset","in":"query","description":"The offset into queried items to return","required":false,"schema":{"type":"integer","minimum":0,"format":"int32"}},{"name":"limit","in":"query","description":"The maximum number of items to return (maximum 100)","required":false,"schema":{"type":"integer","minimum":0,"maximum":100,"format":"int32"}},{"name":"search","in":"query","description":"The search query to filter the results","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1_avatarsService_ListOptimizationSettingsResponse"}}}},"default":{"$ref":"#/components/responses/Error"}}}}},"components":{"schemas":{"v1_avatarsService_ListOptimizationSettingsResponse":{"type":"object","additionalProperties":false,"required":["optimizationSettings","totalResults","offset","limit","canWrite"],"properties":{"optimizationSettings":{"type":"array","items":{"$ref":"#/components/schemas/OptimizationSettings"}},"totalResults":{"type":"integer","description":"The total number of results, before applying the limit and offset"},"offset":{"type":"integer","description":"The offset into queried items to return"},"limit":{"type":"integer","description":"The maximum number of items to return"},"canWrite":{"type":"boolean","description":"Whether the user has write permissions"}}},"OptimizationSettings":{"type":"object","additionalProperties":false,"required":["id","name","preset"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"preset":{"type":"string","enum":["low","medium","high"]},"createdAt":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserIdOrAPIKeyId"}}},"UserIdOrAPIKeyId":{"oneOf":[{"type":"object","additionalProperties":false,"required":["userId","type"],"properties":{"userId":{"type":"string"},"type":{"type":"string","enum":["user"]}}},{"type":"object","additionalProperties":false,"required":["apiKeyId","type"],"properties":{"apiKeyId":{"type":"string"},"type":{"type":"string","enum":["apiKey"]}}}]},"Error":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"message":{"type":"string"}}}},"responses":{"Error":{"description":"An error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

## POST /v1/avatars/{projectId}/optimization-settings

> Create a set of Optimization Settings

```json
{"openapi":"3.0.0","info":{"title":"M-Serve","version":"0.1.0"},"servers":[{"url":"https://api.msquared.io"}],"paths":{"/v1/avatars/{projectId}/optimization-settings":{"post":{"summary":"Create a set of Optimization Settings","operationId":"v1_avatarsService_createOptimizationSettings","tags":["avatars","optimization_settings"],"parameters":[{"name":"projectId","in":"path","required":true,"description":"The ID of the Project the Optimization Settings belongs to","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1_avatarsService_CreateOptimizationSettingsRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1_avatarsService_CreateOptimizationSettingsResponse"}}}},"default":{"$ref":"#/components/responses/Error"}}}}},"components":{"schemas":{"v1_avatarsService_CreateOptimizationSettingsRequest":{"type":"object","additionalProperties":false,"required":["name","preset"],"properties":{"name":{"type":"string"},"preset":{"type":"string","enum":["low","medium","high"]}}},"v1_avatarsService_CreateOptimizationSettingsResponse":{"$ref":"#/components/schemas/OptimizationSettings"},"OptimizationSettings":{"type":"object","additionalProperties":false,"required":["id","name","preset"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"preset":{"type":"string","enum":["low","medium","high"]},"createdAt":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserIdOrAPIKeyId"}}},"UserIdOrAPIKeyId":{"oneOf":[{"type":"object","additionalProperties":false,"required":["userId","type"],"properties":{"userId":{"type":"string"},"type":{"type":"string","enum":["user"]}}},{"type":"object","additionalProperties":false,"required":["apiKeyId","type"],"properties":{"apiKeyId":{"type":"string"},"type":{"type":"string","enum":["apiKey"]}}}]},"Error":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"message":{"type":"string"}}}},"responses":{"Error":{"description":"An error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

## DELETE /v1/avatars/{projectId}/optimization-settings/{optimizationSettingsId}

> Delete a set of Optimization Settings

```json
{"openapi":"3.0.0","info":{"title":"M-Serve","version":"0.1.0"},"servers":[{"url":"https://api.msquared.io"}],"paths":{"/v1/avatars/{projectId}/optimization-settings/{optimizationSettingsId}":{"delete":{"summary":"Delete a set of Optimization Settings","operationId":"v1_avatarsService_deleteOptimizationSettings","tags":["avatars","optimization_settings"],"parameters":[{"name":"projectId","in":"path","required":true,"description":"The ID of the Project the Optimization Settings belongs to","schema":{"type":"string"}},{"name":"optimizationSettingsId","in":"path","required":true,"description":"The ID of the Optimization Settings to delete","schema":{"type":"string"}}],"responses":{"204":{"description":"Success"},"default":{"$ref":"#/components/responses/Error"}}}}},"components":{"responses":{"Error":{"description":"An error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"message":{"type":"string"}}}}}}
```

## PATCH /v1/avatars/{projectId}/optimization-settings/{optimizationSettingsId}

> Update a set of Optimization Settings

```json
{"openapi":"3.0.0","info":{"title":"M-Serve","version":"0.1.0"},"servers":[{"url":"https://api.msquared.io"}],"paths":{"/v1/avatars/{projectId}/optimization-settings/{optimizationSettingsId}":{"patch":{"summary":"Update a set of Optimization Settings","operationId":"v1_avatarsService_updateOptimizationSettings","tags":["avatars","optimization_settings"],"parameters":[{"name":"projectId","in":"path","required":true,"description":"The ID of the Project the Optimization Settings belongs to","schema":{"type":"string"}},{"name":"optimizationSettingsId","in":"path","required":true,"description":"The ID of the Optimization Settings to update","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1_avatarsService_UpdateOptimizationSettingsRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1_avatarsService_UpdateOptimizationSettingsResponse"}}}},"default":{"$ref":"#/components/responses/Error"}}}}},"components":{"schemas":{"v1_avatarsService_UpdateOptimizationSettingsRequest":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string"},"preset":{"type":"string","enum":["low","medium","high"]}}},"v1_avatarsService_UpdateOptimizationSettingsResponse":{"$ref":"#/components/schemas/OptimizationSettings"},"OptimizationSettings":{"type":"object","additionalProperties":false,"required":["id","name","preset"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"preset":{"type":"string","enum":["low","medium","high"]},"createdAt":{"type":"string"},"createdBy":{"$ref":"#/components/schemas/UserIdOrAPIKeyId"}}},"UserIdOrAPIKeyId":{"oneOf":[{"type":"object","additionalProperties":false,"required":["userId","type"],"properties":{"userId":{"type":"string"},"type":{"type":"string","enum":["user"]}}},{"type":"object","additionalProperties":false,"required":["apiKeyId","type"],"properties":{"apiKeyId":{"type":"string"},"type":{"type":"string","enum":["apiKey"]}}}]},"Error":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"message":{"type":"string"}}}},"responses":{"Error":{"description":"An error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

## GET /v1/avatars/{projectId}/optimization-settings/usage

> List usage for processing avatars for the project

```json
{"openapi":"3.0.0","info":{"title":"M-Serve","version":"0.1.0"},"servers":[{"url":"https://api.msquared.io"}],"paths":{"/v1/avatars/{projectId}/optimization-settings/usage":{"get":{"summary":"List usage for processing avatars for the project","operationId":"v1_avatarsService_listOptimizationSettingsUsage","tags":["avatars","optimization_settings","usage"],"parameters":[{"name":"projectId","in":"path","required":true,"description":"The id of the Project","schema":{"type":"string"}},{"name":"startTime","description":"The starting ISO 8601 timestamp of the usage period","in":"query","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"endTime","description":"The ending ISO 8601 timestamp for this usage period","in":"query","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"interval","description":"An ISO 8601 duration for the interval","in":"query","required":true,"schema":{"type":"string","enum":["P1D","PT1H","PT1M"]}},{"name":"optimizationSettingsId","description":"The id of the Optimization Settings to filter by","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"The Optimization Settings's usage","content":{"application/json":{"schema":{"type":"object","required":["intervals"],"properties":{"intervals":{"type":"array","items":{"$ref":"#/components/schemas/v1_avatarsService_OptimizationSettingsUsageInterval"}}}}}}},"default":{"$ref":"#/components/responses/Error"}}}}},"components":{"schemas":{"v1_avatarsService_OptimizationSettingsUsageInterval":{"type":"object","additionalProperties":false,"required":["startTime","endTime","avatarBakesCount"],"properties":{"startTime":{"type":"string","format":"date-time"},"endTime":{"type":"string","format":"date-time"},"avatarBakesCount":{"type":"integer"}}},"Error":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"message":{"type":"string"}}}},"responses":{"Error":{"description":"An error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```

## PUT /v1/avatars/{projectId}/optimization-settings/{optimizationSettingsId}/process

> Initiates processing an avatar using the provided settings

```json
{"openapi":"3.0.0","info":{"title":"M-Serve","version":"0.1.0"},"servers":[{"url":"https://api.msquared.io"}],"paths":{"/v1/avatars/{projectId}/optimization-settings/{optimizationSettingsId}/process":{"put":{"summary":"Initiates processing an avatar using the provided settings","operationId":"v1_avatarsService_processAvatar","tags":["avatars","optimization_settings","process"],"parameters":[{"name":"projectId","in":"path","required":true,"description":"The ID of the Project the Optimization Settings belongs to","schema":{"type":"string"}},{"name":"optimizationSettingsId","in":"path","required":true,"description":"The ID of the Optimization Settings to use for processing the avatar","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1_avatarsService_ProcessAvatarRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/v1_avatarsService_ProcessAvatarResponse"}}}},"default":{"$ref":"#/components/responses/Error"}}}}},"components":{"schemas":{"v1_avatarsService_ProcessAvatarRequest":{"type":"object","additionalProperties":false,"required":["avatarMml"],"properties":{"avatarMml":{"type":"string","description":"The MML of the avatar to process"}}},"v1_avatarsService_ProcessAvatarResponse":{"type":"object","additionalProperties":false,"required":["glbUrl","mmlUrl"],"properties":{"glbUrl":{"type":"string","description":"A URL linking to the GLB file containing the processed avatar"},"mmlUrl":{"type":"string","description":"A URL linking to the MML file which uses the processed avatar"}}},"Error":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"message":{"type":"string"}}}},"responses":{"Error":{"description":"An error occurred","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}
```
