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

# Multi query items

> The Query API is used to query items in an index, with this endpoint up to 5 queries can be requested in a single payload, each query defining the index to perform the lookup in.




## OpenAPI

````yaml /enterspeed/enterspeedv1Api.yaml post /v1
openapi: 3.0.0
info:
  version: 0.4.0
  title: API documentation
  description: >-
    The Enterspeed API are based on REST principles.


    Before you start you will need to [create an
    Enterspeed-account](https://app.enterspeed.com) and set up a tenant (a
    property for your website). Here you can create

    - A data source (provides you with an API key for the **Ingest API**).

    - An environment client (provides you with an API key for the **Delivery
    API** and **Query API**).

    - A domain (ensure the correct data gets fetched).


    🎉 Have fun using our API. Make sure to [contact
    us](https://www.enterspeed.com/contact) if you need any help. We're happy
    assist!
  x-logo:
    url: https://docs.enterspeed.com/img/logo.svg
    altText: Enterspeed Logo
  license:
    name: See Enterspeed Terms of service
    url: https://www.enterspeed.com/terms-of-service
servers:
  - url: https://api.enterspeed.com
    description: General API
security: []
tags:
  - name: Delivery
    description: >-
      The Delivery API is what you use to `GET` your data from Enterspeed to
      your frontend project. Before you can fetch your content from Enterspeed,
      you first need to create an **Environment client** which generates an API
      key. This is done under *Settings --> Environment settings*.


      You can find an example of how to fetch data [Umbraco & Next.js
      tutorial](https://docs.enterspeed.com/tutorials/umbraco-nextjs/fetching-data-in-nextjs).
  - name: Ingest
    description: >-
      The Ingest API is used to `POST` your current data sources into
      Enterspeed. Before you can start ingesting data, you'll need to create a
      **Data source** inside Enterspeed, which generates an API key. This is
      done under *Settings --> Data sources*.


      The Ingest API can also be used to `DELETE` already ingested data from
      Enterspeed.
  - name: Routes
    description: >-
      The Routes API is what you use to `GET` all available URL routes for a
      specific environment, which can be helpful for SSG (Static Site
      Generation) or creating a sitemap.


      Before you can fetch your routes from Enterspeed, you first need to create
      an **Environment client** which generates an API key. This is done under
      *Settings --> Environment settings*.


      **ℹ NOTE:** The `first` or `last` parameter is required and must be set
      between 100 - 500 (e.g. `first=250`). Both are not allowed at the same
      time.
  - name: Query
    description: >-
      The Query API is what you use to query items from your indexes.


      Before you can query your indexes from Enterspeed, you first need to
      create an **Environment client** which generates an API key. This is done
      under *Settings --> Environment settings*.
paths:
  /v1:
    servers:
      - url: https://query.enterspeed.com
        description: Query API
    post:
      tags:
        - Query
      summary: Multi query items
      description: >
        The Query API is used to query items in an index, with this endpoint up
        to 5 queries can be requested in a single payload, each query defining
        the index to perform the lookup in.
      operationId: queryMultiContentPost
      parameters:
        - name: X-Api-Key
          required: true
          in: header
          description: Api key to validate your environment.
          schema:
            type: string
            example: environment-1637c4d0-e878-4738-b866-152106a4f88c
        - name: Content-Length
          required: true
          in: header
          description: >
            The length of the message body, in bytes (this header is
            automatically added by most clients).
          schema:
            type: number
      requestBody:
        description: >
          The query consists of a list of query objects, on the format just like
          when quering items in a single index, so refer to this section when
          looking into `filters`, `sorting`, `pagination` etc.


          The only thing that differs with these query objects, is an addition
          of an `index` and a `name` field, so you per query can define which
          index you want to perform the query against and also name the
          individual query. This means that this service can perform multiple
          queries on the same index, or perform queries on multiple indicies in
          one request, and also give you the ability to name queries for easier
          identification of the resulting result sets.


          ### Note

          The request payload can at most take 5 queries in one request.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRequestList'
      responses:
        '200':
          description: >
            When one or more queries results in a valid response a 200 response
            is returned.

            If any of the other requested queries fails, either due to
            validation errors or other issues, the error message will be
            returned as part of the response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResponseExtendedList'
                type: object
        '400':
          description: >-
            Invalid request. Server responded but the request was in an invalid
            format.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query400ExtendedResponseList'
        '401':
          description: Unauthorized. Missing X-Api-Key header or the X-Api-Key is invalid.
        '403':
          description: Forbidden. The API key does not have the necessary permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Query403Response'
components:
  schemas:
    QueryRequestList:
      type: array
      description: >-
        List consisting of multiple queries using the extended query object
        format.
      items:
        $ref: '#/components/schemas/QueryRequestExtendedBody'
      example:
        - index: products
          name: productData
          filters:
            and:
              - field: title
                operator: contains
                value: '*hoodie*'
                caseInsensitive: true
              - or:
                  - field: isInStock
                    operator: equals
                    value: true
                  - field: allowPreorder
                    operator: equals
                    value: true
          aliases:
            - productTile
          facets:
            - name: Categories
              field: category
              size: 20
            - name: In Stock
              field: isInStock
          sort:
            - field: price
              order: asc
          pagination:
            page: 0
            pageSize: 20
        - index: products
          name: facets
          facets:
            - name: Categories
              field: category
              size: 20
            - name: In Stock
              field: isInStock
          pagination:
            pageSize: 0
    QueryResponseExtendedList:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/QueryResponseExtended'
          - $ref: '#/components/schemas/Query400Response'
          - $ref: '#/components/schemas/Query400ResponseExtended'
          - $ref: '#/components/schemas/Query403ResponseExtended'
    Query400ExtendedResponseList:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/Query400Response'
          - $ref: '#/components/schemas/Query400ResponseExtended'
    Query403Response:
      type: object
      properties:
        error:
          type: string
          example: Forbidden
    QueryRequestExtendedBody:
      type: object
      example:
        index: products
        name: productData
        filters:
          and:
            - field: title
              operator: contains
              value: '*hoodie*'
              caseInsensitive: true
            - or:
                - field: isInStock
                  operator: equals
                  value: true
                - field: allowPreorder
                  operator: equals
                  value: true
        aliases:
          - productTile
        facets:
          - name: Categories
            field: category
            size: 20
          - name: In Stock
            field: isInStock
        sort:
          - field: price
            order: asc
        pagination:
          page: 0
          pageSize: 20
    QueryResponseExtended:
      type: object
      properties:
        status:
          type: number
          example: 0
        index:
          type: string
          example: products
          description: The index name which were given for the query in the request.
        name:
          type: string
          example: productData
          description: The query name which were given for the query in the request.
        totalResults:
          type: number
          example: 200
          description: The total number of results matched by query.
        results:
          type: array
          description: |
            List of items from the index matched by the query provided.

            Built in fields are prefixed with underscore (`_`).
          items:
            type: object
            example:
              sku: p-5427
              name: Running shoe
              url: /products/running-shoe/
              _originId: p-5427
              _sourceGuid: 9f741916-19e3-4791-9ebd-701634ba9b75
              _updatedAt: '2025-01-07T08:43:15.7351089Z'
              _views:
                productTile:
                  sku: p-5427
                  name: Running shoe
                  url: /products/running-shoe/
                  image: /media/running-shoe.webp
                  shortDescription: My short description of the product
                  price: 199.99
        facets:
          type: array
          description: List of aggregated field values based on the requested facet fields.
          items:
            type: object
            example:
              name: Categories
              field: category
              groups:
                - value: Caps
                  count: 8
                - value: Hoodies
                  count: 2
              isValid: true
        nextPageToken:
          type: string
          nullable: true
          description: >-
            Continuation token for the next page of results. Pass this value in
            the `pagination.nextPageToken` field of the next request. `null`
            when no further results exist.
          example: WyIyMDI0LTAxLTAxIiwiYWJjMTIzIl0=
    Query400Response:
      type: object
      properties:
        message:
          type: string
          description: Erros message
          example: Query is not valid
        errors:
          type: array
          description: List of errors
          items:
            type: string
            example: 'Operator not implemented: equal'
        status:
          type: number
          example: 0
    Query400ResponseExtended:
      type: object
      properties:
        index:
          type: string
          example: products
          description: The index name which were given for the query in the request.
        name:
          type: string
          example: productData
          description: The query name which were given for the query in the request.
        message:
          type: string
          description: Erros message
          example: Query is not valid
        errors:
          type: array
          description: List of errors
          items:
            type: string
            example: 'Operator not implemented: equal'
        status:
          type: number
          example: 0
    Query403ResponseExtended:
      type: object
      properties:
        index:
          type: string
          example: products
          description: The index name which were given for the query in the request.
        name:
          type: string
          example: productData
          description: The query name which were given for the query in the request.
        message:
          type: string
          description: Erros message
          example: Forbidden
        errors:
          type: array
          description: List of errors
          items:
            type: string
            example: Forbidden
        status:
          type: number
          example: 1

````