# Search

> Search across all entity types with full-text and natural language queries.

- **Category:** Guides
- HTML version: https://www.ondayzero.com/docs/guides/search
- All guides: https://www.ondayzero.com/docs/guides/index.md
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md

---

# Search

DayZero provides two search modes: **structured search** with filters and **natural language search** powered by AI.

## Full-Text Search

Search across all entity types in a single query:

```bash
curl "https://api.ondayzero.com/api/v1/search?search_term=acme&limit=20" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"
```

### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `search_term` | string | Search query, 1–200 characters (required) |
| `entity_type` | string | Limit to a single type (see below); omit to search everything |
| `date_from` / `date_to` | date | Restrict to records dated in this range |
| `limit` | integer | Max results per entity type (1–1000) |
| `cursor`, `direction`, `sort_by`, `descending`, `include_total_count` | | Standard [pagination](/docs/guides/pagination) parameters |

### Response

Results are grouped by type:

```json
{
  "success": true,
  "data": {
    "results": {
      "customers": [ { "id": "…", "name": "Acme Corp", "email": "billing@acme.com" } ],
      "invoices": [ { "id": "…", "number": "INV-1042", "customer_name": "Acme Corp", "total": 125000 } ],
      "transactions": [],
      "metadata": { "search_term": "acme", "total_count": 2 }
    }
  }
}
```

Types with no matches come back as empty arrays.

### Searchable Entity Types

| `entity_type` | What's searched |
|---------------|-----------------|
| `transactions` | Bank transactions (description, counterparty) |
| `invoices` | Invoice numbers and descriptions |
| `bills` | Bill numbers and descriptions |
| `journal_entries` | Entry descriptions |
| `customers` | Customer names and emails |
| `vendors` | Vendor names and emails |
| `ledgers` | Account names and descriptions |
| `products` | Product names and types |
| `variants` | Variant names, SKUs and manufacturer SKUs |
| `projects` / `contracts` | Project names and codes; contract numbers |
| `emails` | Inbox email subjects, senders and descriptions |
| `inventory_orders` | Purchase order names, PO numbers and descriptions |
| `shipments` | Shipment tracking numbers and descriptions |

An unknown `entity_type` returns a `200` with no result groups and `metadata.error` set to `Invalid entity_type: …` — check for it rather than assuming an empty result means no matches.

## Natural Language Search

Use AI to interpret a question and search across the appropriate entities:

```bash
curl -X POST "https://api.ondayzero.com/api/v1/search/natural" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{"query": "What did we spend on software last month?"}'
```

The AI interprets the intent, selects the right entity types and date range, and returns a flat, ranked list:

```json
{
  "success": true,
  "data": {
    "interpreted_query": "transactions categorized as software expenses between 2026-08-01 and 2026-08-31",
    "results": [
      { "entity_type": "transaction", "entity_id": "…", "title": "GitHub", "subtitle": "-$210.00 · 2026-08-04", "score": 0.94 }
    ],
    "total": 1
  }
}
```

Fetch full records with the entity's own endpoint (e.g. `GET /api/v1/transactions/{entity_id}`).

## Searching the documentation

To find the right *endpoint* rather than your own data, use the docs search at `https://www.ondayzero.com/docs/search?q=void+invoice` — see [Using DayZero from an AI Agent](/docs/guides/ai-agents).
