> ## 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.

# Retrieve Collection

> Retrieve items from a specific Collection with comprehensive filtering, pagination, and relationship serialization.

Retrieve items from a specific Collection with comprehensive filtering, pagination, and relationship serialization capabilities. This endpoint provides flexible access to your dynamic content with powerful query options.

**Collection Structure**: Collections contain completely user-defined content with customizable field schemas that you configure through the dashboard. Each collection can have different field types, validation rules, and structural requirements based on your content needs.

**Response Format**: The response includes a `meta` object containing pagination information and result counts, a `data` array with the actual collection items, and individual `item.meta` objects containing unique IDs that you'll need for update and delete operations.
See also: Architecture & Performance for guidance on `levels`, pagination, and performance best practices.


## OpenAPI

````yaml /api/openapi/read_api.yaml get /content/{collection_key}/
openapi: 3.1.0
info:
  title: ButterCMS Read API
  version: 2.0.0
  description: >
    Read endpoints for the ButterCMS API — Pages, Collections, Blog Posts, Blog
    Metadata, and Feeds.
  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:
  - readTokenAuthHeader: []
  - readTokenAuthQuery: []
tags:
  - name: Pages
    description: >
      Retrieve pages from your ButterCMS account.


      **Single Pages**: Use `*` as the page_type to get Single Pages (those
      without a Page Type) which represent unique pages on your site like your
      Homepage. Useful for creating your sitemap.xml.


      **Page Type Pages**: Use the actual page type slug to get pages of that
      specific type. Page Types allow you to create many pages with the same
      structure.


      **Note:** The fields of a page are defined by you, they are customizable.
      Sample responses below contain a basic set of fields for illustrative
      purposes.
  - name: Collections
    description: >
      Retrieve collection items from your ButterCMS account. Collections are
      flexible, user-defined content structures with completely customizable
      field schemas.


      See also: Architecture & Performance for guidance on `levels`, pagination,
      and performance best practices.
  - name: Blog posts
    description: >
      Retrieve blog posts from your ButterCMS account. List blog posts with
      pagination and filtering options, or retrieve individual posts by slug.
  - name: Blog metadata
    description: >
      Retrieve blog-related metadata including authors, categories, and tags.
      These endpoints provide access to the organizational structure of your
      blog content.
  - name: Feeds and utilities
    description: >
      Generate XML feeds for content syndication and SEO.


      - **RSS Feed**: Fully generated RSS 2.0 feed for your blog

      - **Atom Feed**: Standards-compliant Atom 1.0 feed

      - **Sitemap**: XML sitemap for search engine discovery


      All feeds can be filtered by category or tag and include only published
      content from your organization.
  - name: Images - Info
    description: >
      ButterCMS has an integration with
      [Filestack](https://www.filestack.com/docs/api/processing/) for image
      transformations. You can leverage their robust set of image transformation
      capabilities.


      After you upload an image, to create a thumbnail, here's an example:


      - **Original URL**: `https://cdn.buttercms.com/3ccPHhYHTNK2zQ14gCOy`

      - **Thumbnail URL**:
      `https://cdn.buttercms.com/resize=width:100,height:100/3ccPHhYHTNK2zQ14gCOy`


      For complete transformation options and parameters, see the [full
      Filestack documentation](https://www.filestack.com/docs/api/processing/).
paths:
  /content/{collection_key}/:
    get:
      tags:
        - Collections
      summary: Retrieve Collection
      description: >
        Retrieve items from a specific Collection with comprehensive filtering,
        pagination, and relationship serialization capabilities. This endpoint
        provides flexible access to your dynamic content with powerful query
        options.


        **Collection Structure**: Collections contain completely user-defined
        content with customizable field schemas that you configure through the
        dashboard. Each collection can have different field types, validation
        rules, and structural requirements based on your content needs.


        **Response Format**: The response includes a `meta` object containing
        pagination information and result counts, a `data` array with the actual
        collection items, and individual `item.meta` objects containing unique
        IDs that you'll need for update and delete operations.

        See also: Architecture & Performance for guidance on `levels`,
        pagination, and performance best practices.
      operationId: retrieveCollection
      parameters:
        - name: collection_key
          in: path
          required: true
          schema:
            type: string
            maxLength: 50
          description: |
            The unique identifier/slug of the Collection to retrieve.

            Must match an existing collection in your organization.
          example: artists
        - $ref: '#/components/parameters/auth_token'
        - name: preview
          in: query
          description: >
            Set to 1 to include draft/unpublished collection items. Useful for
            staging environments.


            **Alias**: `test=1` is also accepted and has the same effect.
          required: false
          schema:
            type: integer
            enum:
              - 0
              - 1
            default: 0
          example: 1
        - name: test
          in: query
          description: >
            Legacy alias for `preview`. Set to 1 to include draft/unpublished
            collection items.
          required: false
          schema:
            type: integer
            enum:
              - 0
              - 1
            default: 0
        - name: order
          in: query
          description: >
            Order items by one of this Collection's own field keys (optionally
            prefixed with `-` for descending). The value must match a field
            actually defined on the Collection's schema. Pages-style meta keys
            like `published`/`updated` are not valid here and return a `403`.


            When omitted, items are returned in natural (insertion) order.
          required: false
          schema:
            type: string
          examples:
            ascending:
              value: label
              description: Order by a collection field, ascending
            descending:
              value: '-label'
              description: Order by a collection field, descending
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
        - $ref: '#/components/parameters/locale'
        - $ref: '#/components/parameters/levels'
        - $ref: '#/components/parameters/alt_media_text'
        - name: fields
          in: query
          required: false
          schema:
            type: object
            additionalProperties:
              type: string
          description: >
            Dynamic field filtering using individual
            `fields.<field_name>=<value>` query parameters (not an OpenAPI
            deepObject-style parameter).


            Filter collection items by any field using the pattern
            `fields.{field_name}=value`:

            - `fields.genre=Rock` - Filter by genre field

            - `fields.status=published` - Filter by status field

            - `fields.year=2023` - Filter by year field


            Multiple field filters can be combined in a single request.
          examples:
            genre_filter:
              summary: Filter by genre
              value:
                genre: Rock
            status_filter:
              summary: Filter by status
              value:
                status: published
            multi_filter:
              summary: Multiple filters
              value:
                genre: Rock
                year: '2023'
      responses:
        '200':
          description: Collection retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageBasedCollectionResponse'
              examples:
                artists_collection:
                  summary: Artists collection response
                  value:
                    meta:
                      count: 25
                      next_page: 3
                      previous_page: 1
                    data:
                      artists:
                        - meta:
                            id: 123
                          name: The Beatles
                          genre: Rock
                          formed_year: 1960
                          description: Legendary British rock band
                        - meta:
                            id: 124
                          name: The Rolling Stones
                          genre: Rock
                          formed_year: 1962
                          description: Iconic rock and roll band
                filtered_response:
                  summary: Filtered collection response
                  value:
                    meta:
                      count: 5
                      next_page: null
                      previous_page: null
                    data:
                      products:
                        - meta:
                            id: 456
                          title: Premium Headphones
                          category: Electronics
                          price: 299.99
                          in_stock: true
                localized_response:
                  summary: Localized collection response
                  value:
                    meta:
                      count: 10
                      next_page: 2
                      previous_page: null
                    data:
                      articles:
                        - meta:
                            id: 789
                          title: Bonjour le monde
                          content: Contenu en français...
                          locale: fr
                media_url_format:
                  summary: Media field as URL string (alt_media_text=0)
                  description: >
                    When `alt_media_text=0` (default), media fields are returned
                    as URL strings.
                  value:
                    meta:
                      count: 1
                      next_page: null
                      previous_page: null
                    data:
                      products:
                        - meta:
                            id: 900
                          title: Poster
                          media: https://cdn.example.com/media/poster.jpg
                media_object_format:
                  summary: Media field as object (alt_media_text=1)
                  description: >
                    When `alt_media_text=1`, media fields are returned as
                    objects. The object always includes `url`, and `alt` is
                    included when available.
                  value:
                    meta:
                      count: 1
                      next_page: null
                      previous_page: null
                    data:
                      products:
                        - meta:
                            id: 901
                          title: Poster
                          media:
                            url: https://cdn.example.com/media/poster.jpg
                            alt: Movie poster artwork
        '400':
          description: >
            **Bad Request - Invalid locale or levels**


            The `locale` isn't configured on this account, or `levels` isn't an
            integer. Integer `levels` values outside 1-5 are clamped, not
            rejected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
              examples:
                invalid_locale:
                  summary: Locale not configured for this account
                  value:
                    locale: The passed locale isn't configured on this account.
                invalid_levels:
                  summary: Non-integer levels parameter
                  value:
                    detail: >-
                      levels query parameter should be an integer between 1 and
                      5 (inclusive)
        '401':
          $ref: '#/components/responses/UnauthorizedResponse'
        '403':
          description: >
            **Forbidden - Invalid Order or Filter Key**


            The `order` parameter, or a `fields.<name>` filter key, doesn't
            match a field defined on this Collection.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_order:
                  summary: Invalid order key
                  value:
                    detail: published is not a valid key to order by.
                invalid_filter:
                  summary: Invalid filter key
                  value:
                    detail: Invalid filter key nonexistent_field
        '404':
          description: >
            **Not Found - Collection Does Not Exist**


            Note: an out-of-range `page` is not consistently a `404` across
            accounts: most accounts get `200` with an empty `data` array and
            `next_page: null`; some get `404` with `{"detail": "Invalid
            Page."}`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                collection_not_found:
                  summary: Collection not found
                  value:
                    detail: Not found.
      security:
        - readTokenAuthHeader: []
        - readTokenAuthQuery: []
components:
  parameters:
    auth_token:
      name: auth_token
      in: query
      required: false
      schema:
        type: string
      description: |
        Your ButterCMS read API token
      example: your_api_token
    page:
      name: page
      in: query
      description: |
        Page number for page-based pagination.

        **Mutually exclusive with limit/offset parameters.**
      required: false
      schema:
        type: integer
        default: 1
        minimum: 1
      example: 2
    page_size:
      name: page_size
      in: query
      description: |
        Number of items per page for page-based pagination.

        **Mutually exclusive with limit/offset parameters.**
      required: false
      schema:
        type: integer
        default: 10
        minimum: 1
        maximum: 100
      example: 5
    locale:
      name: locale
      in: query
      description: >
        Set to the api slug of your configured locale (e.g. `en` or `fr`). When
        omitted, this query parameter will default to your organization's
        default locale.
      required: false
      schema:
        type: string
        maxLength: 10
        example: en
      examples:
        english:
          value: en
          description: English locale
        spanish:
          value: es
          description: Spanish locale
        french:
          value: fr
          description: French locale
    levels:
      name: levels
      in: query
      description: >
        Depth of relationship serialization.


        Controls how many levels of referenced content to include:

        - **1**: Direct fields only, references as URIs

        - **2**: Direct fields + one level of references (default)

        - **3-5**: Deeper relationship traversal


        **Important**: Higher levels increase response size. Maximum 10MB per
        response.


        Valid range: 1-5 (inclusive). Values outside this range will be
        automatically capped.
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 5
        default: 2
      examples:
        shallow:
          value: 1
          description: Minimal depth (1 level)
        default:
          value: 2
          description: Default depth (2 levels)
        deep:
          value: 5
          description: Maximum depth (5 levels)
    alt_media_text:
      name: alt_media_text
      in: query
      description: >
        Media field response format.


        Affects only media-typed fields. Other field types are unchanged.


        - **0** (default): Media fields return simple URL strings

        - **1**: Media fields return objects with at least `url` and, when
        available,
          `alt`. If the stored media value is just a URL string, the object will
          include `url` only.
      required: false
      schema:
        type: integer
        enum:
          - 0
          - 1
        default: 0
      examples:
        url_only:
          value: 0
          description: Return media as URL strings (default)
        object_format:
          value: 1
          description: >-
            Return media as objects with at least url (alt included when
            available)
  schemas:
    PageBasedCollectionResponse:
      type: object
      description: Collection response using page-based pagination
      properties:
        meta:
          $ref: '#/components/schemas/CollectionPaginationMeta'
        data:
          type: object
          description: Collection data object with dynamic key based on collection name
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/CollectionItemObject'
      required:
        - meta
        - data
    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.
    CollectionPaginationMeta:
      type: object
      description: Pagination metadata for collection retrieval
      properties:
        count:
          type: integer
          description: Total number of items in the collection (across all pages)
          example: 150
        next_page:
          type:
            - integer
            - 'null'
          description: Next page number if more pages exist, null if this is the last page
          example: 3
        previous_page:
          type:
            - integer
            - 'null'
          description: >-
            Previous page number if previous pages exist, null if this is the
            first page
          example: 1
    CollectionItemObject:
      type: object
      description: Individual collection item with dynamic field structure and metadata
      properties:
        meta:
          $ref: '#/components/schemas/CollectionItemMeta'
      additionalProperties: true
      example:
        meta:
          id: 123
        name: The Beatles
        genre: Rock
        formed_year: 1960
        members:
          - John Lennon
          - Paul McCartney
          - George Harrison
          - Ringo Starr
        description: Legendary British rock band
    CollectionItemMeta:
      type: object
      description: Metadata for collection items containing unique identifier
      properties:
        id:
          type: integer
          description: >-
            Unique identifier for the collection item, used for updates and
            deletions
          example: 123
      required:
        - id
  responses:
    UnauthorizedResponse:
      description: Unauthorized - Invalid or missing API token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_token:
              summary: Missing API token (most Read endpoints)
              description: >-
                The message most Read API endpoints (Pages, Blog Posts, Blog
                metadata, Feeds, `/v2/content/?keys=` and single collection
                items) return for a missing token.
              value:
                detail: Incorrect authentication credentials.
            missing_token_collections:
              summary: Missing API token (writes, collection by key, page search)
              description: >-
                Write requests, `GET /v2/content/{key}/` and `GET
                /v2/pages/search/` return this message instead for a missing
                token.
              value:
                detail: Authentication credentials were not provided.
            invalid_token:
              summary: Invalid API token
              value:
                detail: Invalid token.
  securitySchemes:
    readTokenAuthHeader:
      type: apiKey
      in: header
      name: Authorization
      description: >
        Set the `Authorization` header to `Token your_read_api_token`.


        Example: `Authorization: Token abc123def456`


        Note: The header value includes the `Token` prefix. `Authorization:
        Bearer ...` is not accepted and returns 401.


        You can access your API token from your settings page.
    readTokenAuthQuery:
      type: apiKey
      in: query
      name: auth_token
      description: >
        Pass your API token via the `auth_token` parameter on every request:
        `?auth_token=your_read_api_token`.


        You can access your API token from your settings page.


        Requests made with a missing or invalid token will get a 401
        Unauthorized response. All requests must be made over HTTPS.

````

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