# Document Search

Search across filing documents using semantic or keyword search.

#### Endpoint

```
POST /search/documents
```

#### Parameters

| Parameter         | Type      | Required | Description                                  |
| ----------------- | --------- | -------- | -------------------------------------------- |
| query             | string    | Yes      | Search query (natural language or keywords)  |
| orbit\_entity\_id | string\[] | No       | Limit to specific companies                  |
| report\_type      | string\[] | No       | Limit to specific report types               |
| date\_range       | object    | No       | {"start": "2024-01-01", "end": "2024-12-31"} |
| search\_type      | string    | No       | semantic, keyword, hybrid (default: hybrid)  |
| limit             | integer   | No       | Max results (default: 20, max: 20)           |

#### Example Request

bash

```bash
curl -X POST "https://api.orbitfin.ai/v1/search/documents" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "artificial intelligence investments",
    "orbit_entity_id": ["ent_2vxp8q3n", "ent_7kms9p2w"],
    "search_type": "semantic",
    "limit": 10
  }'
```

#### Response

json

```json
{
  "status": "success",
  "credits_used": 1.0,
  "data": {
    "total_matches": 47,
    "returned_count": 10,
    "results": [
      {
        "score": 0.92,
        "report_id": "rpt_9xk3m7nq",
        "company_name": "Apple Inc.",
        "report_type": "10-K",
        "section": "Item 1A - Risk Factors",
        "page": 23,
        "snippet": "...our investments in artificial intelligence and machine learning technologies...",
        "context": {
          "before": "We continue to make significant",
          "match": "investments in artificial intelligence and machine learning technologies",
          "after": "to enhance our products and services"
        }
      }
    ]
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.orbitfin.ai/orbit-api-reference/api/document-search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
