openapi: 3.1.0 info: title: Contentstack Analytics Accounts Events API description: The Contentstack Analytics API provides access to usage and performance metrics for CMS, Launch, and Automate products within a Contentstack organization. Developers can retrieve analytics data programmatically to build custom dashboards, monitor content delivery performance, and track platform usage against plan limits. The API returns structured data suitable for aggregation with external analytics and business intelligence tools. Access is restricted to organization Owners and Admins. Requests use async job-based processing where initial POST calls queue the job and a subsequent GET call retrieves the results. version: v2 contact: name: Contentstack Support url: https://www.contentstack.com/contact termsOfService: https://www.contentstack.com/legal/terms-of-service servers: - url: https://api.contentstack.io description: AWS North America Production Server - url: https://eu-api.contentstack.com description: AWS Europe Production Server - url: https://au-api.contentstack.com description: AWS Australia Production Server security: - bearerAuth: [] - authtokenAuth: [] tags: - name: Events description: The events endpoint allows applications to track user actions and behavioral events for experience analytics and audience rule evaluation. paths: /events: post: operationId: trackEvents summary: Track user events description: Records one or more user behavior events for experience analytics and audience evaluation. Supports both impression events (automatic tracking when experiences are shown) and custom events (defined in the Personalize Management API and triggered by specific user actions). tags: - Events parameters: - $ref: '#/components/parameters/ProjectUid' - $ref: '#/components/parameters/PersonalizeUserUidRequired' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TrackEventsRequest' responses: '202': description: Events accepted for processing. '400': $ref: '#/components/responses/BadRequest' '403': $ref: '#/components/responses/Forbidden' get: operationId: getAllEvents summary: Get all events description: Retrieves all custom event definitions in the Personalize project. Events are used to track user interactions and trigger audience membership updates. tags: - Events parameters: - $ref: '#/components/parameters/ProjectUid' responses: '200': description: A list of all events in the project. content: application/json: schema: $ref: '#/components/schemas/EventList' '401': $ref: '#/components/responses/Unauthorized' components: responses: Forbidden: description: The request is not authorized for this project. content: application/json: schema: $ref: '#/components/schemas/Error' Unauthorized: description: Authentication credentials are missing or invalid. content: application/json: schema: $ref: '#/components/schemas/Error' BadRequest: description: The request is malformed or contains invalid parameters. content: application/json: schema: $ref: '#/components/schemas/Error' schemas: EventList: type: object description: A list of custom event definitions. properties: data: type: array description: Array of event objects. items: $ref: '#/components/schemas/PersonalizeEvent' PersonalizeEvent: type: object description: A custom event definition for tracking user actions. properties: uid: type: string description: Unique identifier of the event. name: type: string description: Display name of the event. key: type: string description: Machine-readable event key used in SDK tracking calls. created_at: type: string format: date-time description: ISO 8601 timestamp when the event was created. TrackEventsRequest: type: array description: Array of event objects to track. items: $ref: '#/components/schemas/TrackEvent' TrackEvent: type: object description: A single event to be tracked for the user. required: - eventKey properties: eventKey: type: string description: The key of the event to track. Use "impression" for automatic view tracking or a custom event key defined in the Personalize Management API. experience_uid: type: string description: The UID of the experience associated with this event. Required for impression events. variant_uid: type: string description: The UID of the variant shown to the user. Required for impression events. Error: type: object description: Standard error response. properties: message: type: string description: Human-readable description of the error. status: type: integer description: HTTP status code. parameters: ProjectUid: name: x-project-uid in: header required: true description: The UID of the Contentstack Personalize project. schema: type: string PersonalizeUserUidRequired: name: x-cs-personalize-user-uid in: header required: true description: The unique identifier for the end user whose events are being tracked. schema: type: string securitySchemes: bearerAuth: type: http scheme: bearer description: OAuth 2.0 Bearer token (M2M) with analytics access. authtokenAuth: type: apiKey in: header name: authtoken description: Contentstack user authtoken. Only organization Owners and Admins can access analytics. externalDocs: description: Contentstack Analytics API Documentation url: https://www.contentstack.com/docs/developers/apis/analytics-api