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

# Search

> [DEPRECATED] Search across knowledge. Use /search/ai for AI-powered generative search or /search/tree for merged context tree results.



## OpenAPI

````yaml get /search
openapi: 3.0.3
info:
  version: 0.1.1
  title: Datagrid API
  description: Datagrid API
servers:
  - url: https://api.datagrid.com/v1
security:
  - BearerAuth: []
paths:
  /search:
    get:
      tags:
        - Search
      summary: Search
      description: >-
        [DEPRECATED] Search across knowledge. Use /search/ai for AI-powered
        generative search or /search/tree for merged context tree results.
      operationId: search
      parameters:
        - name: query
          in: query
          required: true
          schema:
            type: string
            minLength: 1
          description: >-
            The search query to run against knowledge. Must contain at least one
            non-whitespace character after trimming.
        - name: knowledge_ids
          description: Optional list of knowledge IDs to scope the search to.
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
        - name: record_types
          description: Filter results by record type in the vector database.
          in: query
          required: false
          schema:
            type: array
            items:
              $ref: '#/components/schemas/SearchRecordType'
        - $ref: '#/components/parameters/next'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResult'
        '400':
          description: >-
            Bad request. The search query must contain at least one
            non-whitespace character.
        '402':
          description: >-
            Credit limit exceeded. The organization does not have enough credits
            to perform this search. Check your billing status and add credits to
            your account.
        '429':
          description: >-
            Rate limit exceeded. The request has been throttled because the rate
            limit for this endpoint has been reached. Check the `Retry-After`
            response header and retry after the specified number of seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
      deprecated: true
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Datagrid from 'datagrid-ai';

            const client = new Datagrid({
              apiKey: process.env['DATAGRID_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.search.search({ query: 'x' });

            console.log(response.credits);
        - lang: Python
          source: |-
            import os
            from datagrid_ai import Datagrid

            client = Datagrid(
                api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
            )
            response = client.search.search(
                query="x",
            )
            print(response.credits)
components:
  schemas:
    SearchRecordType:
      type: string
      description: The record type in the vector database.
      enum:
        - rows
        - tables
        - files
        - pages
        - cells
    SearchResult:
      type: object
      required:
        - object
        - data
        - credits
      properties:
        object:
          type: string
          enum:
            - list
        data:
          type: array
          items:
            $ref: '#/components/schemas/SearchResultItem'
          description: An array containing the found search items.
        credits:
          nullable: true
          description: >-
            Credit consumption for this search. When present, `consumed`
            reflects the actual variable cost of the retrieval work performed
            for this request. `null` when the billing write fails or the request
            is aborted before billing completes.
          allOf:
            - $ref: '#/components/schemas/OperationCredits'
    RateLimitError:
      type: object
      description: >-
        Returned when the rate limit is exceeded. Rate limits are enforced per
        teamspace, endpoint path, and HTTP method over a 60-second sliding
        window. Each endpoint may have its own limit — check the
        X-RateLimit-Limit response header for the effective value.
      required:
        - error
        - message
        - retryable
        - status_code
      properties:
        status_code:
          type: integer
          description: The HTTP status code (429).
        statusCode:
          type: integer
          deprecated: true
          description: Deprecated. Use status_code instead.
        error:
          type: string
          enum:
            - rate_limit_exceeded
          description: The error code identifying this as a rate limit error.
        message:
          type: string
          description: A human-readable error message.
        mitigation:
          type: string
          description: Suggested action to resolve the error.
        retryable:
          type: boolean
          description: Whether the request can be retried after a delay.
        details:
          type: object
          properties:
            reason:
              type: string
              description: A detailed explanation of why the rate limit was exceeded.
    SearchResultItem:
      type: object
      required:
        - object
        - score
        - updated_at
        - content
        - resource
      properties:
        object:
          type: string
          enum:
            - search_result_item
          description: The object type, which is always `search_result_item`.
        score:
          type: number
          description: The score of the item, between 0 and 1.
        updated_at:
          type: string
          format: date-time
          description: The date and time the item was last updated.
        title:
          type: string
          description: The title of the item.
        summary:
          type: string
          description: The summary of the item.
        content:
          type: array
          items:
            type: string
          description: Text snippets relevant to the search query.
        resource:
          $ref: '#/components/schemas/SearchResultResource'
          description: The resource that matched the search query.
    OperationCredits:
      type: object
      required:
        - consumed
      properties:
        consumed:
          type: number
          description: The number of credits consumed by the operation.
    SearchResultResource:
      oneOf:
        - $ref: '#/components/schemas/KnowledgeMetadata'
        - $ref: '#/components/schemas/TableMetadata'
        - $ref: '#/components/schemas/RowMetadata'
        - $ref: '#/components/schemas/AttachmentMetadata'
        - $ref: '#/components/schemas/MessageMetadata'
    KnowledgeMetadata:
      type: object
      description: Represents metadata for a knowledge object
      required:
        - object
        - id
        - name
        - navigation_item
        - url
      properties:
        object:
          type: string
          enum:
            - knowledge_metadata
          description: The object type, which is always `knowledge_metadata`.
        id:
          type: string
          description: The unique identifier of the knowledge.
        name:
          type: string
          description: The name of the knowledge.
        navigation_item:
          $ref: '#/components/schemas/NavigationItemMetadata'
          description: The navigation item of the knowledge.
        url:
          type: string
          description: The url of the knowledge.
    TableMetadata:
      type: object
      description: Represents metadata for a table in a knowledge object
      required:
        - object
        - id
        - name
        - knowledge
        - url
      properties:
        object:
          type: string
          enum:
            - table_metadata
          description: The object type, which is always `table_metadata`.
        id:
          type: string
          description: The unique identifier for the table.
        name:
          type: string
          description: The name of the table.
        knowledge:
          $ref: '#/components/schemas/KnowledgeMetadata'
          description: The knowledge object that the table belongs to.
        url:
          type: string
          description: The url of the table.
    RowMetadata:
      type: object
      description: Metadata of a row in a table
      required:
        - object
        - id
        - table
        - url
      properties:
        object:
          type: string
          enum:
            - row_metadata
          description: The object type, which is always `row_metadata`.
        id:
          type: string
          description: The id of the row (__datagrid__uuid), unique within the table.
        table:
          $ref: '#/components/schemas/TableMetadata'
          description: The table that the row belongs to.
        url:
          type: string
          description: The url of the row of the table.
    AttachmentMetadata:
      type: object
      description: Metadata of an attachment object
      required:
        - object
        - media_type
        - name
        - source
        - url
      properties:
        object:
          type: string
          enum:
            - attachment_metadata
          description: The object type, which is always `attachment_metadata`.
        name:
          type: string
          description: The name of the attachment.
        media_type:
          type: string
          description: The media type of the attachment.
        url:
          type: string
          description: The url of the blob of the attachment.
        data_lake_item_id:
          type: string
          description: >-
            The data lake item ID of the attachment, used to generate fresh
            signed URLs.
        page:
          type: object
          required:
            - page_number
            - url
            - pageNumber
          properties:
            page_number:
              type: number
              description: The page number of the attachment.
            url:
              type: string
              description: The url of the blob of the page.
            pageNumber:
              type: number
              description: DEPRECATED use page_number instead.
              deprecated: true
              x-stainless-naming:
                python:
                  property_name: page_number_deprecated
        source:
          oneOf:
            - $ref: '#/components/schemas/MessageMetadata'
            - $ref: '#/components/schemas/RowMetadata'
          description: The source of the attachment.
    MessageMetadata:
      type: object
      description: Metadata of a conversation message object
      required:
        - object
        - conversation
        - id
        - author_id
        - author_type
        - url
      properties:
        object:
          type: string
          enum:
            - message_metadata
          description: The object type, which is always `message_metadata`.
        conversation:
          $ref: '#/components/schemas/ConversationMetadata'
          description: The conversation that the message belongs to.
        id:
          type: string
          description: The id of the message.
        author_id:
          type: string
          description: The identifier of the message author (either a user ID or agent ID).
        author_type:
          type: string
          enum:
            - user
            - agent
          description: Indicates whether the author is a user or an agent.
        author_name:
          type: string
          description: The pretty name of the author of the message.
        url:
          type: string
          description: The url of the message.
    NavigationItemMetadata:
      type: object
      description: Metadata of a navigation item object
      required:
        - object
        - id
        - name
        - url
        - item_type
      properties:
        object:
          type: string
          enum:
            - navigation_item_metadata
          description: The object type, which is always `navigation_item_metadata`.
        id:
          type: string
          description: The id of the navigation item.
        name:
          type: string
          description: The name of the navigation item.
        emoticon:
          type: string
          description: The emoticon of the navigation item.
        source_media_type:
          type: string
          description: The media type of the navigation item if known.
        item_type:
          type: string
          description: The type of the navigation item.
        url:
          type: string
          description: The url of the navigation item.
    ConversationMetadata:
      type: object
      description: Metadata of a conversation object
      required:
        - object
        - id
        - url
        - name
        - navigation_item
      properties:
        object:
          type: string
          enum:
            - conversation_metadata
          description: The object type, which is always `conversation_metadata`.
        id:
          type: string
          description: The id of the conversation.
        url:
          type: string
          description: The url of the conversation.
        navigation_item:
          $ref: '#/components/schemas/NavigationItemMetadata'
          description: The navigation item of the conversation.
        name:
          type: string
          description: The name of the conversation.
  parameters:
    next:
      name: next
      in: query
      schema:
        type: string
      required: false
      description: >-
        A cursor to use in pagination to continue a query from the previous
        request. This is automatically added when the request has more results
        to fetch.
    limit:
      name: limit
      in: query
      schema:
        type: integer
        default: 50
        minimum: 1
        maximum: 100
      required: false
      description: The limit on the number of objects to return, ranging between 1 and 100.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````