> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.eyelevel.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.eyelevel.ai/_mcp/server.

# search.documents

POST https://api.groundx.ai/api/v1/search/documents
Content-Type: application/json

Search the specified document IDs for information relevant to a query. Use result.search.text as context for a language model and result.search.results for matching text and citations.

Reference: https://docs.eyelevel.ai/reference/api-reference/search/documents

## Authentication

- `X-API-Key` header (required) — API Key authentication via header

## Request

### Query parameters

- `n` (integer, optional, default: 20) — The maximum number of returned search results. Accepts 1-100 with a default of 20.
- `nextToken` (string, optional) — Pass nextToken from the previous response to get the next page of up to n search results.
- `verbosity` (integer, optional) — Response detail: 0 returns only recommended context; 1 adds search results without searchData; 2 includes searchData.

### Body (application/json)

This endpoint expects a SearchDocumentsRequest.

- `query` (string, required, default: my search query) — Search query.
- `documentIds` (list of string, required) — An array of unique documentIds to be searched.
- `filter` (SearchDocumentsRequestFilter, optional) — Key-value metadata used to filter documents before searching.
- `relevance` (double, optional, default: 10) — The minimum search relevance score required to include the result. By default, this is 10.0.

## Response

### 200

Search query success

- `search` (SearchResponseSearch, required)

## Errors

### 400 Bad Request Error

Invalid request data

- `any`

### 401 Unauthorized Error

Unauthorized to access resource with given ID

- `any`

## Types

### SearchDocumentsRequestFilter

Key-value metadata used to filter documents before searching.

### SearchResponseSearch

- `count` (integer, optional) — Total results
- `results` (list of SearchResultItem, optional) — Search results
- `query` (string, optional) — The original search request query
- `score` (double, optional) — Confidence score in the search results
- `searchQuery` (string, optional) — The actual search query, if the search request query was re-written
- `text` (string, optional) — Suggested context for LLM completion
- `nextToken` (string, optional) — For paginated results

### SearchResultItem

- `boundingBoxes` (list of BoundingBoxDetail, optional) — Coordinates corresponding to the areas of the document where the chunk appears
- `bucketId` (integer, optional) — Content bucket the search result belongs to
- `chunkId` (string, optional) — Unique system generated ID for the chunk
- `documentId` (string, optional) — Unique system generated ID for the document
- `fileName` (string, optional) — Name of ingested file
- `fileSummary` (string, optional) — System-generated summary of the source document
- `multimodalUrl` (string, optional) — Image of a table or figure. Protected images use storage-signed links that expire within the applied policy time limit. Keep documentId and chunkId; use documents.fileLink with a crop selector to refresh the link. Public stable links do not expire.
- `pageImages` (list of string, optional) — Page image URLs for this chunk. Protected images use storage-signed links that expire within the applied policy time limit. Keep documentId and the page number; use documents.fileLink with a page selector to refresh the link. Public stable links do not expire.
- `pages` (list of SearchResultItemPagesItems, optional)
- `processId` (string, optional) — Unique system generated ID for the ingest process that included this document
- `score` (double, optional) — Confidence score in the search result
- `searchData` (SearchResultItemSearchData, optional) — Document, section, and chunk search data, both custom and system-generated
- `sectionSummary` (string, optional) — System-generated summary of the document section containing this result
- `sourceUrl` (string, optional) — Source document URL. Protected GroundX-hosted sources use storage-signed links that expire within the applied policy time limit. Keep documentId; use documents.fileLink with a source selector to refresh the link. Public stable links do not expire.
- `suggestedText` (string, optional) — System-generated text, re-written for LLM completions
- `text` (string, optional) — Original text from the source document

### BoundingBoxDetail

- `bottomRightX` (double, optional) — The x coordinate of the lower right corner of the bounding box
- `bottomRightY` (double, optional) — The y coordinate of the lower right corner of the bounding box
- `pageNumber` (integer, optional) — The page number the bounding box appears on, using a 1-based array indexing (starts with page 1, not page 0)
- `topLeftX` (double, optional) — The x coordinate of the upper left corner of the bounding box
- `topLeftY` (double, optional) — The y coordinate of the upper left corner of the bounding box

### SearchResultItemPagesItems

- `height` (double, optional) — The height of the page image
- `imageUrl` (string, optional) — JPEG of the page containing this chunk. Protected images use storage-signed links that expire within the applied policy time limit. Keep documentId and this page number; use documents.fileLink with a page selector to refresh the link. Public stable links do not expire.
- `number` (double, optional) — The page number
- `width` (double, optional) — The width of the page image

### SearchResultItemSearchData

Document, section, and chunk search data, both custom and system-generated

## Examples

**Request**

```json
{
  "query": "my search query",
  "documentIds": [
    "docUUID1",
    "docUUID2"
  ]
}
```

**Response**

```json
{
  "search": {
    "count": 1,
    "results": [
      {
        "boundingBoxes": [
          {
            "bottomRightX": 1.1,
            "bottomRightY": 1.1,
            "pageNumber": 1,
            "topLeftX": 1.1,
            "topLeftY": 1.1
          }
        ],
        "bucketId": 1,
        "chunkId": "string",
        "documentId": "string",
        "fileName": "string",
        "fileSummary": "string",
        "multimodalUrl": "string",
        "pageImages": [
          "string"
        ],
        "pages": [
          {
            "height": 1.1,
            "imageUrl": "string",
            "number": 1.1,
            "width": 1.1
          }
        ],
        "processId": "string",
        "score": 1.1,
        "searchData": {},
        "sectionSummary": "string",
        "sourceUrl": "string",
        "suggestedText": "string",
        "text": "string"
      }
    ],
    "query": "string",
    "score": 1.1,
    "searchQuery": "string",
    "text": "string",
    "nextToken": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.groundx.ai/api/v1/search/documents"

payload = {
    "query": "my search query",
    "documentIds": ["docUUID1", "docUUID2"]
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.groundx.ai/api/v1/search/documents';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"query":"my search query","documentIds":["docUUID1","docUUID2"]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.groundx.ai/api/v1/search/documents"

	payload := strings.NewReader("{\n  \"query\": \"my search query\",\n  \"documentIds\": [\n    \"docUUID1\",\n    \"docUUID2\"\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.groundx.ai/api/v1/search/documents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"query\": \"my search query\",\n  \"documentIds\": [\n    \"docUUID1\",\n    \"docUUID2\"\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.groundx.ai/api/v1/search/documents")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"query\": \"my search query\",\n  \"documentIds\": [\n    \"docUUID1\",\n    \"docUUID2\"\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.groundx.ai/api/v1/search/documents', [
  'body' => '{
  "query": "my search query",
  "documentIds": [
    "docUUID1",
    "docUUID2"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.groundx.ai/api/v1/search/documents");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"query\": \"my search query\",\n  \"documentIds\": [\n    \"docUUID1\",\n    \"docUUID2\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "query": "my search query",
  "documentIds": ["docUUID1", "docUUID2"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.groundx.ai/api/v1/search/documents")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```