---
title: "search.documents"
method: POST
path: "/v1/search/documents"
tags: ["Search"]
---

# search.documents

`POST /v1/search/documents`

Search documents on GroundX for the most relevant information to a given query by documentId(s).

The result of this query is typically used in one of two ways; result['search']['text'] can be used to provide context to a language model, facilitating RAG, or result['search']['results'] can be used to observe chunks of text which are relevant to the query, facilitating citation.

Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.

## Query parameters

- `n` integer
- `nextToken` string
- `verbosity` integer

## Request body

- SearchDocumentsRequest
  - `query` string, required — The search query to be used to find relevant documentation.
  - `documentIds` string[], required — An array of unique documentIds to be searched.
  - `relevance` number, float — The minimum search relevance score required to include the result. By default, this is 10.0.

## Response `200`

Search query success

- SearchResponse
  - `search` object, required
    - `count` integer — Total results
    - `results` SearchResultItem[] — Search results
      - `boundingBoxes` BoundingBoxDetail[] — Coordinates corresponding to the areas of the document where the chunk appears
        - `bottomRightX` number — The x coordinate of the lower right corner of the bounding box
        - `bottomRightY` number — The y coordinate of the lower right corner of the bounding box
        - `pageNumber` integer — The page number the bounding box appears on, using a 1-based array indexing (starts with page 1, not page 0)
        - `topLeftX` number — The x coordinate of the upper left corner of the bounding box
        - `topLeftY` number — The y coordinate of the upper left corner of the bounding box
      - `bucketId` integer — Content bucket the search result belongs to
      - `chunkId` string — Unique system generated ID for the chunk
      - `documentId` string, uuid — Unique system generated ID for the document
      - `fileName` string — Name of ingested file
      - `multimodalUrl` string, uri — An image clipping of the table or figure object from the document
      - `pageImages` string[]
      - `score` number — Confidence score in the search result
      - `searchData` object — Document, section, and chunk search data, both custom and system-generated
      - `sourceUrl` string, uri — Source document URL
      - `suggestedText` string — System-generated text, re-written for LLM completions
      - `text` string — Original text from the source document
    - `query` string — The original search request query
    - `score` number — Confidence score in the search results
    - `searchQuery` string — The actual search query, if the search request query was re-written
    - `text` string — Suggested context for LLM completion
    - `nextToken` string — For paginated results

## Other responses

- `400` — Invalid request data
- `401` — Unauthorized to access resource with given ID

---

[API](https://skmtc.net/groundxai/apis/groundx-apis.md) · [All operations](https://skmtc.net/groundxai/apis/groundx-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/groundxai/groundx-apis/versions/1c1a5c17f52f/schema)
