---
title: "Bind a tile to a query model"
method: PUT
path: "/api/v2/documents/{identifier}/draft/{draftIdentifier}/queries/{queryKey}/query-model"
tags: ["Documents"]
---

# Bind a tile to a query model

`PUT /api/v2/documents/{identifier}/draft/{draftIdentifier}/queries/{queryKey}/query-model`

Bind a query-presentation tile to a query model on a draft.

The query-model binding (`query.model_extension_id`) is server-owned on the whole-document PATCH surface — a supplied value there is ignored and the tile keeps its stored binding. This draft-scoped route is the way to change it, addressing one tile by its stable record key. The binding shifts on every draft (each draft re-clones its query models), so work against a draft you have already read.

The `queryModelId` must be a live query model layered on this draft’s workbook model, and not already bound to another tile — a query model is dedicated to a single query. A LINKED tile inherits its query model from its source and can’t be bound directly.

## Path parameters

- `draftIdentifier` string, required — Draft workbook identifier (see `PATCH /api/v2/documents/{identifier}/draft`).
- `identifier` string, required — Published document identifier.
- `queryKey` string, required — Record key of the tile, as it appears in `queryPresentations.data`.

## Request body

- DocumentsV2BindQueryModelBody
  - `queryModelId` string, uuid, required — The query model to bind this tile to. Must be a query model layered on this draft’s workbook model, not already bound to another tile. LINKED and FOREIGN tabs are rejected: a LINKED tab inherits its source’s binding, and a FOREIGN tab’s query runs against a different model.

## Response `200`

Tile bound to the query model; the response carries the `draftIdentifier`.

- DocumentsV2PatchDraftResponse
  - `description` string, nullable, required — Document description.
  - `draftIdentifier` string, required — Identifier of the draft the patch was applied to.
  - `identifier` string, required — Published document identifier the draft targets.
  - `name` string, required — Document name.

## Other responses

- `400` — Invalid `queryKey` or body, the tile’s query is degraded (not an object) or the tile is LINKED, or the `queryModelId` is not a query model available on this draft.
- `401` — Authentication required.
- `403` — Insufficient permissions to update the document.
- `404` — Document, draft, or tile not found.
- `405` — Method not allowed.
- `409` — The target is not a published document, or the query model is already bound to another tile.

## Changes

> 22 revisions in range; 19 could not be searched.

- **2026-07-26** `f65b6ea0a62f` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/omniapp/apis/omni-api/changes/api/v2/documents/:identifier/draft/:draftIdentifier/queries/:queryKey/query-model/put.md)

---

[API](https://skmtc.dev/omniapp/apis/omni-api.md) · [All operations](https://skmtc.dev/omniapp/apis/omni-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/omniapp/omni-api/revisions/2ed3f36eff42/schema)
