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

# Templates

> Guide structuring behavior with predefined templates.

Templates guide how Shelv organizes documents with common structural patterns.

## Available templates

| Template         | Typical use                                 |
| ---------------- | ------------------------------------------- |
| `book`           | Books, manuals, long-form publications      |
| `legal-contract` | Contracts and legal agreements              |
| `charter-party`  | Maritime charter party contracts            |
| `academic-paper` | Research papers and journal-style documents |

## Use a template

```bash theme={"theme":{"light":"github-light","dark":"poimandres"}}
curl -X POST https://api.shelv.dev/v1/shelves \
  -H "Authorization: Bearer sk_your_api_key" \
  -F "file=@document.pdf" \
  -F "template=legal-contract"
```

## If you do not specify one

Shelv still structures the document automatically.

## Choosing a template

* Use `book` when chapter and part boundaries are important in downstream processing
* Use `legal-contract` when clause-level navigation and section references matter
* Use `charter-party` for maritime charter parties (voyage, time, bareboat) — separates Part I commercial terms, printed clauses, and rider clauses into distinct directories
* Use `academic-paper` when you need predictable research-section grouping

You can start without a template, inspect output quality, then add one once your document patterns are clear.

## Output expectations

Templates improve consistency, but exact file names and directory depth can vary by source document shape. Integrations should rely on discovered paths from `tree` or your own file selection logic, not hardcoded paths.

For stable integrations, treat templates as organization guidance, then discover concrete paths at runtime before file reads.

This approach prevents brittle assumptions when source documents vary in section naming or depth.
