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

# Query Collections

> Filter and sort collections using field-level predicates with pagination.



## OpenAPI

````yaml /openapi/product/appdb.yaml post /api/datastores/v1/collections/query
openapi: 3.0.0
info:
  title: App DB API
  version: v1
  description: |
    The App DB API allows developers to interact with AppDB, a NoSQL database 
    for storing arbitrary JSON documents. This API supports CRUD operations, 
    querying, and aggregation, enabling developers to manage data efficiently 
    within their Domo applications.
servers:
  - url: https://{instance}.domo.com
    description: Domo Instance
    variables:
      instance:
        default: api
        description: Your specific Domo instance name (e.g., mycompany)
security:
  - developerToken: []
tags:
  - name: Documents
    description: Manage individual documents in an AppDB collection.
  - name: Collections
    description: Manage AppDB collections (schema, permissions).
  - name: App DB API (Product)
    description: Manage documents and collections in AppDB.
paths:
  /api/datastores/v1/collections/query:
    post:
      tags:
        - App DB API (Product)
      summary: Query Collections
      description: >-
        Filter and sort collections using field-level predicates with
        pagination.
      parameters:
        - name: ownedBy
          in: query
          required: false
          schema:
            type: boolean
            default: true
          description: Include a summary of collections grouped by owner in the response.
        - name: createdOn
          in: query
          required: false
          schema:
            type: boolean
            default: true
          description: >-
            Include a summary of collections grouped by creation date in the
            response.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                collectionFilteringList:
                  type: array
                  items:
                    type: object
                    properties:
                      filterType:
                        type: string
                        enum:
                          - datastorename
                          - ownedby
                          - createddate
                          - nameof
                        description: >-
                          `datastorename` — filter by the app/card name.
                          `ownedby` — filter by owner user ID. `createddate` —
                          filter by creation date. `nameof` — filter by
                          collection name.
                      not:
                        type: boolean
                        nullable: true
                        description: >-
                          When true, inverts the filter (supported for
                          `ownedby`, `createddate` with `on`, and `nameof`).
                      comparingCriteria:
                        type: string
                        nullable: true
                        description: >-
                          Required for `createddate`. One of: `after`, `before`,
                          `on`.
                      typedValue:
                        type: string
                        description: >-
                          The value to filter on: a user ID for `ownedby`, an
                          ISO date for `createddate`, or a name string for
                          `nameof` and `datastorename`.
                sortBy:
                  type: string
                  description: >-
                    Field to sort by. One of: `documentCount`, `createdOn`,
                    `updatedOn`, `name`, `datastoreName`.
                direction:
                  type: string
                  enum:
                    - ASC
                    - DESC
                pageSize:
                  type: integer
                  default: -1
                  description: Number of results per page. Pass `-1` to return all results.
                pageNumber:
                  type: integer
                  default: -1
                  description: 1-indexed page number. Pass `-1` to return all results.
            example:
              collectionFilteringList:
                - filterType: nameof
                  typedValue: users
              sortBy: createdOn
              direction: DESC
              pageSize: 25
              pageNumber: 1
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  totalCollectionCount:
                    type: integer
                  pageSize:
                    type: integer
                  pageNumber:
                    type: integer
                  pageCount:
                    type: integer
                  collections:
                    type: array
                    items:
                      $ref: '#/components/schemas/CollectionSummary'
                  ownedBy:
                    type: array
                    description: >-
                      Aggregate of collections grouped by owner. Present when
                      the `ownedBy` query parameter is true (default).
                    items:
                      type: object
                      properties:
                        ownerId:
                          type: string
                        ownerName:
                          type: string
                        collectionCount:
                          type: integer
                  createdOn:
                    type: object
                    description: >-
                      Aggregate of collections grouped by creation date. Present
                      when the `createdOn` query parameter is true (default).
                    properties:
                      sevenDaysAgo:
                        type: integer
                      fifteenDaysAgo:
                        type: integer
                      thirtyDaysAgo:
                        type: integer
              example:
                totalCollectionCount: 1
                pageSize: 1
                pageNumber: 1
                pageCount: 1
                collections:
                  - id: 232e6d6c-46e9-49b6-a137-8933f0f05999
                    owner: 870010733
                    name: users
                    syncEnabled: true
                    createdOn: '2024-01-15T18:42:30.115Z'
                    updatedOn: '2024-01-15T18:42:30.115Z'
                    documentCount: 42
                    datastoreId: 39b88a97-8247-4c0d-ba1d-8ed78d1a6680
                    datastoreName: My App Datastore
                ownedBy:
                  - ownerId: '870010733'
                    ownerName: Jane Smith
                    collectionCount: 1
                createdOn:
                  sevenDaysAgo: 0
                  fifteenDaysAgo: 1
                  thirtyDaysAgo: 1
components:
  schemas:
    CollectionSummary:
      type: object
      description: Simplified collection object returned by Query Collections.
      properties:
        id:
          type: string
          format: uuid
        owner:
          type: integer
          description: >-
            Numeric user ID of the collection owner. Note: Collection and
            Datastore owner fields are always integers; Document owner fields
            differ by endpoint version (see Document schema).
        name:
          type: string
        syncEnabled:
          type: boolean
        createdOn:
          type: string
          format: date-time
        updatedOn:
          type: string
          format: date-time
        documentCount:
          type: integer
          description: Number of documents in the collection.
        datastoreId:
          type: string
          format: uuid
        datastoreName:
          type: string
  securitySchemes:
    developerToken:
      type: apiKey
      in: header
      name: X-DOMO-Developer-Token
      description: Domo Developer Token for authentication.

````