openapi: 3.1.0 info: title: Contentstack Analytics Accounts Environments 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: Environments description: Endpoints for managing deployment environments (e.g., production, staging) within a stack. paths: /environments: get: operationId: getAllEnvironments summary: Get all environments description: Retrieves all deployment environments configured for the stack, such as production, staging, and development. tags: - Environments parameters: - $ref: '#/components/parameters/StackApiKey' - $ref: '#/components/parameters/AuthToken' responses: '200': description: A list of environments in the stack. content: application/json: schema: $ref: '#/components/schemas/EnvironmentList' '401': $ref: '#/components/responses/Unauthorized' /projects/{project_uid}/environments: get: operationId: getAllEnvironments summary: Get all environments description: Retrieves all deployment environments configured for a Launch project, including their domain configurations and current deployment status. tags: - Environments parameters: - $ref: '#/components/parameters/ProjectUid' responses: '200': description: A list of environments for the project. content: application/json: schema: $ref: '#/components/schemas/EnvironmentList_2' '401': $ref: '#/components/responses/Unauthorized' post: operationId: createEnvironment summary: Create an environment description: Creates a new deployment environment for a Launch project. Each environment can have its own domain, build configuration, and deployment settings. tags: - Environments parameters: - $ref: '#/components/parameters/ProjectUid' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateEnvironmentRequest' responses: '201': description: The newly created environment. content: application/json: schema: $ref: '#/components/schemas/Environment_2' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /projects/{project_uid}/environments/{env_uid}: get: operationId: getEnvironment summary: Get an environment description: Retrieves details for a specific deployment environment including its domain configuration, framework settings, and latest deployment status. tags: - Environments parameters: - $ref: '#/components/parameters/ProjectUid' - $ref: '#/components/parameters/EnvUid' responses: '200': description: The requested environment. content: application/json: schema: $ref: '#/components/schemas/Environment_2' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' put: operationId: updateEnvironment summary: Update an environment description: Updates the configuration of a deployment environment such as domain settings or build configuration. tags: - Environments parameters: - $ref: '#/components/parameters/ProjectUid' - $ref: '#/components/parameters/EnvUid' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateEnvironmentRequest' responses: '200': description: The updated environment. content: application/json: schema: $ref: '#/components/schemas/Environment_2' '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' delete: operationId: deleteEnvironment summary: Delete an environment description: Permanently deletes a deployment environment and its deployment history. This action is irreversible. tags: - Environments parameters: - $ref: '#/components/parameters/ProjectUid' - $ref: '#/components/parameters/EnvUid' responses: '200': description: Environment deleted successfully. '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' /projects/{project_uid}/environments/{env_uid}/revalidate-cache: post: operationId: revalidateCache summary: Revalidate CDN cache description: Triggers a CDN cache revalidation for the specified environment, forcing the CDN to fetch fresh content on the next request. Subject to cache revalidation quota limits per organization. tags: - Environments parameters: - $ref: '#/components/parameters/ProjectUid' - $ref: '#/components/parameters/EnvUid' requestBody: content: application/json: schema: type: object properties: paths: type: array description: Specific URL paths to revalidate. If empty, all paths are revalidated. items: type: string responses: '200': description: Cache revalidation triggered successfully. '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' components: schemas: EnvironmentList: type: object description: A list of deployment environments. properties: environments: type: array description: Array of environment objects. items: $ref: '#/components/schemas/Environment' Error_2: type: object description: Standard error response. properties: message: type: string description: Human-readable description of the error. error_code: type: integer description: Numeric error code. Environment: type: object description: A deployment environment for publishing content. properties: uid: type: string description: Unique identifier of the environment. name: type: string description: Display name of the environment. urls: type: array description: List of URL configurations for the environment. items: type: object properties: url: type: string format: uri description: The URL for the environment. locale: type: string description: The locale associated with this URL. created_at: type: string format: date-time description: ISO 8601 timestamp when the environment was created. CreateEnvironmentRequest: type: object description: Parameters for creating or updating an environment. required: - name properties: name: type: string description: Display name for the environment. domain: type: string description: Custom domain for the environment. EnvironmentList_2: type: object description: A list of deployment environments. properties: data: type: array description: Array of environment objects. items: $ref: '#/components/schemas/Environment_2' Environment_2: type: object description: A deployment environment within a Launch project. properties: uid: type: string description: Unique identifier of the environment. name: type: string description: Display name of the environment. domain: type: string description: The custom domain assigned to this environment. status: type: string description: Current status of the environment. enum: - active - inactive - deploying created_at: type: string format: date-time description: ISO 8601 timestamp when the environment was created. Error: type: object description: Standard error response. properties: error_message: type: string description: Human-readable description of the error. error_code: type: integer description: Numeric error code. errors: type: object description: Field-level validation errors. parameters: ProjectUid: name: project_uid in: path required: true description: The unique identifier of the Launch project. schema: type: string EnvUid: name: env_uid in: path required: true description: The unique identifier of the deployment environment. schema: type: string AuthToken: name: authtoken in: header required: false description: User session token for authentication. Required if not using management token. schema: type: string StackApiKey: name: api_key in: header required: true description: The API key identifying the Contentstack stack. schema: type: string responses: 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_2' NotFound: description: The requested resource was not found. content: application/json: schema: $ref: '#/components/schemas/Error_2' 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