---
type: api
title: Get a case template by ID
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-getcasetemplatedefaultspace
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-getcasetemplatedefaultspace
products:
  - Kibana
---

# Get a case template by ID

- Server: `https://{kibana_url}`

## Paths

- `GET` `/api/cases/templates/{template_id}`
- `GET` `/s/{space_id}/api/cases/templates/{template_id}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#basicauth)

#### Path Parameters

- `template_id` (string · max: 36)
  The identifier for the template.

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Returns the details of a case template. Requires the Cases feature to be enabled in the space.

## Query String Parameters

- `version` (integer · min: 1)
  The version number of the template to retrieve. If omitted, the latest version is returned.

## Responses

#### `200`

Indicates a successful call.

`application/json`

- `author` (string · max: 1000)
  The username of the template author.
- `definition` (object)
  The parsed template definition.
- `definitionString` (string · max: 30000)
  The raw YAML definition string.
- `deletedAt` (string) — nullable
  The date the template was soft-deleted, or null if active.
- `description` (string · max: 30000)
  A human-readable description of the template.
- `fieldCount` (integer)
  The number of fields defined in the template.
- `fieldDefinitions` ([] object)
  Metadata about each field defined in the template.
  - `control` (string · max: 50)
  - `label` (string · max: 256)
  - `name` (string · max: 256)
  - `type` (string · max: 50)
- `isDefault` (boolean)
  Whether this is the default template for its owner.
- `isEnabled` (boolean)
  Whether the template is enabled.
- `isLatest` (boolean)
  Whether this is the latest version of the template.
- `lastUsedAt` (string)
  The date the template was last used to create a case.
- `latestVersion` (integer)
  The latest version number of this template.
- `name` (string · max: 100)
  The display name of the template.
- `owner` (string · max: 50)
  The owning solution (e.g. cases, observability, securitySolution).
- `tags` ([] object · max: 200)
  The words and phrases that help categorize templates. It can be an empty array.
- `templateId` (string · max: 36)
  The unique identifier of the template, shared across all versions.
- `templateVersion` (integer)
  The version number of this template revision.
- `usageCount` (integer)
  The number of times this template has been used to create a case.
#### `401`

Authorization information is missing or invalid.

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
#### `404`

The template was not found.

`application/json`

- `error` (string)
- `message` (string)
- `statusCode` (integer)
## Code Examples

#### Console

```console
GET /api/cases/templates/{template_id}
```

#### curl

```curl
curl -X GET "https://{kibana_url}/api/cases/templates/{template_id}"
```

## Response Examples

#### A case template.

```json
{
  "definition": {},
  "definitionString": "fields: []",
  "deletedAt": "null",
  "isLatest": true,
  "latestVersion": 1,
  "name": "My Template",
  "owner": "cases",
  "templateId": "9da1ea2a-09f8-4d0e-bf9d-09bf8c9d0f42",
  "templateVersion": 1
}
```

#### Authorization information is missing or invalid.

```json
{
  "error": "Unauthorized",
  "message": "Unable to authenticate with the provided credentials.",
  "statusCode": 401
}
```

#### The requested resource was not found.

```json
{
  "error": "Not Found",
  "message": "Saved object [cases-template/9da1ea2a-09f8-4d0e-bf9d-09bf8c9d0f42] not found",
  "statusCode": 404
}
```

