

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "2.0.0",
    "title": "Server Side Recording API",
    "description": "## Overview \n\nServer-side recording (SSR) allows for the recording of portions of a voice conversation to create a record that can be used as supporting evidence when reviewing potentially disruptive behavior that occurred on a call.\nA recording is created based on a defined number of minutes preceding the request and can either specify users in the channel or all participants.",
    "contact": {
      "name": "Vivox Support",
      "email": "mps-sdk-support@unity3d.com"
    }
  },
  "tags": [
    {
      "name": "Vivox"
    }
  ],
  "servers": [
    {
      "url": "https://vivox.services.api.unity.com/ssr/v2"
    }
  ],
  "paths": {
    "/organizations/{organizationId}/projects/{projectId}/monitor": {
      "post": {
        "summary": "SSR Monitor Request",
        "operationId": "postSSRMonitor",
        "description": "Create a server side recording job that uploads the last history minutes of audio from the target channel to your cloud storage. The job runs asynchronously; its result is posted to callbackUrl.",
        "tags": [
          "Vivox"
        ],
        "security": [
          {
            "basicAuth": []
          }
        ],
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "description": "Organization ID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "projectId",
            "in": "path",
            "required": true,
            "description": "Project ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestBody"
              }
            }
          }
        },
        "callbacks": {
          "monitorCallback": {
            "callbackUrl": {
              "post": {
                "description": "Callback for job completion",
                "requestBody": {
                  "description": "Callback payload",
                  "content": {
                    "application/json": {
                      "schema": {
                        "$ref": "#/components/schemas/CallBackBody"
                      }
                    }
                  }
                },
                "responses": {
                  "200": {
                    "description": "callback successfully processed"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SSRMonitorJobResponse"
                }
              }
            }
          },
          "202": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SSRMonitorJobResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/UserError"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/UserError"
                }
              }
            }
          },
          "403": {
            "description": "The issuer in targetUri does not belong to the project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/UserError"
                }
              }
            }
          },
          "404": {
            "description": "Project was not found",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/UserError"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VivoxInternalError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic",
        "description": "To get started with Authentication, please visit the [Service Account Authentication section](https://services.docs.unity.com/docs/service-account-auth).\n\nFor this API, you must add the following role(s) to your service account :\n| Purpose | Roles | Permissions |\n| --- | --- | --- |\n| Create SSR Monitor Job | Server Side Recording Processor | <ul><li>vivox.ssr_monitor.create</li><ul> |"
      }
    },
    "schemas": {
      "SSRMonitorJobResponse": {
        "type": "object",
        "properties": {
          "msg": {
            "type": "string",
            "example": "ok"
          },
          "code": {
            "type": "integer",
            "example": 202
          },
          "id": {
            "type": "string",
            "example": "a776133b-8a93-4fed-a250-db6f16296703",
            "description": "UUID of the job that has been created"
          }
        },
        "required": [
          "msg",
          "code"
        ]
      },
      "CallBackBody": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "a776133b-8a93-4fed-a250-db6f16296703",
            "description": "UUID of the job that has completed"
          },
          "job_status": {
            "type": "string",
            "enum": [
              "completed",
              "failed"
            ]
          },
          "code": {
            "type": "integer",
            "example": 2000,
            "description": "Status code associated with the result of the job"
          }
        }
      },
      "UserError": {
        "type": "object",
        "description": "User error response",
        "example": {
          "title": "Bad Request",
          "detail": "The request body is missing the required field 'targetUri'",
          "status": 400,
          "details": [
            "targetUri is required"
          ]
        },
        "properties": {
          "title": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "example": 400,
            "description": "request status code"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "string",
              "string"
            ],
            "description": "error status"
          },
          "missingFields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Required request body fields that are missing"
          }
        }
      },
      "VivoxInternalError": {
        "type": "object",
        "description": "Generic internal error returned by the Vivox facade",
        "required": [
          "msg"
        ],
        "properties": {
          "msg": {
            "type": "string",
            "example": "internal server error"
          }
        }
      },
      "RequestBody": {
        "type": "object",
        "description": "Request body for SSR Monitor Request",
        "required": [
          "targetUri",
          "history",
          "storageOptions"
        ],
        "properties": {
          "targetUri": {
            "type": "string",
            "description": "Vivox SIP uri of the channel you wish to record",
            "example": "sip:confctl-e-<issuer>.<username>@<domain>.vivox.com"
          },
          "callbackUrl": {
            "type": "string",
            "example": "https://mycallback.com",
            "description": "URL to send a callback to for messages about a processed job.  These callbacks contain the status a given job. If a job completes successfully or fails you will get a callback with the status of the job."
          },
          "callbackKey": {
            "type": "string",
            "example": "my-key",
            "description": "The key passed in this field will be included in the header of the callback request under Vivox-Callback-Key"
          },
          "history": {
            "type": "integer",
            "description": "How much data to upload from n number of minutes in the past from the time of the request.",
            "example": 5,
            "minimum": 1,
            "maximum": 45
          },
          "filterUris": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of SIP uris to filter to. If this field is provided you will only receive audio for users provided in the array. If left empty you will receive audio for all users in the channel.",
            "example": [
              "sip:.my-issuer.my-user.@domain.vivox.com"
            ]
          },
          "perspectiveTarget": {
            "type": "string",
            "description": "Only uploads audio of participants who heard this player, can not be used with filterUris or global channels",
            "example": "sip:.<issuer>.<username@<domain>.vivox.com"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "storageOptions": {
            "type": "object",
            "description": "Storage options for the recording. Determines where the audio is uploaded to using the supplied credentials and bucket.",
            "required": [
              "provider",
              "credentials"
            ],
            "properties": {
              "provider": {
                "type": "string",
                "example": "aws",
                "description": "Cloud provider you are targeting. Valid options are 'aws' or 'gcp'"
              },
              "credentials": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/AWSCredentials"
                  },
                  {
                    "$ref": "#/components/schemas/GCPCredentials"
                  }
                ]
              }
            }
          }
        }
      },
      "AWSCredentials": {
        "type": "object",
        "description": "AWS credentials for uploading data",
        "required": [
          "bucket",
          "accessKeyId",
          "secretAccessKey"
        ],
        "properties": {
          "bucket": {
            "type": "string",
            "example": "my-bucket",
            "description": "AWS bucket to upload data to"
          },
          "accessKeyId": {
            "type": "string",
            "example": "secret-id",
            "description": "AWS secret id"
          },
          "secretAccessKey": {
            "type": "string",
            "example": "AWS secret key",
            "description": "AWS secret key"
          }
        }
      },
      "GCPCredentials": {
        "type": "object",
        "description": "GCP credentials for uploading data",
        "required": [
          "serviceAccount",
          "gcsPath"
        ],
        "properties": {
          "serviceAccount": {
            "type": "object",
            "example": {
              "type": "",
              "project_id": "",
              "private_key_id": "",
              "private_key": "",
              "client_email": "",
              "client_id": "",
              "auth_uri": "",
              "token_uri": "",
              "auth_provider_x509_cert_url": "",
              "client_x509_cert_url": "",
              "universe_domain": ""
            },
            "description": "GCP service account"
          },
          "gcsPath": {
            "type": "string",
            "example": "gcs-path",
            "description": "GCP path to upload data to"
          }
        }
      },
      "Metadata": {
        "maxItems": 50,
        "type": "object",
        "description": "Metadata for the recording. This is a key value pair that can be used to store additional information about the recording.",
        "example": {
          "eventType": "report",
          "playerReportEvents": {
            "reportType": [
              "yelling",
              "toxic"
            ],
            "reporterPlayerId": "reporter-123456789",
            "reportedPlayerId": "reported-123456789",
            "reportReason": "disturbing game",
            "reportTimestamp": 1668432971
          }
        },
        "properties": {
          "eventType": {
            "type": "string",
            "enum": [
              "report",
              "sample"
            ],
            "description": "The type of event that has occurred"
          },
          "playerReportEvents": {
            "required": [
              "reportType",
              "reporterPlayerId",
              "reportedPlayerId"
            ],
            "type": "object",
            "properties": {
              "reportType": {
                "type": "array",
                "example": [
                  "yelling",
                  "toxic"
                ],
                "items": {
                  "type": "string"
                },
                "description": "type of report"
              },
              "reporterPlayerId": {
                "type": "string",
                "example": "reporter-123456789",
                "description": "Player who reported the event"
              },
              "reportedPlayerId": {
                "type": "string",
                "example": "reported-123456789",
                "description": "Player who was reported in the event"
              },
              "reportReason": {
                "type": "string",
                "example": "disturbing game",
                "description": "Description of the event from a player report"
              },
              "reportTimestamp": {
                "type": "integer",
                "example": 1668432971,
                "description": "Unix timestamp of the event"
              }
            }
          }
        }
      }
    }
  }
}
```