contentstack Stacks API

Endpoints for creating and managing Contentstack stacks, including settings, users, sharing, and ownership transfer.

OpenAPI Specification

contentstack-stacks-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Contentstack Analytics Accounts Stacks 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: Stacks
  description: Endpoints for creating and managing Contentstack stacks, including settings, users, sharing, and ownership transfer.
paths:
  /stacks:
    get:
      operationId: getAllStacks
      summary: Get all stacks
      description: Returns all stacks accessible to the authenticated user, optionally filtered by organization.
      tags:
      - Stacks
      responses:
        '200':
          description: A list of accessible stacks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StackList'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createStack
      summary: Create a stack
      description: Creates a new Contentstack stack within an organization. A stack is an independent repository for content, assets, and configuration within a Contentstack account.
      tags:
      - Stacks
      parameters:
      - $ref: '#/components/parameters/OrganizationUidHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateStackRequest'
      responses:
        '201':
          description: The newly created stack.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Stack'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /stacks/{api_key}:
    get:
      operationId: getStack
      summary: Get a stack
      description: Retrieves details for a specific stack identified by its API key, including configuration, plan, and region information.
      tags:
      - Stacks
      parameters:
      - $ref: '#/components/parameters/StackApiKey'
      responses:
        '200':
          description: The requested stack details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Stack'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      operationId: updateStack
      summary: Update a stack
      description: Updates settings and metadata for a specific stack such as name, description, and master locale configuration.
      tags:
      - Stacks
      parameters:
      - $ref: '#/components/parameters/StackApiKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateStackRequest'
      responses:
        '200':
          description: The updated stack object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Stack'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
    delete:
      operationId: deleteStack
      summary: Delete a stack
      description: Permanently deletes a stack and all its contents. This action is irreversible and will remove all content types, entries, assets, and configuration from the stack.
      tags:
      - Stacks
      parameters:
      - $ref: '#/components/parameters/StackApiKey'
      responses:
        '200':
          description: Stack deleted successfully.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  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'
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    UpdateStackRequest:
      type: object
      description: Fields to update on the stack.
      properties:
        stack:
          type: object
          properties:
            name:
              type: string
              description: Updated display name.
            description:
              type: string
              description: Updated description.
    Stack:
      type: object
      description: A Contentstack stack, which is an independent content repository.
      properties:
        api_key:
          type: string
          description: Unique API key identifying the stack.
        uid:
          type: string
          description: Unique identifier of the stack.
        name:
          type: string
          description: Display name of the stack.
        description:
          type: string
          description: Description of the stack's purpose.
        master_locale:
          type: string
          description: The default locale code for the stack.
        org_uid:
          type: string
          description: UID of the organization that owns the stack.
        created_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp when the stack was created.
        updated_at:
          type: string
          format: date-time
          description: ISO 8601 timestamp when the stack was last updated.
    StackList:
      type: object
      description: A list of stacks.
      properties:
        stacks:
          type: array
          description: Array of stack objects.
          items:
            $ref: '#/components/schemas/Stack'
    CreateStackRequest:
      type: object
      description: Parameters for creating a new stack.
      required:
      - stack
      properties:
        stack:
          type: object
          required:
          - name
          - master_locale
          properties:
            name:
              type: string
              description: Display name for the new stack.
            master_locale:
              type: string
              description: Default locale code for the stack (e.g., en-us).
            description:
              type: string
              description: Description of the stack's purpose.
    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:
    OrganizationUidHeader:
      name: organization_uid
      in: header
      required: true
      description: The UID of the organization in which to create the stack.
      schema:
        type: string
    StackApiKey:
      name: api_key
      in: header
      required: true
      description: The API key identifying the Contentstack stack.
      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