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

# Documents and collections

> Search ordinances, plans and reports by meaning or exact words, read them section by section, read the tables inside them, and open one document of a collection

Ordinances, comprehensive plans, staff reports and meeting minutes are text, not rows, so they have their own calls. Ploti collects a place's ordinances, its zoning code among them, as documents, and you read them like any other document. Search finds the passage that answers a question across many documents. Read opens one section, with a link you can cite. Each call takes a dataset id from a [search](https://ploti.ai/docs/developers/find-datasets.md).

## Search documents

`documents search` takes exactly one of three kinds of search:

* **`question`**: a question in plain words, such as "minimum lot size for self-storage", matched by meaning. It searches documents and [scanned maps](https://ploti.ai/docs/developers/dataset-kinds.md#scanned-maps), across up to 500 documents, and returns 10 passages unless you ask for up to 25.
* **`text`**: exact words, such as "self-storage".
* **`pattern`**: a regular expression, up to 256 characters, such as `setback.{0,40}feet`.

A `text` or `pattern` search reads documents only (not scanned maps), up to 100 documents, and returns 25 matches unless you ask for up to 100. Pass `all_matches` for true totals.

Say where to search with `datasets`, a list of up to 100 document dataset ids, or a `place`. With neither, it searches your whole coverage. Each match names its document, section and page, so you can open it next.

## Read a document

* **`documents outline`** lists a document's sections and tables in order, 500 a page. Start here to find your way around a long code.
* **`documents read`** reads one section by its `section_id`, 20,000 characters a page, with a cursor for the rest.
* **`documents tables list`** lists the tables Ploti found inside the document, 200 a page, and **`documents tables read`** reads one by its `table_id`, 200 rows or 20,000 characters a page. Dimensional standards and use tables usually live here.
* **`documents download`** (CLI and Python) writes the whole text to a file: `.md` or `.txt` with headings, or `.ndjson` with a line per section, its title, path and page. Tables are left out. Read them with `documents tables read`.

`datasets files get` with `original` downloads the file Ploti read the document from, such as the PDF. See [stored files](https://ploti.ai/docs/developers/download.md#a-datasets-stored-files).

## Collections

A collection holds many documents under one dataset id, such as a town's meeting minutes. Each document in it has a **member key**.

* **`collections documents list`** lists its documents, with a total, up to 2,000 at once.
* **`collections documents search`** finds words inside its documents, and names the document and page of each match, up to 60 matches.
* **`collections documents read`** opens one document by its `member_key`, with the full text of every section in one reply, page labels to cite, and a link to its stored file.

`documents search` does not reach inside a collection's documents. Use `collections documents search` for that.

```bash CLI theme={null}
ploti documents search --question "minimum lot size for self-storage" --place "Tampa, FL"
ploti documents read tampa-zoning-code --section-id sec-27-156
```

```python Python theme={null}
import ploti

hits = ploti.documents.search(question="minimum lot size for self-storage", place="Tampa, FL")
ploti.documents.read("tampa-zoning-code", section_id="sec-27-156")
```

```bash REST theme={null}
curl -X POST https://api.ploti.ai/v1/documents/search \
  -H "Authorization: Bearer $PLOTI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"question": "minimum lot size for self-storage", "place": "Tampa, FL"}'
```

```json MCP theme={null}
{
  "tool": "documents_search",
  "arguments": {
    "question": "minimum lot size for self-storage",
    "place": "Tampa, FL"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.