openapi: 3.0.1 info: title: Unity Analytics Allocations Scripts API description: The Unity Analytics REST API provides endpoints for ingesting custom analytics events from game clients and servers. Events are used to track player behavior, game performance, and feature adoption. The API supports batched event ingestion with automatic retry and buffering for high-volume game telemetry. version: v1.0.0 termsOfService: https://unity.com/legal/terms-of-service contact: name: Unity Support url: https://support.unity.com license: name: Unity Terms of Service url: https://unity.com/legal/terms-of-service servers: - url: https://analytics.services.api.unity.com description: Unity Analytics Production Server security: - apiKeyAuth: [] tags: - name: Scripts description: Manage JavaScript cloud code scripts paths: /v1/projects/{projectId}/scripts: get: operationId: listScripts summary: List Scripts description: Returns all Cloud Code scripts for the project. tags: - Scripts parameters: - name: projectId in: path required: true schema: type: string - name: limit in: query required: false schema: type: integer default: 10 - name: after in: query required: false schema: type: string responses: '200': description: List of scripts content: application/json: schema: $ref: '#/components/schemas/ScriptList' '401': description: Unauthorized post: operationId: createScript summary: Create Script description: Creates a new Cloud Code JavaScript script. tags: - Scripts parameters: - name: projectId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateScriptRequest' responses: '200': description: Script created content: application/json: schema: $ref: '#/components/schemas/Script' /v1/projects/{projectId}/scripts/{scriptName}: get: operationId: getScript summary: Get Script description: Returns the details and latest code for a specific Cloud Code script. tags: - Scripts parameters: - name: projectId in: path required: true schema: type: string - name: scriptName in: path required: true schema: type: string responses: '200': description: Script details content: application/json: schema: $ref: '#/components/schemas/Script' '404': description: Script not found put: operationId: updateScript summary: Update Script description: Updates the code and configuration of an existing Cloud Code script. tags: - Scripts parameters: - name: projectId in: path required: true schema: type: string - name: scriptName in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateScriptRequest' responses: '200': description: Script updated content: application/json: schema: $ref: '#/components/schemas/Script' delete: operationId: deleteScript summary: Delete Script description: Deletes a Cloud Code script and all its versions. tags: - Scripts parameters: - name: projectId in: path required: true schema: type: string - name: scriptName in: path required: true schema: type: string responses: '204': description: Script deleted components: schemas: ScriptParameter: type: object properties: name: type: string type: type: string enum: - STRING - NUMERIC - BOOLEAN - JSON required: type: boolean CreateScriptRequest: type: object required: - name - language - code properties: name: type: string description: Unique script name within the project language: type: string enum: - JS code: type: string description: JavaScript code for the script params: type: array items: $ref: '#/components/schemas/ScriptParameter' Script: type: object properties: name: type: string language: type: string enum: - JS activeScript: $ref: '#/components/schemas/ScriptVersion' versions: type: array items: $ref: '#/components/schemas/ScriptVersion' params: type: array items: $ref: '#/components/schemas/ScriptParameter' created: type: string format: date-time modified: type: string format: date-time UpdateScriptRequest: type: object properties: code: type: string params: type: array items: $ref: '#/components/schemas/ScriptParameter' ScriptVersion: type: object properties: code: type: string description: The JavaScript code datePublished: type: string format: date-time ScriptList: type: object properties: results: type: array items: $ref: '#/components/schemas/Script' links: type: object properties: next: type: string securitySchemes: apiKeyAuth: type: apiKey in: header name: x-api-key externalDocs: description: Unity Analytics Documentation url: https://docs.unity.com/ugs/en-us/manual/analytics/manual/rest-api