> ## Documentation Index
> Fetch the complete documentation index at: https://buttercms.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Collection Item

> Create a new item within a Collection via the Write API with support for locales and media uploads.

Create new items within a Collection using the Write API. Collections support completely dynamic schemas and multi-locale content, making them ideal for flexible content types like team members, products, or testimonials.

**Dynamic Schema Flexibility**: Collection fields are entirely user-defined through your dashboard configuration. The field structure in your request must match the schema you've configured for the specific collection, including field types, validation rules, and any required fields.

**Locale Structure**: For organizations without locales configured, provide field values directly in a flat structure. For multi-locale organizations, nest your field data under the appropriate locale codes (e.g., "en", "es") to create content in multiple languages simultaneously.

**Media Integration**: If `Media` is the field\_type for a chosen field, any URL can be provided as the field's value. The media corresponding to this URL will be automatically downloaded and uploaded to your ButterCMS media library, ensuring reliable hosting and CDN integration.

**Media Alt Text**: A Media field also accepts an object `{"url": "https://...", "alt": "Descriptive alt text"}`. Alt text is optional, up to 255 characters, and is returned by the Read API when you pass `alt_media_text=1`. Sending a plain URL string replaces any existing alt text.

**Asynchronous Processing**: This endpoint returns `202 Accepted` immediately to ensure fast response times for your application. The actual item creation, including media uploads, validation, and any configured webhooks, happens in the background processing queue.
See also: Architecture & Performance for guidance on `levels`, pagination, and performance best practices.


## OpenAPI

````yaml /api/openapi/write_api.yaml post /content/
openapi: 3.1.0
info:
  title: ButterCMS Write API
  version: 2.0.0
  description: >
    Write endpoints for the ButterCMS API — create, update, and delete Pages,
    Collections, and Blog Posts.


    **Authentication**: pass your write-enabled token via the `Authorization:
    Token <token>` header. A `?auth_token=` query parameter also works (the same
    mechanism as the Read API), but avoid it for write requests: a write token
    is higher-privilege and a URL is more likely to be logged or leaked than a
    header.
  contact:
    email: support@buttercms.com
  license:
    name: ButterCMS Terms of Service
    url: https://buttercms.com/terms/
servers:
  - url: https://api.buttercms.com/v2
    description: ButterCMS API v2
security:
  - writeTokenAuth: []
tags:
  - name: Pages
    description: >
      Create new pages using ButterCMS Write API. Programmatically create
      content to enable powerful use cases and scale your content faster.


      Note: For Pages, PUT behaves like PATCH (partial update). Use either
      method to perform partial updates.
  - name: Collections
    description: >
      Create, update, and delete Collection items using ButterCMS Write API.
      Collections are user-defined content structures with completely
      customizable field schemas.
  - name: Blog posts
    description: >
      Create, update, and delete blog posts using ButterCMS Write API. Blog
      posts support rich content including HTML body, categories, tags, featured
      images, and SEO metadata.
paths:
  /content/:
    post:
      tags:
        - Collections
      summary: Create Collection Item
      description: >
        Create new items within a Collection using the Write API. Collections
        support completely dynamic schemas and multi-locale content, making them
        ideal for flexible content types like team members, products, or
        testimonials.


        **Dynamic Schema Flexibility**: Collection fields are entirely
        user-defined through your dashboard configuration. The field structure
        in your request must match the schema you've configured for the specific
        collection, including field types, validation rules, and any required
        fields.


        **Locale Structure**: For organizations without locales configured,
        provide field values directly in a flat structure. For multi-locale
        organizations, nest your field data under the appropriate locale codes
        (e.g., "en", "es") to create content in multiple languages
        simultaneously.


        **Media Integration**: If `Media` is the field_type for a chosen field,
        any URL can be provided as the field's value. The media corresponding to
        this URL will be automatically downloaded and uploaded to your ButterCMS
        media library, ensuring reliable hosting and CDN integration.


        **Media Alt Text**: A Media field also accepts an object `{"url":
        "https://...", "alt": "Descriptive alt text"}`. Alt text is optional, up
        to 255 characters, and is returned by the Read API when you pass
        `alt_media_text=1`. Sending a plain URL string replaces any existing alt
        text.


        **Asynchronous Processing**: This endpoint returns `202 Accepted`
        immediately to ensure fast response times for your application. The
        actual item creation, including media uploads, validation, and any
        configured webhooks, happens in the background processing queue.

        See also: Architecture & Performance for guidance on `levels`,
        pagination, and performance best practices.
      operationId: createCollectionItem
      requestBody:
        required: true
        description: >-
          Collection item data with dynamic field structure based on collection
          configuration and locale settings.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCollectionItemRequest'
            examples:
              without_locales:
                summary: Create item without locales (single language)
                description: >-
                  Use this format when your organization has no locales
                  configured
                value:
                  key: team_members
                  status: published
                  fields:
                    - name: John Doe
                      position: Software Engineer
                      bio: Experienced developer with expertise in web technologies
                      profile_image: https://example.com/images/john-doe.jpg
                      years_experience: 5
              with_locales:
                summary: Create item with locales (multi-language)
                description: >-
                  Use this format when your organization has locales configured
                  (e.g., English and Spanish)
                value:
                  key: team_members
                  status: published
                  fields:
                    - en:
                        name: John Doe
                        position: Software Engineer
                        bio: >-
                          Experienced developer with expertise in web
                          technologies
                        profile_image: https://example.com/images/john-doe.jpg
                        years_experience: 5
                      es:
                        name: John Doe
                        position: Ingeniero de Software
                        bio: >-
                          Desarrollador experimentado con experiencia en
                          tecnologías web
                        profile_image: https://example.com/images/john-doe.jpg
                        years_experience: 5
              media_upload_example:
                summary: Create item with remote media URLs
                description: >-
                  Demonstrates automatic media upload from remote URLs, with
                  optional alt text
                value:
                  key: products
                  status: draft
                  fields:
                    - name: Premium Widget
                      description: High-quality widget for professional use
                      main_image:
                        url: https://cdn.example.com/products/widget-main.jpg
                        alt: Premium Widget on a white background
                      gallery_images:
                        - https://cdn.example.com/products/widget-1.jpg
                        - https://cdn.example.com/products/widget-2.jpg
                      price: 99.99
      responses:
        '202':
          description: >
            **Accepted - Collection Item Creation Queued**


            The collection item has passed initial validation and creation has
            been queued for asynchronous processing.


            **Important**: The item may not be immediately available in
            collection queries. Background processing includes:


            - Field validation against collection schema

            - Media download and upload to Butter Media Library

            - Reference field resolution

            - Search index updates


            **Media failures are silent**: an unsupported file type, a video URL
            on a plan without video support, or an SVG containing `<script>`
            cannot be rejected at this point, because the `202` has already been
            sent. If one of these checks fails during background processing, the
            media field is set to a broken-image placeholder URL instead of
            raising an error. Check the resulting item to confirm media uploaded
            as expected.


            If creation fails during background processing for another reason,
            contact support for assistance.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCollectionItemResponse'
              example:
                status: pending
        '400':
          description: >
            **Bad Request - Validation Failed**


            The request failed initial validation. Common causes:


            - **Missing Required Fields**: `key` or `fields` not provided

            - **Invalid Status**: Status must be 'published' or 'draft'

            - **Field Validation**: Missing required fields or invalid field
            values

            - **Unreachable Media URLs**: A media field URL doesn't respond to
            an HTTP `HEAD` request with `200`. This is checked before the `202`
            is sent, unlike the silent media checks listed under the `202`
            response.

            - **Locale Errors**: Invalid locale codes or mismatched locale
            format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              examples:
                missing_fields:
                  summary: Missing required fields
                  value:
                    key: Missing parameter
                    fields: Missing parameter
                invalid_status:
                  summary: Invalid status value
                  value:
                    status: Valid status values are 'draft' and 'published'
                unreachable_media_url:
                  summary: Media URL could not be reached
                  value:
                    - >-
                      The resource 'https://example.com/missing.jpg' could not
                      be reached.
        '401':
          $ref: '#/components/responses/UnauthorizedWriteResponse'
        '403':
          description: >
            **Forbidden - Insufficient Permissions or Subscription Limits**


            This error occurs when the provided token doesn't have write
            permissions or the collection item limit has been reached for your
            subscription plan.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/LimitErrorResponse'
              examples:
                write_permission:
                  summary: Token lacks write permissions
                  value:
                    detail: Your API token does not allow writes.
                organization_limit:
                  summary: Collection item limit reached
                  value:
                    error: >-
                      Cannot create a new Collection Item. Collection Item Limit
                      Reached.
        '404':
          description: >
            **Not Found - Unknown Collection Key**


            The `key` does not match any collection configured for your
            organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: No content_list found for key='team_members'
      security:
        - writeTokenAuth: []
components:
  schemas:
    CreateCollectionItemRequest:
      type: object
      required:
        - key
        - fields
      properties:
        key:
          type: string
          description: |
            The unique identifier/slug of the Collection to create an item in.

            Must match an existing collection in your organization.
          example: team_members
        status:
          type: string
          enum:
            - published
            - draft
          default: draft
          description: |
            Status of the collection item:

            - **draft**: Item is saved but not publicly available
            - **published**: Item is live and publicly accessible

            Defaults to "draft" if not specified.
          example: published
        fields:
          type: array
          description: >
            Array of collection item data. Structure varies based on locale
            configuration:


            - **Without Locales**: Array of objects with direct field key-value
            pairs

            - **With Locales**: Array of objects with locale codes as keys,
            containing field data


            **Dynamic Nature**: Field names and types are defined by your
            collection schema and can vary completely between collections.


            **Media Fields**: Provide a remote URL string, or an object `{"url":
            "https://...", "alt": "Descriptive alt text"}` to also set alt text
            (up to 255 characters).
          items:
            type: object
            description: >
              **Flexible collection item data - supports both single-locale and
              multi-locale formats.**


              System automatically detects the format based on the structure of
              the object:


              **Without Locales Format**: Direct field properties (e.g., `name`,
              `position`, `bio`)

              **With Locales Format**: Locale codes as keys (e.g., `en`, `es`,
              `fr`)


              **Dynamic Schema**: Field names and types are completely
              user-defined based on your collection configuration.
            additionalProperties: true
          minItems: 1
          example:
            - name: John Smith
              position: Senior Developer
              email: john@company.com
    CreateCollectionItemResponse:
      type: object
      description: Response for successful collection item creation (202 Accepted)
      properties:
        status:
          type: string
          enum:
            - pending
          description: >-
            Indicates that the collection item creation is being processed
            asynchronously
          example: pending
    ValidationErrorResponse:
      description: >-
        Response for validation errors (400 Bad Request). The shape varies by
        endpoint and check: a field-keyed object whose values are arrays of
        messages or single message strings, a bare array of messages, or a
        general `error` message.
      anyOf:
        - type: object
          description: >-
            Field-specific validation errors (used by Pages, Blog Posts, and
            Collections). Values are usually arrays of messages; some checks
            return a single string.
          additionalProperties:
            oneOf:
              - type: array
                items:
                  type: string
              - type: string
          example:
            title:
              - This field is required.
            slug: You must specify a page slug.
        - type: array
          description: >-
            Bare array of messages (used by some Collection item validation
            errors)
          items:
            type: string
          example:
            - '''field1_key'' is required'
        - type: object
          description: General error message (used for organization limits, etc.)
          properties:
            error:
              type: string
              description: Error message
          example:
            error: >-
              Cannot create a new Collection Item. Collection Item Limit
              Reached.
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
          description: Error message describing what went wrong
          example: Authentication credentials were not provided.
    LimitErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message when subscription plan limits are exceeded
          example: Page creation limit is over
  responses:
    UnauthorizedWriteResponse:
      description: >
        **Unauthorized - Missing or Invalid API Token**


        No token was sent, or the token isn't valid. A valid Read API token on a
        write request returns `403` with `Your API token does not allow writes.`
        instead.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_token:
              summary: Missing API token
              value:
                detail: Authentication credentials were not provided.
            invalid_token:
              summary: Invalid API token
              value:
                detail: Invalid token.
  securitySchemes:
    writeTokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >
        Write-enabled API token required for creating content.


        The API token you use for reading from the ButterCMS API will not allow
        you to create content in the API. For this you will need to use a
        different write-enabled token. Write API access is a paid add-on for
        Advanced and Professional plans, enabled from the Billing page of your
        account. It isn't offered on Basic plans.


        Set the `Authorization` header to `Token your_write_api_token`. The
        `?auth_token=` query parameter also works for write requests, but a
        header is safer because URLs are more likely to be logged.


        Example: `Authorization: Token abc123def456`


        Your write-enabled token should never be used anywhere it would be
        exposed, e.g. in client-side JavaScript.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.