openapi: 3.0.1 info: title: Unity Analytics Allocations Purchases 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: Purchases description: Process virtual and real-money purchases paths: /v2/projects/{projectId}/environments/{environmentId}/players/{playerId}/purchases/virtual: post: operationId: makeVirtualPurchase summary: Make Virtual Purchase description: Processes a virtual purchase using the player's in-game currency or items. tags: - Purchases parameters: - name: projectId in: path required: true schema: type: string - name: environmentId in: path required: true schema: type: string - name: playerId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/VirtualPurchaseRequest' responses: '200': description: Purchase successful content: application/json: schema: $ref: '#/components/schemas/VirtualPurchaseResult' '402': description: Insufficient funds components: schemas: VirtualPurchaseResult: type: object properties: id: type: string purchased: type: object properties: currencies: type: array items: $ref: '#/components/schemas/CurrencyBalance' inventory: type: array items: $ref: '#/components/schemas/InventoryItem' costs: type: object properties: currencies: type: array items: $ref: '#/components/schemas/CurrencyBalance' inventory: type: array items: $ref: '#/components/schemas/InventoryItem' VirtualPurchaseRequest: type: object required: - id properties: id: type: string description: The virtual purchase configuration ID CurrencyBalance: type: object properties: currencyId: type: string balance: type: integer writeLock: type: string created: $ref: '#/components/schemas/Timestamp' modified: $ref: '#/components/schemas/Timestamp' InventoryItem: type: object properties: playersItemId: type: string inventoryItemId: type: string quantity: type: integer instanceData: type: object writeLock: type: string created: $ref: '#/components/schemas/Timestamp' modified: $ref: '#/components/schemas/Timestamp' Timestamp: type: object properties: date: type: string format: date-time 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