Get a paginated list of the templates available to the current user.
Use this tool when:
- You need to know which templates are available for creating documents from
- You need to know which templates the user may edit in fynk. These will have a "url" field pointing to the edit page. No "url" means no permission to edit
- You need to find templates matching some conditions, e.g. by name, tag, team, document type or metadata
- You want to count templates matching some conditions (read `total`)
Without filter_expression, every template the user can access is returned, archived ones included, with the most recently updated first. For ordinary requests, add `archived_at is null` as described below. Each template is returned as a compact summary; use include to request additional sections (parties, teams, tags, details, signing_settings, timestamps), and prefer get-template-info for full information about a single template.
`total` counts all matching templates, but templates are returned only for the current page. Fetch the remaining pages while current_page < max_page when you need the complete set.
# Discover before writing an expression
Call this tool with mode="describe_fields" before writing an expression that uses metadata (`md.*`), option values, or a field you are unsure of: it lists every field templates can be filtered on in this account, with its operators and allowed values. Metadata names and select options differ per account, so never guess them. Find uuids for `tags`, `teams` and `document_type` with list-account-tags, list-account-teams and list-account-document-types.
Accounts use their own tags, document types and metadata to classify templates. When a question groups templates into a category that is not represented by a document type, check list-account-tags before treating that category as text in the template name.
Split the request into its conditions and map each one to a structured field. "German customer NDA templates" has three conditions: language (`locale starts with "de"`), "customer" (likely a tag or metadata value) and "NDA" (look up the document type). Resolve every condition and combine them in the expression; use `name contains` for a condition that actually concerns the template name.
# FQL syntax
`and`, `or`, `not`, parentheses; `=`, `!=`, `<`, `<=`, `>`, `>=`; `field in ("a", "b")`; text `contains` / `starts with` / `ends with` (literal, case-insensitive); collections `tags contains "<uuid>"`, `contains any (...)`, `contains all (...)`; `is null`, `is not null`, `is empty`, `is not empty`; `exists(collection, predicate)` and `all(collection, predicate)`; `start_of("week"|"month"|"quarter"|"year"[, offset])`, `end_of(...)` (same arguments), `today()`, `days_ago(N)`, `days_from_now(N)`, `now()`. Metadata fields are `md.<name>`, or `md["<name>"]` when the name contains anything other than ASCII letters, digits and underscores; use field names exactly as mode="describe_fields" returns them. Money fields have `.amount` and `.currency` components, plus `.interval` for recurring money, e.g. `md.contract_value.amount` and `md.contract_value.currency`. Use double-quoted strings. Dates and timestamps are double-quoted ISO 8601 strings; a date-only operand, `today()`, `days_ago(N)`, `days_from_now(N)` or `end_of(...)` (the period's last day) against a timestamp field covers that whole calendar day, exactly like the quoted date (so `created_at = today()` matches anything created today, `created_at = days_ago(1)` anything created yesterday, and `created_at >= days_ago(7)` anything created since the start of the day 7 days ago), while `start_of(...)` resolves to the period's first midnight. The optional signed offset of `start_of` and `end_of` counts whole periods from the current one: `start_of("month", 1)` is the start of next month, `end_of("quarter", -1)` the last day of last quarter. Duration operands are double-quoted ISO durations, e.g. `md.<field> = "P10M"` for ten months. Not every operator applies to every field: the operators mode="describe_fields" lists for a field are the ones it accepts.
# FQL examples
## Single conditions
- Active templates: `archived_at is null`
- Archived templates: `archived_at is not null`
- Draft templates: `published = false`
- Published templates: `published = true`
- Name contains NDA: `name contains "NDA"`
- German templates across regional locales: `locale starts with "de"`
- A specific document type: `document_type = "{document_type_uuid}"`
## Tags, teams and missing values
- Either tag: `tags contains any ("{tag_a_uuid}", "{tag_b_uuid}")`
- Both tags: `tags contains all ("{tag_a_uuid}", "{tag_b_uuid}")`
- Neither tag: `not (tags contains any ("{tag_a_uuid}", "{tag_b_uuid}"))`
- Assigned to a team: `teams contains "{team_uuid}"`
- Unassigned to any team: `teams is empty`
## Metadata
Use the account's discovered field names and option values in these examples.
- A select value (with a metadata name requiring bracket notation): `md["tätigkeitsfamilie_it_kv"] = "ZT"`
- An amount of at least 10,000: `md.contract_value.amount >= 10000`
- Currency is EUR: `md.contract_value.currency = "EUR"`
- A duration of ten months: `md.<field> = "P10M"`
## Combined conditions
- Active, published templates with NDA in their name: `archived_at is null and published = true and name contains "NDA"`
- Active German templates of a specific document type: `archived_at is null and locale starts with "de" and document_type = "{document_type_uuid}"`
- Assigned to a specific team or unassigned: `teams contains "{team_uuid}" or teams is empty`
- A contract value of at least EUR 10,000: `md.contract_value.amount >= 10000 and md.contract_value.currency = "EUR"`
# Active vs. archived, published vs. draft
The app user interface hides archived templates by default. Unless the user asks for archived templates, historical records, or explicitly includes archived templates in a complete inventory, add `archived_at is null`. This also applies to ordinary list and count requests; "all" alone does not imply including archived templates.
No archive condition is applied automatically. Use `archived_at is not null` for archived templates only, or omit the archive condition to include both. Archiving is not deletion: if an active-only search finds nothing, check archived templates before concluding that no matching templates exist.
Whenever results include archived templates, request include=["timestamps"] and clearly identify archived items using archived_at. For counts or aggregates, explicitly state that archived templates are included.
Drafts are included unless the expression excludes them; users who may only see published templates only ever get active, published ones. When picking a template to create a new document from, use `archived_at is null and published = true`: an archived template is one the account has retired from use.