Documentation

​
​

Development

User Acquisition

Monetization

Industry

Cloud Code Admin API

v1

Supported
​

Cloud Code Admin API

v1

Supported
​

Unity Services Web APIs
​
​
Cloud Code Admin API
  • Overview
  • Rate limits
  • Useful links
Endpoints
  • Cloud Code modules
  • Cloud Code scripts

Cloud Code Admin API

Overview

This is the API specification for the Unity Cloud Code Admin service that enables game developers to create and edit server-side code for their games.

Rate limits

The 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.
The API responds with a
429
HTTP status code if the rate limit is exceeded.
The API also responds with a
Retry-After
header to use in conjunction with a client's retry logic. The value is the number of seconds until the API accepts a request for the given project and IP.

Useful links

  • Cloud Code
Download OpenAPI specification:

List scripts


Get a list of the Cloud Code scripts for a project environment
Authorizations
ServiceAccount (cloud_code.scripts.list)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.scripts.list

Path parameters for "List scripts"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

Query parameters for "List scripts"

limit

integer
The number of scripts to return.

after

string
No description

HTTP response status codes for "List scripts":

Code samples for "List scripts":

Request example

curl -X GET \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts"

Response example

{ "results": [ { "name": "string", "type": "string", "language": "JS", "published": true, "lastPublishedDate": "2022-04-05T09:12:13Z", "lastPublishedVersion": 0 } ], "links": { "next": "string" }}

Create script


Create a Cloud Code script for a project environment
Authorizations
ServiceAccount (cloud_code.scripts.create)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.scripts.create

Path parameters for "Create script"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

Request body for "Create script"

Media Type:
application/json

name

string
required
Name of the script. Serves as a unique identifier.

type

string
required
The type of the script.

params

array[object]
The list of parameters which can be defined for a script.

name

string
required
Name of the script parameter.

type

string
The type of the parameter.

required

boolean
A flag indicating if the parameter is required when running a Script.

code

string
The script code to be executed

language

string
The language of the script.

HTTP response status codes for "Create script":

Code samples for "Create script":

Request example

curl -X POST \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "type": "string", "params": [], "code": "string", "language": "JS"}' \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts"

Response example

{ "type": "string", "title": "string", "status": 0, "requestId": "6203fac6-6579-4a71-a659-e20655580408", "code": 0, "detail": "string", "instance": "string", "details": [ {} ]}

Get script


Get a Cloud Code script for a project environment
Authorizations
ServiceAccount (cloud_code.scripts.get)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.scripts.get

Path parameters for "Get script"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

scriptName

required
Name of the script.

HTTP response status codes for "Get script":

Code samples for "Get script":

Request example

curl -X GET \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts/{scriptName}"

Response 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 } ]}

Update script


Update a Cloud Code script for a project environment
Authorizations
ServiceAccount (cloud_code.scripts.update)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.scripts.update

Path parameters for "Update script"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

scriptName

required
Name of the script.

Request body for "Update script"

Media Type:
application/json

params

array[object]
The list of parameters which can be defined for a script.

name

string
required
Name of the script parameter.

type

string
The type of the parameter.

required

boolean
A flag indicating if the parameter is required when running a Script.

code

string
The script code to be executed

HTTP response status codes for "Update script":

Code samples for "Update script":

Request example

curl -X PATCH \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Content-Type: application/json" \ -d '{ "params": [], "code": "string"}' \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts/{scriptName}"

Response example

{ "$ref": "#/components/examples/GatewayUnauthorizedErrorResponse"}

Delete script


Delete a Cloud Code script for a project environment.
Authorizations
ServiceAccount (cloud_code.scripts.delete)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.scripts.delete

Path parameters for "Delete script"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

scriptName

required
Name of the script.

HTTP response status codes for "Delete script":

Code samples for "Delete script":

Request example

curl -X DELETE \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts/{scriptName}"

Response example

{ "$ref": "#/components/examples/GatewayUnauthorizedErrorResponse"}

Publish script


Publish a Cloud Code script for a project environment. You can't republish the active script, or publish a script with compiliaton errors.
Authorizations
ServiceAccount (cloud_code.scripts.publish)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.scripts.publish

Path parameters for "Publish script"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

scriptName

required
Name of the script.

Request body for "Publish script"

Media Type:
application/json

version

integer
Version number to be published.

HTTP response status codes for "Publish script":

Code samples for "Publish script":

Request example

curl -X POST \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Content-Type: application/json" \ -d '{ "version": 0}' \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/scripts/{scriptName}/publish"

Response example

{ "version": 0, "datePublished": "2022-04-05T09:12:13Z"}

List modules


Get a list of Cloud Code modules within a project environment.
This endpoint supports token-based pagination.

UGS CLI

You an also list modules through the UGS CLI with the list modules command.
Authorizations
ServiceAccount (cloud_code.modules.list)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.modules.list

Path parameters for "List modules"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

Query parameters for "List modules"

limit

integer
The number of modules to return.

after

string
Page token

HTTP response status codes for "List modules":

Code samples for "List modules":

Request example

curl -X GET \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules"

Response example

{ "results": [ { "name": "string", "language": "CS", "tags": {}, "signedDownloadURL": "string", "dateCreated": "2022-04-05T09:12:13Z", "dateModified": "2022-04-05T09:12:13Z" } ], "links": { "next": "string" }, "nextPageToken": "string"}

Create module


Create Cloud Code module metadata and assemblies within a project environment.
Creating, updating, or deleting a module is not instant as changes roll out gradually. This ensures that there are never any periods of downtime in which Cloud Code is not available to serve requests.

Size limits

  • A module cannot exceed the size of 10 MB.
  • The combined size of all modules in your project cannot exceed 128 MB.
  • You can't have more than 20 modules across all your environments.
Exceeding the individual module size limit results in a HTTP response with error code
429
. Exceeding the total number or size limits across all environments in your project result to a response with code
507
.

UGS CLI

You can also create a module through the UGS CLI with the deploy command.
Authorizations
ServiceAccount (cloud_code.modules.create)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.modules.create

Path parameters for "Create module"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

Request body for "Create module"

Media Type:
multipart/form-data

name

string
required
Name of a Cloud Code module.

language

string
required
The language of a Cloud Code module. Currently, only
CS
(C#) is supported.

tags

object
A set of user-defined tags in the form of string key-value pairs.
Use these if you need to add additional metadata related to the module.
For example, if you want to automate deployment of modules with some synchronization mechanism, you can use user-defined tags for marking version or ownership to avoid conflicts.

file

string
required
ZIP archive file containing the module assemblies packaged for the linux-x64 runtime in ReadyToRun (R2R) format. For further detail, see Manual packaging.

HTTP response status codes for "Create module":

Code samples for "Create module":

Request example

curl -X POST \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Content-Type: multipart/form-data" \ -d '{"name":"string","language":"CS","tags":{},"file":"string"}' \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules"

Response example

{ "dateCreated": "2022-04-05T09:12:13Z"}

Get module


Get useful information about a Cloud Code module within a project environment. This information does not include the compiled module package last uploaded when creating or updating a module.

UGS CLI

You can also get information about a module through the UGS CLI with the get module command.
Authorizations
ServiceAccount (cloud_code.modules.get)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.modules.get

Path parameters for "Get module"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

moduleName

required
Name of a Cloud Code module.

HTTP response status codes for "Get module":

Code samples for "Get module":

Request example

curl -X GET \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules/{moduleName}"

Response example

{ "name": "string", "language": "CS", "tags": {}, "signedDownloadURL": "string", "dateCreated": "2022-04-05T09:12:13Z", "dateModified": "2022-04-05T09:12:13Z", "endpoints": { "endpoint1": { "parameters": { "name": "System.String", "age": "System.Int32" }, "returnType": "System.String" }, "endpoint2": { "parameters": { "name": "System.String", "age": "System.Int32" }, "returnType": "System.String" } }, "hasError": true, "errorMessage": "string"}

Delete module


Delete a Cloud Code module within a project environment.
Creating, updating, or deleting a module is not instant as changes roll out gradually. This ensures that there are never any periods of downtime in which Cloud Code is not available to serve requests.

UGS CLI

You can also delete a module through the UGS CLI with the delete module command.
Authorizations
ServiceAccount (cloud_code.modules.delete)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.modules.delete

Path parameters for "Delete module"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

moduleName

required
Name of a Cloud Code module.

HTTP response status codes for "Delete module":

Code samples for "Delete module":

Request example

curl -X DELETE \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules/{moduleName}"

Response example

{ "$ref": "#/components/examples/ModuleNameMissingErrorResponse"}

Update module


Change Cloud Code module metadata and assemblies within a project environment.
Creating, updating, or deleting a module is not instant as changes roll out gradually. This ensures that there are never any periods of downtime in which Cloud Code is not available to serve requests.

Size limits

  • A module cannot exceed the size of 10 MB.
  • The combined size of all modules in your project cannot exceed 128 MB.
Exceeding the individual module size limit results in a HTTP response with error code
429
. Exceeding the total number limit across all environments in your project result to a response with code
507
.

UGS CLI

You can also update a module through the UGS CLI with the deploy command.
Authorizations
ServiceAccount (cloud_code.modules.update)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.modules.update

Path parameters for "Update module"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

moduleName

required
Name of a Cloud Code module.

Request body for "Update module"

Media Type:
multipart/form-data

tags

object
A set of user-defined tags in the form of string key-value pairs.
Use these if you need to add additional metadata related to the module.
For example, if you want to automate deployment of modules with some synchronization mechanism, you can use user-defined tags for marking version or ownership to avoid conflicts.

file

string
ZIP archive file containing the module assemblies packaged for the linux-x64 runtime in ReadyToRun (R2R) format. For further detail, see Manual packaging.

HTTP response status codes for "Update module":

Code samples for "Update module":

Request example

curl -X PATCH \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ -H "Content-Type: multipart/form-data" \ -d '{"tags":{},"file":"string"}' \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules/{moduleName}"

Response example

{ "dateModified": "2022-04-05T09:12:13Z"}

Get module spec


Get the OpenAPI specification for a given Cloud Code module
Authorizations
ServiceAccount (cloud_code.modules.get)
HTTP: ServiceAccount
To get started with authentication, visit the Service Account Authentication section.
HTTP Authorization Scheme: basic
Required scopes: cloud_code.modules.get

Path parameters for "Get module spec"

projectId

string
required
example: 8bdacc33-6eef-4577-beb0-633c86259f5b
ID of the project.

environmentId

string
required
example: 5v3fb205-d8a2-920f-8013-8c0e814777b3
ID of the environment

moduleName

required
Name of a Cloud Code module.

HTTP response status codes for "Get module spec":

Code samples for "Get module spec":

Request example

curl -X GET \ -H "Authorization: Basic <YOUR_CREDENTIALS>" \ "https://services.api.unity.com/cloud-code/v1/projects/{projectId}/environments/{environmentId}/modules/{moduleName}/spec"

Response 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 - { }"

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.