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

# Browse across a resource includes

> Browse across a given resource's includes in the data partition.

In order to initiate a browse session, you can specifiy in the body the `v1BrowseIncludesRequest` object with the following properties:
- `includes`: The list of includes to browse. It can be used to include only a relationship (e.g. `worksAt`) or a relationship and the targeted resource (e.g. `worksAt.clinic`).
- `perPage`: The number of results to return per batch. Defaults to 100.

A browse session lives for 5 minutes, after which it will be automatically closed and a 404 error will be returned if you try to continue browsing.
The session is a rolling session, meaning that each new request will extend the session by 5 minutes from the time of the request.

A browse response contains the following properties:
- `hits`: An array of results that match the browse session.
- `meta`: An object containing metadata about the browse session, including the `cursor` and the total number of results available in the browse session.

You should use the `hits` length to check if there are more results to browse.
If `hits > 0` is true, you can use the `meta.cursor` to fetch the next batch of results.
If `hits > 0` is false, it means that you have reached the end of the browse session and there are no more results to browse.




## OpenAPI

````yaml /api-reference/datapartition.yml post /partitions/{partitionKey}/v1/collections/{collectionKey}/resources/{resourceId}/browse-includes
openapi: 3.0.1
info:
  title: Data Partition API
  version: 1.0.0
servers:
  - url: https://api.{workspaceId}.clinia.cloud
    variables:
      workspaceId:
        default: ''
        description: The workspace id.
security:
  - apiKey: []
  - basicHttpAuth: []
  - bearerHttpAuth: []
tags:
  - name: Browse
    description: Browse resources or relationships in a data partition.
  - name: Resources
    description: Consumption of resources in a data partition.
  - name: Search
    description: Search for resources in a data partition.
paths:
  /partitions/{partitionKey}/v1/collections/{collectionKey}/resources/{resourceId}/browse-includes:
    post:
      tags:
        - Resources
      summary: Browse across a resource includes
      description: >
        Browse across a given resource's includes in the data partition.


        In order to initiate a browse session, you can specifiy in the body the
        `v1BrowseIncludesRequest` object with the following properties:

        - `includes`: The list of includes to browse. It can be used to include
        only a relationship (e.g. `worksAt`) or a relationship and the targeted
        resource (e.g. `worksAt.clinic`).

        - `perPage`: The number of results to return per batch. Defaults to 100.


        A browse session lives for 5 minutes, after which it will be
        automatically closed and a 404 error will be returned if you try to
        continue browsing.

        The session is a rolling session, meaning that each new request will
        extend the session by 5 minutes from the time of the request.


        A browse response contains the following properties:

        - `hits`: An array of results that match the browse session.

        - `meta`: An object containing metadata about the browse session,
        including the `cursor` and the total number of results available in the
        browse session.


        You should use the `hits` length to check if there are more results to
        browse.

        If `hits > 0` is true, you can use the `meta.cursor` to fetch the next
        batch of results.

        If `hits > 0` is false, it means that you have reached the end of the
        browse session and there are no more results to browse.
      operationId: BrowseIncludes
      parameters:
        - name: partitionKey
          in: path
          required: true
          schema:
            type: string
        - name: collectionKey
          in: path
          description: Key of the collection.
          required: true
          schema:
            type: string
        - name: resourceId
          in: path
          schema:
            type: string
          required: true
          description: The unified resource id.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1BrowseIncludesRequest'
        required: true
      responses:
        '200':
          description: >
            A successful response containing the first batch of results and a
            cursor to continue browsing.

            5 minutes after the request, the cursor will expire and a 404 error
            will be returned if you try to continue browsing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1BrowseIncludesResponse'
        '400':
          description: Returned when the request is malformed or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1Error'
        '404':
          description: >-
            Returned when the cursor is invalid or the browse session has
            expired.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1Error'
        '429':
          $ref: '#/components/responses/v1TooManyRequestError'
        '501':
          description: Returned when the requested partition is of type 'source'.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1Error'
        '504':
          $ref: '#/components/responses/v1GatewayTimeoutError'
components:
  schemas:
    v1BrowseIncludesRequest:
      type: object
      description: >
        Parameters to initiate or continue a browse includes session.

        To initiate a session, provide the list of includes to browse and
        optionally the number of results to return per page.

        To continue a session, provide the `cursor` returned from a previous
        response.
      additionalProperties: false
      properties:
        cursor:
          type: string
          description: The cursor representing the current BrowseIncludes session.
        includes:
          type: array
          description: >-
            The list of includes to browse. It can be used to include only a
            relationship (e.g. `worksAt`) or a relationship and the targeted
            resource (e.g. `worksAt.clinic`).
          items:
            type: string
        perPage:
          type: integer
          description: The number of results to return per batch. Defaults to 100.
          minimum: 1
          maximum: 1000
    v1BrowseIncludesResponse:
      type: object
      required:
        - hits
        - meta
      properties:
        hits:
          type: array
          items:
            $ref: '#/components/schemas/v1BrowseIncludesHit'
        meta:
          $ref: '#/components/schemas/v1BrowseResponseMeta'
      additionalProperties: false
    v1Error:
      type: object
      required:
        - code
        - message
        - type
      properties:
        code:
          $ref: '#/components/schemas/v1ErrorCode'
        message:
          type: string
        type:
          $ref: '#/components/schemas/v1ErrorType'
        details:
          description: list of errors that occurred if applicable.
          type: array
          items:
            $ref: '#/components/schemas/v1Error'
        additionalContext:
          type: object
          additionalProperties: true
    v1BrowseIncludesHit:
      type: object
      description: >
        A single hit for a browse includes session. Can be either a relationship
        or a relationship with the targeted resource.
      allOf:
        - $ref: '#/components/schemas/v1Relationship'
        - type: object
          properties:
            targetResource:
              $ref: '#/components/schemas/v1PartitionDomainResource'
    v1BrowseResponseMeta:
      type: object
      required:
        - cursor
        - total
      description: >
        Metadata about the browse session, including the cursor and the total
        number of results available in the browse session.
      properties:
        cursor:
          type: string
          description: The cursor to continue browsing from.
        total:
          type: integer
          format: int64
          description: The total number of results available in the browse session.
      additionalProperties: false
    v1ErrorCode:
      type: integer
      format: int32
      enum:
        - 400
        - 401
        - 403
        - 404
        - 408
        - 409
        - 413
        - 429
        - 500
        - 501
        - 504
    v1ErrorType:
      type: string
      enum:
        - ALREADY_EXISTS
        - FAILED_PRECONDITION
        - INTERNAL
        - INVALID_ARGUMENT
        - NOT_FOUND
        - OUT_OF_RANGE
        - UNIMPLEMENTED
        - PERMISSION_DENIED
        - UNAUTHENTICATED
        - CONTENT_TOO_LARGE
        - REQUEST_TIMEOUT
        - TOO_MANY_REQUEST
        - GATEWAY_TIMEOUT
    v1Relationship:
      type: object
      required:
        - id
        - type
        - from
        - to
        - data
      properties:
        id:
          readOnly: true
          allOf:
            - $ref: '#/components/schemas/v1RelationshipID'
        type:
          type: string
          readOnly: true
        from:
          $ref: '#/components/schemas/v1RelationshipRef'
        to:
          $ref: '#/components/schemas/v1RelationshipRef'
        meta:
          $ref: '#/components/schemas/v1Meta'
        data:
          type: object
          x-is-generic: true
      additionalProperties: false
    v1PartitionDomainResource:
      type: object
      allOf:
        - $ref: '#/components/schemas/v1DomainResourceBase'
        - $ref: '#/components/schemas/v1ContainedResources'
    v1RelationshipID:
      type: string
      description: |
        The unique identifier of the relationship.
        This is a key with the shape `{fromID}.{toID}`.
      pattern: ^[^.]+.[^.]+$
    v1RelationshipRef:
      type: object
      required:
        - id
        - type
      properties:
        id:
          type: string
        type:
          type: string
      additionalProperties: false
    v1Meta:
      type: object
      properties:
        createdAt:
          type: string
          description: Instant of creation of the resource.
          format: date-time
        identifier:
          type: array
          description: |
            Identifiers of the resource.
            Note: Combination of `source`, `value` and `use` must be unique.
          items:
            $ref: '#/components/schemas/v1Identifier'
        source:
          type: string
          description: The source of the resource.
          readOnly: true
        updatedAt:
          type: string
          description: Last update of the resource.
          format: date-time
      additionalProperties: false
    v1DomainResourceBase:
      required:
        - id
        - type
        - data
      type: object
      properties:
        id:
          title: The logical identifier
          type: string
          readOnly: true
        type:
          description: Type of the resource.
          type: string
          readOnly: true
        meta:
          $ref: '#/components/schemas/v1Meta'
        data:
          title: The dynamic attributes based on the resource type
          type: object
          x-is-generic: true
      additionalProperties: false
    v1ContainedResources:
      type: object
      properties:
        contained:
          description: >-
            Resources contained in this top-level resource. Contained resources
            exists only within the context of this top-level resource.
          type: object
          additionalProperties:
            type: array
            items:
              allOf:
                - $ref: '#/components/schemas/v1Resource'
      additionalProperties: false
    v1Identifier:
      description: >-
        An identifier - identifies some entity uniquely and unambiguously.
        Typically this is used for business identifiers.
      properties:
        id:
          description: >-
            Unique id for the property within a resource (for internal
            references). This may be any string value that does not contain
            spaces.
          allOf:
            - $ref: '#/components/schemas/v1Symbol'
        system:
          description: >-
            Establishes the namespace for the value - that is, a URL that
            describes a set values that are unique.
          allOf:
            - $ref: '#/components/schemas/v1Uri'
        value:
          description: >-
            The portion of the identifier typically relevant to the user and
            which is unique within the context of the system.
          allOf:
            - $ref: '#/components/schemas/v1Symbol'
        use:
          description: The purpose of this identifier.
          allOf:
            - $ref: '#/components/schemas/v1Code'
        period:
          description: Time period when identifier was/is in use.
          allOf:
            - $ref: '#/components/schemas/v1Period'
      additionalProperties: false
    v1Resource:
      required:
        - id
        - type
        - data
      type: object
      properties:
        id:
          title: The logical identifier
          type: string
        type:
          description: Type of the resource.
          type: string
        meta:
          $ref: '#/components/schemas/v1Meta'
        data:
          title: The dynamic attributes based on the resource type
          type: object
          x-is-generic: true
      additionalProperties: false
    v1Symbol:
      pattern: ^[\s\S]+$
      type: string
      description: A sequence of Unicode characters.
    v1Uri:
      pattern: ^\S*$
      type: string
      description: String of characters used to identify a name or a resource.
    v1Code:
      pattern: ^[^\s]+( [^\s]+)*$
      type: string
      description: >-
        A string which has at least one character and no leading or trailing
        whitespace and where there is no whitespace other than single spaces in
        the contents.
    v1Period:
      type: object
      description: A time period defined by a start and end date and optionally time.
      properties:
        id:
          $ref: '#/components/schemas/v1Symbol'
          description: >-
            Unique id for the property within a resource (for internal
            references). This may be any string value that does not contain
            spaces.
        start:
          $ref: '#/components/schemas/v1DateTime'
          description: The start of the period. The boundary is inclusive.
        end:
          $ref: '#/components/schemas/v1DateTime'
          description: >-
            The end of the period. If the end of the period is missing, it means
            no end was known or planned at the time the instance was created.
            The start may be in the past, and the end date in the future, which
            means that period is expected/planned to end at that time.
      additionalProperties: false
    v1DateTime:
      pattern: >-
        ^([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?)?)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)?)?)?$
      type: string
      description: >-
        A date, date-time or partial date (e.g. just year or year + month).  If
        hours and minutes are specified, a time zone SHALL be populated. The
        format is a union of the schema types gYear, gYearMonth, date and
        dateTime. Seconds must be provided due to schema type constraints but
        may be zero-filled and may be ignored. Dates SHALL be valid dates.
  responses:
    v1TooManyRequestError:
      description: Returned when the server starts throttling the requests.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/v1Error'
    v1GatewayTimeoutError:
      description: Returned when the request exceeds the server timeout window.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/v1Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Clinia-API-Key
    basicHttpAuth:
      description: Basic HTTP authentication.
      type: http
      scheme: basic
    bearerHttpAuth:
      description: JWT Bearer authentication.
      type: http
      scheme: Bearer
      bearerFormat: JWT

````