openapi: 3.0.1
info:
  title: Querying API
  description: >
    Use the Querying API to fetch multiple pages of search results sequentially.
    This REST API lets you to retrieve entities that match a specific criteria.
    <br> <br> The <b>Try it</b> functionality available from the API
    documentation lets you explore API endpoints and make calls directly from
    the documentation.

     ## Authentication

     To use the <b>Try it</b> feature of the Querying API, you need:

      - The URL of your Content Hub server. You can get this from your Content Hub Administrator. Enter this URL in the <b>{{server}}</b> variable by hovering over the variable in the <b>Try it</b> pane and then clicking <b>Edit</b>.
      - An [access token and the client ID](https://doc.sitecore.com/ch/en/developers/cloud-dev/oauth-tokens.html#making-requests). Both are sent with every request. You can create a token through the [Content Hub interface](https://doc.sitecore.com/ch/en/users/content-hub/create-an-oauth-client.html)  or by [requesting one to the API itself](https://doc.sitecore.com/ch/en/developers/cloud-dev/oauth-tokens.html#grant-flows)
  version: v1.0
  x-metadata:
    product: Content Hub
  license:
    name: closed source
    url: https://www.sitecore.com
servers:
  - url: https://{server}
    variables:
      server:
        default: your-server
security:
  - oauth2: []
tags:
  - name: Querying
    description: >-
      Use the Querying API to fetch multiple pages of search results
      sequentially.
paths:
  /api/entities/searchAfter:
    get:
      tags:
        - Querying
      summary: Retrieve a list of entities based on a search query
      description: >-
        Lists all entities that match the criteria. This endpoint supports
        sorted pagination using the `search_after` parameter.
      operationId: EntitiesBySearchAfter
      parameters:
        - name: query
          in: query
          description: The search query.
          required: true
          schema:
            type: string
          example: Definition.Name == 'M.Asset'
        - name: take
          in: query
          description: >-
            The number of items to take. If not specified, a default value is
            used.
          schema:
            type: integer
            format: int32
          example: 25
        - name: members
          in: query
          description: Indicates how resulting entities should be loaded.
          schema:
            type: string
          example: Title,Filename
        - name: renditions
          in: query
          description: The renditions that will be loaded with the resulted entities.
          schema:
            type: string
        - name: culture
          in: query
          description: The user's culture.
          schema:
            type: string
          example: en-us
        - name: sort
          in: query
          description: Defines how the results should be sorted.
          schema:
            type: string
          example: created_on
        - name: order
          in: query
          description: Defines the results sort order.
          schema:
            type: string
          example: desc
        - name: sortCulture
          in: query
          description: The sort's culture.
          schema:
            type: string
          example: en-us
        - name: searchAfter
          in: query
          description: >-
            To retrieve the next page of results using a set of sort values from
            the previous results. For example, if you make a request and receive
            100 results, ending with entity_id_1, your subsequent query can
            include search_after=entity_id_1 to fetch the next page.
          schema:
            type: array
            items:
              type: string
        - name: nestedRelations
          in: query
          description: The nested relations that are loaded with the resulting entities.
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntityCollectionResource'
        '400':
          description: Request not valid
        '401':
          description: Unauthorized request or invalid access token
      security:
        - oauth2: []
components:
  schemas:
    EntityCollectionResource:
      type: object
      properties:
        last_hit_data:
          type: array
          items:
            type: string
          description: >-
            The last returned results, which are used to fetch the next page of
            results.
          nullable: true
        items:
          type: array
          items:
            $ref: '#/components/schemas/EntityResource'
          description: Gets or sets the list of items.
          nullable: true
        total_items:
          type: integer
          description: Gets or sets the total number of items.
          format: int64
          nullable: true
        returned_items:
          type: integer
          description: Gets or sets the number of returned items.
          format: int64
          nullable: true
        offset:
          type: integer
          description: Gets or sets the offset of the items.
          format: int32
          nullable: true
        next:
          $ref: '#/components/schemas/Link'
        previous:
          $ref: '#/components/schemas/Link'
        identifier:
          type: string
          description: Gets or sets the identifier of the resource.
          nullable: true
        self:
          $ref: '#/components/schemas/Link'
      additionalProperties: {}
      description: Collection of entities resulted of a query
    EntityResource:
      type: object
      properties:
        id:
          type: integer
          description: The ID for the entity, for example `39752`.
          format: int64
        identifier:
          type: string
          description: The identifier for the entity.
          nullable: true
        cultures:
          type: array
          items:
            type: string
          description: The cultures associated with the entity, for example `en-US`.
          nullable: true
        properties:
          type: object
          additionalProperties:
            type: object
            nullable: true
          description: The properties of the entity.
          nullable: true
        relations:
          type: object
          additionalProperties:
            type: object
            nullable: true
          description: The relations of the entity.
          nullable: true
        created_by:
          $ref: '#/components/schemas/Link'
        created_on:
          type: string
          description: The date and time when the entity was created.
          format: date-time
        modified_by:
          $ref: '#/components/schemas/Link'
        modified_on:
          type: string
          description: The date and time when the entity was last modified.
          format: date-time
        locked_by:
          $ref: '#/components/schemas/Link'
        locked_on:
          type: string
          description: The date and time when the entity was locked.
          format: date-time
          nullable: true
        entitydefinition:
          $ref: '#/components/schemas/Link'
        copy:
          $ref: '#/components/schemas/Link'
        copyasync:
          $ref: '#/components/schemas/Link'
        permissions:
          $ref: '#/components/schemas/Link'
        requested_permissions:
          type: object
          additionalProperties:
            type: boolean
            nullable: true
          description: >-
            The requested permissions with identification if a certain user has
            the permission.
          nullable: true
        lifecycle:
          $ref: '#/components/schemas/Link'
        saved_selections:
          $ref: '#/components/schemas/Link'
        roles:
          $ref: '#/components/schemas/Link'
        annotations:
          $ref: '#/components/schemas/Link'
        is_root_taxonomy_item:
          type: boolean
          description: >-
            Gets or sets a value indicating whether the entity is a root
            taxonomy item.
          nullable: true
        is_path_root:
          type: boolean
          description: Gets or sets a value indicating whether the entity is a path root.
          nullable: true
        inherits_security:
          type: boolean
          description: >-
            Gets or sets a value indicating whether the entity inherits
            security.
        is_system_owned:
          type: boolean
          description: Gets or sets a value indicating whether the entity is system owned.
        version:
          type: integer
          description: The version of the entity.
          format: int64
        full:
          $ref: '#/components/schemas/Link'
        modules:
          type: array
          items:
            type: string
          description: The modules associated with the entity.
          nullable: true
        self:
          $ref: '#/components/schemas/Link'
      additionalProperties: {}
      description: >-
        Represents an entity resource with various properties, relations and
        metadata.
    Link:
      type: object
      properties:
        href:
          type: string
          description: >-
            Gets or sets the URI that points to the resource this link refers
            to.
          nullable: true
        filename_properties:
          type: array
          items:
            type: string
          description: >-
            Gets or sets the URI that points to the resource this link refers
            to.
          nullable: true
        title:
          type: string
          description: Gets or sets the title that describes this link.
          nullable: true
        templated:
          type: boolean
          description: >-
            Gets or sets a value indicating whether the contained URI is a
            template.
          default: false
      additionalProperties: false
      description: Represents a link to a resource.
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /oauth/token
          scopes: {}
        authorizationCode:
          authorizationUrl: /oauth/authorize
          tokenUrl: /oauth/token
          scopes: {}
