

````json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Cloud Code Admin API",
    "version": "1.0",
    "description": "## Overview\n\nThis is the API specification for the Unity Cloud Code Admin service that enables\ngame developers to create and edit server-side code for their games.\n\n## Rate limits\n\nThe API has rate limiting in place. The endpoints are limited to 60 requests per second and 1000 requests per thirty minutes on a per-project and per-IP basis.\n\nThe API responds with a `429` HTTP status code if the rate limit is\nexceeded.\n\nThe API also responds with a `Retry-After` header to use in conjunction with a client's retry logic.\nThe value is the number of seconds until the API accepts a request for the given project and IP.\n\n## Useful links\n\n- [Cloud Code](https://docs.unity.com/cloud-code/)\n",
    "contact": {
      "name": "Banasco",
      "x-slack-channel": "#ask-cloud-code"
    }
  },
  "tags": [
    {
      "name": "Cloud Code modules",
      "description": "You can deploy a Cloud Code module with the UGS CLI by using the\n[deploy command], or by using the Cloud Code [admin APIs]. Cloud Code\nmodules are C# projects built either with .NET Core or .NET Framework.\n\nA Cloud Code module can have one or more Cloud Code functions, which are\ndefined with the attribute `CloudCodeFunction`. For example, the\nfollowing code represents a Cloud Code module named `HelloWorld` with a\nfunction named `SayHello`. `SayHello` accepts a single string parameter\ncalled `name`.\n\n```cs\npublic class HelloWorld\n{\n  [CloudCodeFunction(\"SayHello\")]\n  public string SayHello(string name)\n  {\n      return $\"Hello, {name}!\";\n  }\n}\n```\n\n[deploy command]: /guides/ugs-cli/latest/general/base-commands/deploy\n[admin APIs]: /cloud-code-admin\n\n### Module size limit\n\nA compiled module should not exceed the limit of 10 MB. The API responds with a `413` HTTP status code if the\nupload size limit is exceeded.\n"
    },
    {
      "name": "Cloud Code scripts",
      "description": "You can create a Cloud Code script through this API, as well as in the\n[UGS dashboard].\n\n[UGS dashboard]: https://dashboard.unity3d.com/cloud-code\n\n### Code size\n\nThe script code can be a maximum of 128 KB. Attempting to save a script\nwhose code exceeds that length results in a `400` validation error.\n"
    }
  ],
  "servers": [
    {
      "url": "https://services.api.unity.com"
    }
  ],
  "paths": {
    "/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ProjectId"
        },
        {
          "$ref": "#/components/parameters/EnvironmentId"
        }
      ],
      "get": {
        "summary": "List scripts",
        "operationId": "listScripts",
        "tags": [
          "Cloud Code scripts"
        ],
        "description": "Get a list of the Cloud Code scripts for a project environment",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.scripts.list"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            },
            "in": "query",
            "name": "limit",
            "description": "The number of scripts to return."
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9-_]+$"
            },
            "in": "query",
            "name": "after"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListScriptsResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      },
      "post": {
        "summary": "Create script",
        "operationId": "createScript",
        "tags": [
          "Cloud Code scripts"
        ],
        "description": "Create a Cloud Code script for a project environment",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.scripts.create"
            ]
          }
        ],
        "requestBody": {
          "description": "Provide script name, type and code. Parameters are optional. If no code is provided, a placeholder code example is used.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateScriptRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts/{scriptName}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ProjectId"
        },
        {
          "$ref": "#/components/parameters/EnvironmentId"
        },
        {
          "$ref": "#/components/parameters/ScriptName"
        }
      ],
      "get": {
        "summary": "Get script",
        "tags": [
          "Cloud Code scripts"
        ],
        "operationId": "getScript",
        "description": "Get a Cloud Code script for a project environment",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.scripts.get"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetScriptResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      },
      "patch": {
        "summary": "Update script",
        "tags": [
          "Cloud Code scripts"
        ],
        "operationId": "updateScript",
        "description": "Update a Cloud Code script for a project environment",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.scripts.update"
            ]
          }
        ],
        "requestBody": {
          "description": "Provide updated script code, parameters, or both. If you provide an empty parameters array, the present parameters will be removed.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateScriptRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      },
      "delete": {
        "summary": "Delete script",
        "tags": [
          "Cloud Code scripts"
        ],
        "operationId": "deleteScript",
        "description": "Delete a Cloud Code script for a project environment.",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.scripts.delete"
            ]
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts/{scriptName}/publish": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ProjectId"
        },
        {
          "$ref": "#/components/parameters/EnvironmentId"
        },
        {
          "$ref": "#/components/parameters/ScriptName"
        }
      ],
      "post": {
        "summary": "Publish script",
        "operationId": "publishScript",
        "tags": [
          "Cloud Code scripts"
        ],
        "description": "Publish a Cloud Code script for a project environment. You can't republish the active script, or publish a script with compiliaton errors.",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.scripts.publish"
            ]
          }
        ],
        "requestBody": {
          "description": "Optional. Provide a version number to publish if you want to republish an older version. By default, the working copy is published.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishScriptRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublishScriptResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    },
    "/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ProjectId"
        },
        {
          "$ref": "#/components/parameters/EnvironmentId"
        }
      ],
      "get": {
        "summary": "List modules",
        "operationId": "listModules",
        "tags": [
          "Cloud Code modules"
        ],
        "description": "Get a list of Cloud Code modules within a project environment.\n\nThis endpoint supports token-based pagination.\n\n### UGS CLI\n\nYou an also list modules through the UGS CLI with the\n[list modules command].\n\n[list modules command]: /guides/ugs-cli/latest/cloud-code/Cloud%20Code%20Command%20Line/Commands/Modules/list\n",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.modules.list"
            ]
          }
        ],
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "in": "query",
            "name": "limit",
            "description": "The number of modules to return."
          },
          {
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9-_]+$"
            },
            "in": "query",
            "name": "after",
            "description": "Page token"
          }
        ],
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl -X GET \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          },
          {
            "lang": "bash",
            "label": "curl (with limit)",
            "source": "curl -X GET \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  https://services.api.unity.com/<ENDPOINT>?limit=<N>\n"
          },
          {
            "lang": "bash",
            "label": "curl (with next page token)",
            "source": "curl -X GET \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  https://services.api.unity.com/<ENDPOINT>?after=<TOKEN>\n"
          },
          {
            "lang": "bash",
            "label": "UGS CLI",
            "source": "ugs cloud-code modules list"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListModulesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ListModulesBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/ListModulesInternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      },
      "post": {
        "tags": [
          "Cloud Code modules"
        ],
        "summary": "Create module",
        "operationId": "createModule",
        "description": "Create Cloud Code module metadata and assemblies within a project\nenvironment.\n\nCreating, updating, or deleting a module is not instant as changes roll\nout gradually. This ensures that there are never any periods of downtime\nin which Cloud Code is not available to serve requests.\n\n### Size limits\n\n* A module cannot exceed the size of 10 MB.\n* The combined size of all modules in your project cannot exceed 128 MB.\n* You can't have more than 20 modules across all your environments.\n\nExceeding the individual module size limit results in a HTTP response\nwith error code `429`. Exceeding the total number or size limits\nacross all environments in your project result to a response with code\n`507`.\n\n### UGS CLI\n\nYou can also create a module through the UGS CLI with the\n[deploy command].\n\n[deploy command]: /guides/ugs-cli/latest/general/base-commands/deploy\n",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.modules.create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/CreateModuleRequest"
              }
            }
          },
          "description": "Provide metadata and assemblies for module including name and code language."
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl -X POST \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  -F 'name=mymodule' \\\n  -F 'language=CS' \\\n  -F 'file=@mymodule.ccm' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          },
          {
            "lang": "bash",
            "label": "curl (with tags)",
            "source": "curl -X POST \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  -F 'name=mymodule' \\\n  -F 'language=CS' \\\n  -F 'tags={\"foo\": \"bar\", \"baz\": \"qux\"}' \\\n  -F 'file=@mymodule.ccm' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          },
          {
            "lang": "bash",
            "label": "UGS CLI",
            "source": "ugs deploy mymodule.ccm"
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateModuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/CreateModuleBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/ModulePayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/CreateModuleInternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          },
          "507": {
            "$ref": "#/components/responses/CreateModuleInsufficientStorage"
          }
        }
      }
    },
    "/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules/{moduleName}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ProjectId"
        },
        {
          "$ref": "#/components/parameters/EnvironmentId"
        },
        {
          "$ref": "#/components/parameters/ModuleName"
        }
      ],
      "get": {
        "summary": "Get module",
        "tags": [
          "Cloud Code modules"
        ],
        "operationId": "getModule",
        "description": "Get useful information about a Cloud Code module within a project\nenvironment. This information does not include the compiled module\npackage last uploaded when creating or updating a module.\n\n### UGS CLI\n\nYou can also get information about a module through the UGS CLI with the\n[get module command].\n\n[get module command]: /guides/ugs-cli/latest/cloud-code/Cloud%20Code%20Command%20Line/Commands/Modules/get\n",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.modules.get"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl -X GET \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          },
          {
            "lang": "bash",
            "label": "UGS CLI",
            "source": "ugs cloud-code modules get <MODULE_NAME>"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetModuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/GetModuleBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/ModuleNotFoundError"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      },
      "delete": {
        "summary": "Delete module",
        "tags": [
          "Cloud Code modules"
        ],
        "operationId": "deleteModule",
        "description": "Delete a Cloud Code module within a project environment.\n\nCreating, updating, or deleting a module is not instant as changes roll\nout gradually. This ensures that there are never any periods of downtime\nin which Cloud Code is not available to serve requests.\n\n### UGS CLI\n\nYou can also delete a module through the UGS CLI with the\n[delete module command].\n\n[delete module command]: /guides/ugs-cli/latest/cloud-code/Cloud%20Code%20Command%20Line/Commands/Modules/delete\n",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.modules.delete"
            ]
          }
        ],
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl -X DELETE \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          },
          {
            "lang": "bash",
            "label": "UGS CLI",
            "source": "ugs cloud-code modules delete <MODULE-NAME>"
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "$ref": "#/components/responses/DeleteModuleBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      },
      "patch": {
        "tags": [
          "Cloud Code modules"
        ],
        "summary": "Update module",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.modules.update"
            ]
          }
        ],
        "operationId": "updateModule",
        "description": "Change Cloud Code module metadata and assemblies within a project\nenvironment.\n\nCreating, updating, or deleting a module is not instant as changes roll\nout gradually. This ensures that there are never any periods of downtime\nin which Cloud Code is not available to serve requests.\n\n### Size limits\n\n* A module cannot exceed the size of 10 MB.\n* The combined size of all modules in your project cannot exceed 128 MB.\n\nExceeding the individual module size limit results in a HTTP response\nwith error code `429`. Exceeding the total number limit across all\nenvironments in your project result to a response with code `507`.\n\n### UGS CLI\n\nYou can also update a module through the UGS CLI with the\n[deploy command].\n\n[deploy command]: /guides/ugs-cli/latest/general/base-commands/deploy\n",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/UpdateModuleRequest"
              }
            }
          },
          "description": "Update Cloud Code module metadata or assemblies within a project\nenvironment. The HTTP request must include either the assemblies or\nthe metadata. Sending a request without specifying anything results\nin an error response with code `400`.\n"
        },
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl (file)",
            "source": "curl -X PATCH \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  -F 'file=@mymodule.ccm' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          },
          {
            "lang": "bash",
            "label": "curl (tags)",
            "source": "curl -X PATCH \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  -F 'tags={\"foo\": \"bar\", \"baz\": \"qux\"}' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          },
          {
            "lang": "bash",
            "label": "curl (both)",
            "source": "curl -X PATCH \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  -F 'tags={\"foo\": \"bar\", \"baz\": \"qux\"}' \\\n  -F 'file=@mymodule.ccm' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          },
          {
            "lang": "bash",
            "label": "UGS CLI",
            "source": "ugs deploy mymodule.ccm"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateModuleResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/UpdateModuleBadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/ModulePayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/UpdateModuleInternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          },
          "507": {
            "$ref": "#/components/responses/UpdateModuleInsufficientStorage"
          }
        }
      }
    },
    "/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules/{moduleName}/spec": {
      "parameters": [
        {
          "$ref": "#/components/parameters/ProjectId"
        },
        {
          "$ref": "#/components/parameters/EnvironmentId"
        },
        {
          "$ref": "#/components/parameters/ModuleName"
        }
      ],
      "get": {
        "tags": [
          "Cloud Code modules"
        ],
        "x-codeSamples": [
          {
            "lang": "bash",
            "label": "curl",
            "source": "curl -X GET \\\n  -H 'Authorization: Basic <ACCESS_TOKEN>' \\\n  https://services.api.unity.com/<ENDPOINT>\n"
          }
        ],
        "summary": "Get module spec",
        "operationId": "getApiSpec",
        "description": "Get the OpenAPI specification for a given Cloud Code module\n",
        "security": [
          {
            "ServiceAccount": [
              "cloud_code.modules.get"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "Content-Type": {
                "schema": {
                  "type": "string",
                  "example": "application/yaml"
                }
              },
              "content-disposition": {
                "schema": {
                  "type": "string",
                  "description": "The filename of the attached spec file",
                  "example": "attachment; filename=\"spec.yaml\""
                }
              }
            },
            "content": {
              "application/yaml": {
                "example": "openapi: 3.0.1\ninfo:\n  title: ApiSpecExample OpenApi Specification\n  version: 1.0.0\nservers:\n  - url: https://cloud-code.services.api.unity.com/v1/projects/ApiSpecExample/modules/ApiSpecExample\npaths:\n  /HelloWorld:\n    post:\n      description: HelloWorld POST\n      requestBody:\n        content:\n          application/json:\n            schema:\n              type: object\n              properties:\n                params:\n                  type: object\n                  properties:\n                    name:\n                      type: string\n      responses:\n        '200':\n          description: OK\n          content:\n            application/json:\n              schema:\n                properties:\n                  output:\n                    type: string\n  /SendItem:\n    post:\n      description: SendItem POST\n      requestBody:\n        content:\n          application/json:\n            schema:\n              type: object\n              properties:\n                params:\n                  type: object\n                  properties:\n                    item:\n                      $ref: '#/components/schemas/ApiSpecGenerationTest.Item'\n                    playerId:\n                      type: string\n      responses:\n        '200':\n          description: OK\n          content:\n            application/json:\n              schema:\n                properties:\n                  output:\n                    type: object\n                    additionalProperties: false\n  /GenerateLoot:\n    post:\n      description: GenerateLoot POST\n      requestBody:\n        content:\n          application/json:\n            schema:\n              type: object\n              properties:\n                params:\n                  type: object\n                  properties:\n                    level:\n                      type: integer\n                      format: int32\n      responses:\n        '200':\n          description: OK\n          content:\n            application/json:\n              schema:\n                properties:\n                  output:\n                    type: array\n                    items:\n                      $ref: '#/components/schemas/ApiSpecGenerationTest.Item'\ncomponents:\n  schemas:\n    ApiSpecGenerationTest.Item:\n      properties:\n        Name:\n          type: string\n        OwnerId:\n          type: string\n        Attributes:\n          type: object\n          additionalProperties:\n            type: integer\n            format: int32\n  securitySchemes:\n    BearerAuth:\n      type: http\n      scheme: bearer\nsecurity:\n  - { }",
                "schema": {
                  "$ref": "#/components/schemas/ModuleSpecResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          },
          "504": {
            "$ref": "#/components/responses/GatewayTimeout"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "ProjectId": {
        "name": "projectId",
        "in": "path",
        "description": "ID of the project.",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "8bdacc33-6eef-4577-beb0-633c86259f5b"
      },
      "EnvironmentId": {
        "name": "environmentId",
        "in": "path",
        "description": "ID of the environment",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "5v3fb205-d8a2-920f-8013-8c0e814777b3"
      },
      "ScriptName": {
        "name": "scriptName",
        "in": "path",
        "description": "Name of the script.",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/ScriptName"
        }
      },
      "ModuleName": {
        "name": "moduleName",
        "in": "path",
        "description": "Name of a Cloud Code module.",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/ModuleName"
        }
      }
    },
    "schemas": {
      "ScriptName": {
        "title": "Script name",
        "type": "string",
        "pattern": "^[a-zA-Z0-9-_]+$",
        "minLength": 1,
        "maxLength": 50,
        "description": "Name of the script. Serves as a unique identifier."
      },
      "ScriptParameterName": {
        "title": "Script parameter name",
        "type": "string",
        "pattern": "^[a-zA-Z0-9-_]+$",
        "minLength": 1,
        "maxLength": 50,
        "description": "Name of the script parameter."
      },
      "ScriptParameter": {
        "title": "Script parameter",
        "type": "object",
        "description": "Defines a parameter for a script.",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/ScriptParameterName"
          },
          "type": {
            "type": "string",
            "description": "The type of the parameter.",
            "enum": [
              "STRING",
              "BOOLEAN",
              "NUMERIC",
              "JSON",
              "ANY"
            ],
            "default": "ANY"
          },
          "required": {
            "type": "boolean",
            "description": "A flag indicating if the parameter is required when running a Script."
          }
        },
        "required": [
          "name"
        ]
      },
      "ScriptParameterList": {
        "title": "Script parameter list",
        "type": "array",
        "uniqueItems": true,
        "description": "The list of parameters which can be defined for a script.",
        "maxItems": 10,
        "minItems": 0,
        "items": {
          "$ref": "#/components/schemas/ScriptParameter"
        }
      },
      "Code": {
        "title": "Code",
        "type": "string",
        "description": "The script code to be executed",
        "maxLength": 131072
      },
      "Date": {
        "title": "Date",
        "type": "string",
        "format": "date-time",
        "description": "RFC3339 date representation",
        "example": "2022-04-05T09:12:13Z"
      },
      "ModuleEndpoints": {
        "title": "Endpoints",
        "type": "object",
        "description": "A list of endpoints that are available in the module.\n",
        "example": {
          "endpoint1": {
            "parameters": {
              "name": "System.String",
              "age": "System.Int32"
            },
            "returnType": "System.String"
          },
          "endpoint2": {
            "parameters": {
              "name": "System.String",
              "age": "System.Int32"
            },
            "returnType": "System.String"
          }
        },
        "additionalProperties": {
          "type": "object",
          "properties": {
            "parameters": {
              "type": "object",
              "description": "endpoints parameters and their types",
              "example": {
                "name": "System.String",
                "age": "System.Int32"
              }
            },
            "returnType": {
              "type": "string",
              "description": "The return type of the endpoint"
            }
          }
        }
      },
      "ScriptType": {
        "title": "Script type",
        "type": "string",
        "description": "The type of the script."
      },
      "Language": {
        "type": "string",
        "description": "The language of the script.",
        "default": "JS",
        "enum": [
          "JS"
        ]
      },
      "SignedDownloadURL": {
        "title": "Signed download URL",
        "type": "string",
        "description": "Signed URL for time-limited access to the binary contents of the module."
      },
      "ModuleLanguage": {
        "title": "Module language",
        "description": "The language of a Cloud Code module. Currently, only `CS` (C#) is\nsupported.\n",
        "type": "string",
        "default": "CS",
        "enum": [
          "CS"
        ]
      },
      "ModuleName": {
        "title": "Module name",
        "type": "string",
        "pattern": "^[a-zA-Z0-9_]+$",
        "minLength": 1,
        "maxLength": 50,
        "description": "Name of a Cloud Code module."
      },
      "CustomTags": {
        "title": "Custom tags",
        "type": "object",
        "description": "A set of user-defined tags in the form of string key-value pairs.\n\nUse these if you need to add additional metadata related to the module.\n\nFor example, if you want to automate deployment of modules with some\nsynchronization mechanism, you can use user-defined tags for marking\nversion or ownership to avoid conflicts.\n",
        "maxProperties": 10,
        "additionalProperties": {
          "type": "string",
          "description": "User-defined tag.",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "RequestId": {
        "title": "Request ID",
        "description": "An identifier Unity uses internally to investigate what happened to\na particular request that went through the gateway.\n",
        "type": "string",
        "pattern": "^\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$",
        "example": "6203fac6-6579-4a71-a659-e20655580408"
      },
      "CreateScriptRequest": {
        "title": "Create script request",
        "type": "object",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/ScriptName"
          },
          "type": {
            "$ref": "#/components/schemas/ScriptType"
          },
          "params": {
            "$ref": "#/components/schemas/ScriptParameterList"
          },
          "code": {
            "$ref": "#/components/schemas/Code"
          },
          "language": {
            "$ref": "#/components/schemas/Language"
          }
        },
        "required": [
          "name",
          "type"
        ]
      },
      "UpdateScriptRequest": {
        "title": "Update script request",
        "type": "object",
        "properties": {
          "params": {
            "$ref": "#/components/schemas/ScriptParameterList"
          },
          "code": {
            "$ref": "#/components/schemas/Code"
          }
        }
      },
      "ListScriptsResponse": {
        "title": "List scripts response",
        "type": "object",
        "properties": {
          "results": {
            "title": "Scripts list",
            "type": "array",
            "description": "List of metadata about scripts",
            "uniqueItems": true,
            "items": {
              "title": "Script metadata",
              "type": "object",
              "description": "Script metadata",
              "properties": {
                "name": {
                  "$ref": "#/components/schemas/ScriptName"
                },
                "type": {
                  "$ref": "#/components/schemas/ScriptType"
                },
                "language": {
                  "$ref": "#/components/schemas/Language"
                },
                "published": {
                  "description": "A flag indicating if the script is published",
                  "type": "boolean"
                },
                "lastPublishedDate": {
                  "nullable": true,
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Date"
                    }
                  ]
                },
                "lastPublishedVersion": {
                  "type": "integer",
                  "nullable": true
                }
              },
              "required": [
                "name",
                "type",
                "language",
                "published",
                "lastPublishedDate",
                "lastPublishedVersion"
              ]
            }
          },
          "links": {
            "type": "object",
            "required": [
              "next"
            ],
            "properties": {
              "next": {
                "type": "string",
                "nullable": true
              }
            }
          }
        },
        "required": [
          "results",
          "links"
        ]
      },
      "GetScriptResponse": {
        "title": "Get script response",
        "type": "object",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/ScriptName"
          },
          "type": {
            "$ref": "#/components/schemas/ScriptType"
          },
          "language": {
            "$ref": "#/components/schemas/Language"
          },
          "activeScript": {
            "type": "object",
            "description": "Information about the currently active version of the script.",
            "required": [
              "code",
              "version",
              "datePublished",
              "params"
            ],
            "nullable": true,
            "properties": {
              "code": {
                "$ref": "#/components/schemas/Code"
              },
              "version": {
                "type": "integer",
                "description": "The version id of the active version of the script"
              },
              "datePublished": {
                "$ref": "#/components/schemas/Date"
              },
              "params": {
                "$ref": "#/components/schemas/ScriptParameterList"
              }
            }
          },
          "versions": {
            "type": "array",
            "description": "A list of versions of the script.",
            "uniqueItems": true,
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "$ref": "#/components/schemas/Code"
                },
                "version": {
                  "type": "integer",
                  "description": "The version number",
                  "nullable": true
                },
                "isDraft": {
                  "type": "boolean",
                  "description": "A flag indicating if the version is a working copy"
                },
                "dateUpdated": {
                  "$ref": "#/components/schemas/Date"
                },
                "dateCreated": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Date"
                    }
                  ],
                  "description": "DateCreated is required only if the version is not the current working copy."
                },
                "params": {
                  "$ref": "#/components/schemas/ScriptParameterList"
                }
              },
              "required": [
                "code",
                "version",
                "isDraft",
                "dateUpdated",
                "params"
              ]
            }
          },
          "params": {
            "$ref": "#/components/schemas/ScriptParameterList"
          }
        },
        "required": [
          "name",
          "type",
          "language",
          "activeScript",
          "versions"
        ],
        "example": {
          "name": "test-3",
          "type": "API",
          "language": "JS",
          "activeScript": {
            "code": "module.exports=async (cloudCode) =>{cloudCode.logger.info('this message confirms that the logging client is functional!'); return cloudCode.params.someThing;}",
            "params": [
              {
                "name": "someThing",
                "type": "STRING",
                "required": true
              }
            ],
            "version": 2,
            "datePublished": "2021-07-23T16:08:35Z"
          },
          "versions": [
            {
              "code": "module.exports=async (cloudCode) =>{cloudCode.logger.info('this message confirms that the logging client is functional!'); return cloudCode.params.someThing;}",
              "params": [
                {
                  "name": "someThing",
                  "type": "STRING",
                  "required": true
                }
              ],
              "isDraft": true,
              "version": null,
              "dateUpdated": "2021-07-23T15:59:32Z"
            },
            {
              "code": "module.exports=async (cloudCode) =>{cloudCode.logger.info('this message confirms that the logging client is functional!'); return cloudCode.params.someThing;}",
              "params": [
                {
                  "name": "someThing",
                  "type": "STRING",
                  "required": true
                }
              ],
              "isDraft": false,
              "version": 2,
              "dateUpdated": "2021-07-23T16:08:35Z",
              "dateCreated": "2021-07-23T16:08:35Z"
            },
            {
              "code": "module.exports=async (cloudCode) =>{cloudCode.logger.info('this message confirms that the logging client is functional!'); return cloudCode.params.someThing;}",
              "params": [
                {
                  "name": "someThing",
                  "type": "STRING",
                  "required": true
                }
              ],
              "isDraft": false,
              "version": 1,
              "dateUpdated": "2021-07-23T15:59:58Z",
              "dateCreated": "2021-07-23T15:59:58Z"
            }
          ],
          "params": [
            {
              "name": "someThing",
              "type": "STRING",
              "required": true
            }
          ]
        }
      },
      "PublishScriptRequest": {
        "title": "Publish script request",
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "description": "Version number to be published."
          }
        }
      },
      "PublishScriptResponse": {
        "title": "Publish script response",
        "type": "object",
        "properties": {
          "version": {
            "type": "integer",
            "minimum": 1,
            "description": "The version number of the newly published script version"
          },
          "datePublished": {
            "$ref": "#/components/schemas/Date"
          }
        },
        "required": [
          "version",
          "datePublished"
        ]
      },
      "ListModulesResponse": {
        "title": "List modules response",
        "type": "object",
        "properties": {
          "results": {
            "title": "Modules list",
            "type": "array",
            "description": "List of module metadata",
            "uniqueItems": true,
            "items": {
              "title": "Module metadata",
              "type": "object",
              "description": "Module metadata",
              "properties": {
                "name": {
                  "$ref": "#/components/schemas/ModuleName"
                },
                "language": {
                  "$ref": "#/components/schemas/ModuleLanguage"
                },
                "tags": {
                  "$ref": "#/components/schemas/CustomTags"
                },
                "signedDownloadURL": {
                  "$ref": "#/components/schemas/SignedDownloadURL"
                },
                "dateCreated": {
                  "$ref": "#/components/schemas/Date"
                },
                "dateModified": {
                  "$ref": "#/components/schemas/Date"
                }
              },
              "required": [
                "name",
                "language",
                "signedDownloadURL",
                "dateCreated",
                "dateModified"
              ]
            }
          },
          "links": {
            "type": "object",
            "required": [
              "next"
            ],
            "properties": {
              "next": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "nextPageToken": {
            "type": "string"
          }
        },
        "required": [
          "results",
          "links",
          "nextPageToken"
        ]
      },
      "GetModuleResponse": {
        "title": "Get module response",
        "type": "object",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/ModuleName"
          },
          "language": {
            "$ref": "#/components/schemas/ModuleLanguage"
          },
          "tags": {
            "$ref": "#/components/schemas/CustomTags"
          },
          "signedDownloadURL": {
            "$ref": "#/components/schemas/SignedDownloadURL"
          },
          "dateCreated": {
            "$ref": "#/components/schemas/Date"
          },
          "dateModified": {
            "$ref": "#/components/schemas/Date"
          },
          "endpoints": {
            "$ref": "#/components/schemas/ModuleEndpoints"
          },
          "hasError": {
            "type": "boolean",
            "description": "A flag indicating if the module has an error"
          },
          "errorMessage": {
            "type": "string",
            "nullable": true,
            "description": "The error message if the module has an error"
          }
        },
        "required": [
          "name",
          "language",
          "signedDownloadURL",
          "dateCreated",
          "dateModified"
        ]
      },
      "ModuleAssemblies": {
        "title": "Module assemblies",
        "description": "ZIP archive file containing the module assemblies packaged for the\nlinux-x64 runtime in ReadyToRun (R2R) format. For further detail,\nsee [Manual packaging].\n\n[Manual packaging]: https://docs.unity.com/cloud-code/manual/modules/manual-packaging\n",
        "type": "string",
        "format": "binary"
      },
      "CreateModuleRequest": {
        "title": "Create module request",
        "type": "object",
        "properties": {
          "name": {
            "$ref": "#/components/schemas/ModuleName"
          },
          "language": {
            "$ref": "#/components/schemas/ModuleLanguage"
          },
          "tags": {
            "$ref": "#/components/schemas/CustomTags"
          },
          "file": {
            "$ref": "#/components/schemas/ModuleAssemblies"
          }
        },
        "required": [
          "name",
          "language",
          "file"
        ]
      },
      "UpdateModuleRequest": {
        "title": "Update module request",
        "type": "object",
        "properties": {
          "tags": {
            "$ref": "#/components/schemas/CustomTags"
          },
          "file": {
            "$ref": "#/components/schemas/ModuleAssemblies"
          }
        }
      },
      "CreateModuleResponse": {
        "title": "Create module response",
        "type": "object",
        "properties": {
          "dateCreated": {
            "$ref": "#/components/schemas/Date"
          }
        }
      },
      "UpdateModuleResponse": {
        "title": "Update module response",
        "type": "object",
        "properties": {
          "dateModified": {
            "$ref": "#/components/schemas/Date"
          }
        }
      },
      "ModuleSpecResponse": {
        "description": "A yaml file containing the OpenAPI specification for a given Cloud Code module.      \n",
        "type": "string",
        "format": "binary"
      },
      "BasicErrorResponse": {
        "title": "Basic error response",
        "description": "Referenced from - https://tools.ietf.org/html/rfc7807#page-3",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "A URI reference [RFC3986] that identifies the problem type. This\nspecification encourages that, when dereferenced, it provide\nhuman-readable documentation for the problem type (e.g., using HTML\n[W3C.REC-html5-20141028]). When this member is not present, its\nvalue is assumed to be \"about:blank\".\n\n[RFC3986]: https://www.rfc-editor.org/rfc/rfc3986\n[W3C.REC-html5-20141028]: https://www.rfc-editor.org/rfc/rfc7807#ref-W3C.REC-html5-20141028\n"
          },
          "title": {
            "type": "string",
            "description": "A short, human-readable summary of the problem type. It SHOULD NOT\nchange from occurrence to occurrence of the problem, except for\npurposes of localization (e.g., using proactive content negotiation;\nsee [RFC7231, Section 3.4]).\n\n[RFC7231, Section 3.4]: https://www.rfc-editor.org/rfc/rfc7231#section-3.4\n"
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status code ([RFC7231, Section 6]) generated by the origin\nserver for this occurrence of the problem.\n\n[RFC7231, Section 6]: https://www.rfc-editor.org/rfc/rfc7231#section-6\n"
          },
          "requestId": {
            "$ref": "#/components/schemas/RequestId"
          },
          "code": {
            "description": "Service specific error code",
            "type": "integer"
          },
          "detail": {
            "type": "string",
            "description": "A human-readable explanation specific to this occurrence of the problem."
          },
          "instance": {
            "type": "string",
            "nullable": true,
            "description": "A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced."
          },
          "details": {
            "type": "array",
            "description": "Machine readable service specific errors.",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "CompilationErrorResponse": {
        "title": "Compilation error response",
        "description": "A compilation error from the execution backend. Describes the error and provides a stack trace. Can be caused by invalid syntax or invalid imports.",
        "type": "object",
        "example": {
          "type": "problems/compilation",
          "title": "Bad Request",
          "status": 400,
          "code": 9006,
          "detail": "Compilation Error",
          "details": [
            {
              "name": "SyntaxError",
              "message": "Missing initializer in const declaration",
              "stackTrace": [
                "gift_keys.js:1:6",
                "const foo; module.exports = async ({params, context, logger}) => {logger.info('test-log'); ",
                "      ^^^"
              ]
            }
          ]
        },
        "properties": {
          "type": {
            "type": "string",
            "default": "problems/compilation"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "integer"
          },
          "detail": {
            "type": "string",
            "default": "Compilation Error"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "message",
                "stackTrace"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1
                },
                "message": {
                  "type": "string",
                  "minLength": 1
                },
                "stackTrace": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code",
          "detail",
          "details"
        ]
      },
      "ValidationErrorResponse": {
        "title": "Validation error response",
        "type": "object",
        "description": "Validation error response when a value provided from the client does not pass validation on server.",
        "example": {
          "type": "problems/validation",
          "title": "Validation error",
          "status": 400,
          "code": 1004,
          "detail": "See 'errors' for specific validation errors",
          "instance": null,
          "errors": [
            {
              "field": "name",
              "messages": [
                "validation error message"
              ]
            }
          ]
        },
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "code": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string",
            "nullable": true
          },
          "errors": {
            "type": "array",
            "description": "List of errors with details.",
            "items": {
              "$ref": "#/components/schemas/ValidationErrorBody"
            }
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code",
          "detail",
          "errors"
        ]
      },
      "ValidationErrorBody": {
        "title": "ValidationErrorBody",
        "description": "An error contained within Validation Error Response.",
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "description": "Name of the field for failed validation."
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Validation error message."
            }
          }
        },
        "required": [
          "field",
          "messages"
        ]
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request. Returned code indicates one of:\n- Request parameter validation failure\n- Compilation error when publishing\n- Other\nSee the errors field for more details.\n",
        "content": {
          "application/problem+json": {
            "schema": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/BasicErrorResponse"
                },
                {
                  "$ref": "#/components/schemas/ValidationErrorResponse"
                },
                {
                  "$ref": "#/components/schemas/CompilationErrorResponse"
                }
              ],
              "discriminator": {
                "propertyName": "type",
                "mapping": {
                  "problems/basic": "#/components/schemas/BasicErrorResponse",
                  "problems/validation": "#/components/schemas/ValidationErrorResponse",
                  "problems/compilation": "#/components/schemas/CompilationErrorResponse"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Invalid authentication token",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Gateway": {
                "$ref": "#/components/examples/GatewayUnauthorizedErrorResponse"
              },
              "Service": {
                "$ref": "#/components/examples/ServiceUnauthorizedErrorResponse"
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Not found",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Too many requests",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "number",
              "description": "q how many seconds the client should wait before making a\nfollow-up request.\n",
              "example": 90
            }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Too many requests": {
                "$ref": "#/components/examples/GatewayTooManyRequestsErrorResponse"
              },
              "Quota exceeded": {
                "$ref": "#/components/examples/GatewayQuotaExceededErrorResponse"
              },
              "Rate limit exceeded": {
                "$ref": "#/components/examples/GatewayRatelimitExceededErrorResponse"
              }
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal server error",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "example": {
              "$ref": "#/components/examples/GatewayInternalServerErrorResponse/value"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "Service unavailable",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            }
          }
        }
      },
      "GatewayTimeout": {
        "description": "Gateway timeout",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            }
          }
        }
      },
      "ModuleNotFoundError": {
        "description": "The Cloud Code module could not be found",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            }
          }
        }
      },
      "ModulePayloadTooLarge": {
        "description": "Payload too large",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            }
          }
        }
      },
      "ListModulesBadRequest": {
        "description": "Bad request",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Invalid page token": {
                "$ref": "#/components/examples/ModulePageTokenInvalidErrorResponse"
              },
              "Unspecified": {
                "$ref": "#/components/examples/UnspecifiedBadRequestErrorResponse"
              },
              "Validation": {
                "$ref": "#/components/examples/ValidationErrorResponse"
              }
            }
          }
        }
      },
      "ListModulesInternalServerError": {
        "description": "Internal server error",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Unknown": {
                "$ref": "#/components/examples/UnknownErrorResponse"
              },
              "Other": {
                "$ref": "#/components/examples/GatewayInternalServerErrorResponse"
              }
            }
          }
        }
      },
      "CreateModuleBadRequest": {
        "description": "Bad request",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "No file attached": {
                "$ref": "#/components/examples/NoFileAttachedErrorResponse"
              },
              "Module name exists": {
                "$ref": "#/components/examples/ModuleNameExistsErrorResponse"
              },
              "JSON decode error": {
                "$ref": "#/components/examples/JsonDecodeRequestErrorResponse"
              },
              "Module name missing": {
                "$ref": "#/components/examples/ModuleNameMissingErrorResponse"
              },
              "Other": {
                "$ref": "#/components/examples/UnspecifiedBadRequestErrorResponse"
              },
              "Validation": {
                "$ref": "#/components/examples/ValidationErrorResponse"
              }
            }
          }
        }
      },
      "CreateModuleInternalServerError": {
        "description": "Internal server error",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Rollout restart": {
                "$ref": "#/components/examples/RolloutRestartErrorResponse"
              },
              "Unknown": {
                "$ref": "#/components/examples/UnknownErrorResponse"
              },
              "Other": {
                "$ref": "#/components/examples/GatewayInternalServerErrorResponse"
              }
            }
          }
        }
      },
      "CreateModuleInsufficientStorage": {
        "description": "Insufficient storage",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Number": {
                "$ref": "#/components/examples/TooManyModulesErrorResponse"
              },
              "Size": {
                "$ref": "#/components/examples/ModulesSizeLimitExceededErrorResponse"
              }
            }
          }
        }
      },
      "GetModuleBadRequest": {
        "description": "Bad request",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Module name missing": {
                "$ref": "#/components/examples/ModuleNameMissingErrorResponse"
              },
              "Other": {
                "$ref": "#/components/examples/UnspecifiedBadRequestErrorResponse"
              }
            }
          }
        }
      },
      "DeleteModuleBadRequest": {
        "description": "Bad request",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Module name missing": {
                "$ref": "#/components/examples/ModuleNameMissingErrorResponse"
              },
              "Other": {
                "$ref": "#/components/examples/UnspecifiedBadRequestErrorResponse"
              }
            }
          }
        }
      },
      "UpdateModuleBadRequest": {
        "description": "Bad request",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "JSON decode error": {
                "$ref": "#/components/examples/JsonDecodeRequestErrorResponse"
              },
              "Module name missing": {
                "$ref": "#/components/examples/ModuleNameMissingErrorResponse"
              },
              "Other": {
                "$ref": "#/components/examples/UnspecifiedBadRequestErrorResponse"
              },
              "Validation": {
                "$ref": "#/components/examples/ValidationErrorResponse"
              }
            }
          }
        }
      },
      "UpdateModuleInsufficientStorage": {
        "description": "Insufficient storage",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "example": {
              "$ref": "#/components/examples/ModulesSizeLimitExceededErrorResponse/value"
            }
          }
        }
      },
      "UpdateModuleInternalServerError": {
        "description": "Internal server error",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/BasicErrorResponse"
            },
            "examples": {
              "Rollout restart": {
                "$ref": "#/components/examples/RolloutRestartErrorResponse"
              },
              "Unknown": {
                "$ref": "#/components/examples/UnknownErrorResponse"
              },
              "Other": {
                "$ref": "#/components/examples/GatewayInternalServerErrorResponse"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "ServiceAccount": {
        "type": "http",
        "scheme": "basic",
        "description": "To get started with authentication, see\n[Service Account Authentication].\n\nFor this API, you must add one or more Cloud Code roles with the\nrelevant permissions. To see what roles you need based on their\npermissions, see section **Live Ops** in [Available roles] from\nService Account Authentication.\n\n[Service Account Authentication]: /docs/service-account-auth\n[Available roles]: /docs/service-account-auth#available-roles"
      }
    },
    "examples": {
      "GatewayUnauthorizedErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 401,
          "title": "Unauthorized",
          "requestId": "6203fac6-6579-4a71-a659-e20655580408",
          "detail": "Authentication Failed"
        }
      },
      "GatewayTooManyRequestsErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 429,
          "title": "Too Many Requests"
        }
      },
      "GatewayQuotaExceededErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 429,
          "title": "Quota Exceeded"
        }
      },
      "GatewayRatelimitExceededErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 429,
          "title": "Ratelimit Exceeded"
        }
      },
      "GatewayInternalServerErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 500,
          "title": "Internal Server Error"
        }
      },
      "JsonDecodeRequestErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 400,
          "title": "Bad Request",
          "detail": "Could not decode request body as JSON",
          "code": 1002
        }
      },
      "UnspecifiedBadRequestErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 400,
          "title": "Bad Request",
          "detail": "Bad request",
          "code": 1003
        }
      },
      "NoFileAttachedErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 400,
          "title": "Error",
          "detail": "no file attached",
          "instance": null,
          "code": 1003
        }
      },
      "ModuleNameMissingErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 400,
          "title": "Bad Request",
          "detail": "module name is missing",
          "code": 1003
        }
      },
      "ValidationErrorResponse": {
        "value": {
          "type": "problems/validation",
          "title": "Validation error",
          "status": 400,
          "code": 1004,
          "detail": "See 'errors' for specific validation errors",
          "instance": null,
          "errors": [
            {
              "field": "name",
              "messages": [
                "validation error message"
              ]
            }
          ]
        }
      },
      "ServiceUnauthorizedErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 401,
          "title": "Unauthorized",
          "detail": "Unauthorized",
          "code": 1005
        }
      },
      "UnknownErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 500,
          "title": "Internal Server Error",
          "detail": "An unknown server error occurred",
          "code": 9001
        }
      },
      "ModuleNameExistsErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 400,
          "title": "Bad Request",
          "detail": "Module name is already in use",
          "code": 9019
        }
      },
      "RolloutRestartErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 500,
          "title": "Internal Server Error",
          "detail": "An error occurred while restarting invokers",
          "code": 9021
        }
      },
      "ModulePageTokenInvalidErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 500,
          "title": "Bad Request",
          "detail": "Page token is invalid",
          "code": 9022
        }
      },
      "TooManyModulesErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 507,
          "title": "Insufficient Storage",
          "detail": "Exceeded modules number limit of 20 across all environments",
          "code": 9023
        }
      },
      "ModulesSizeLimitExceededErrorResponse": {
        "value": {
          "type": "problems/basic",
          "status": 507,
          "title": "Insufficient Storage",
          "detail": "Exceeded modules total size limit of 128 MiB across all environments",
          "code": 9024
        }
      }
    }
  }
}
````