---
title: "Assign a template to a Workspace sheet"
method: PUT
path: "/v1/sheets/{sheet_id}/template"
tags: ["Workspace Sheets"]
---

# Assign a template to a Workspace sheet

`PUT /v1/sheets/{sheet_id}/template`

## Request

- Base URL: `https://api.oneschema.co`
- URL: `https://api.oneschema.co/v1/sheets/{sheet_id}/template`
- Auth: API key in header `X-API-KEY`

Assign or unassign a template for a Workspace sheet. Pass `template_key: null` to unassign the current template.

Set `auto_set_header_row` to `true` to automatically detect and set the header row before applying the template. If the sheet's headers are already set, `auto_set_header_row` is ignored.

## Path parameters

- `sheet_id` integer, required

## Request body

- SheetTemplateAssignmentRequest
  - `template_key` string, nullable, required: The unique key of the template to assign to the sheet. Pass `null` to unassign the current template.
  - `auto_set_header_row` boolean: Whether to automatically detect and set the header row before applying the template. Ignored if the sheet's headers are already set.

## Response `200`

The request has succeeded.

- WorkspaceSheet
  - `id` integer, required: The unique identifier of the sheet.
  - `workspace_id` integer, required: The ID of the Workspace that contains the sheet.
  - `name` string, required: The name of the sheet.
  - `template_key` string, nullable: The unique key of the template assigned to the sheet, if any.
  - `custom_metadata` object, nullable: Custom metadata associated with the sheet.
  - `columns` WorkspaceSheetColumn[]: The columns of the sheet, included when the sheet's headers have been set.
    - `id` integer, required: The unique identifier of the column.
    - `name` string, required: The label of the column.
    - `template_column_key` string, nullable: The key of the template column this sheet column is mapped to, if any.
    - `is_custom` boolean: Whether the column is a custom column not present in the assigned template.

## Other responses

- `400`: 400

---

[API](https://skmtc.dev/oneschema/apis/workspaces.md) - [All operations](https://skmtc.dev/oneschema/apis/workspaces/llms.txt) - [OpenAPI document](https://skmtc.dev/oneschema/apis/workspaces/revisions/d423a67ccea6?raw)
