---
type: api
title: Favorite a Timeline or Timeline template
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/kibana/v8/operation/operation-persistfavoriteroute
resource: https://www.elastic.co/elastic/docs-builder/docs/4641/api/doc/kibana/v8/operation/operation-persistfavoriteroute
products:
  - Kibana
---

# Favorite a Timeline or Timeline template

Authentication: required

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

## Paths

- `PATCH` `/api/timeline/_favorite`
- `PATCH` `/s/{space_id}/api/timeline/_favorite`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

## Description

Favorite a Timeline or Timeline template for the current user.

## Request body

The required fields used to favorite a (template) Timeline.

`application/json`

- `templateTimelineId` (string) — required — nullable
- `templateTimelineVersion` (number) — required — nullable
- `timelineId` (string) — required — nullable
- `timelineType` (enum) — required
  The type of Timeline.
  Values: `default`, `template`

## Responses

#### `200`

Indicates the favorite status was successfully updated.

`application/json`

- `data` (object)
  - `persistFavorite` (object)
    - `code` (number) — nullable
    - `favorite` (object[])
      - `favoriteDate` (number) — nullable
      - `fullName` (string) — nullable
      - `userName` (string) — nullable
    - `message` (string) — nullable
    - `savedObjectId` (string)
    - `templateTimelineId` (string) — nullable
    - `templateTimelineVersion` (number) — nullable
    - `timelineType` (enum)
      The type of Timeline.
      Values: `default`, `template`
    - `version` (string)
#### `403`

Indicates the user does not have the required permissions to persist the favorite status.

`application/json`

- `body` (string)
- `statusCode` (number)
## Code examples

#### Console

```console
PATCH kbn:/api/timeline/_favorite
{
  "templateTimelineId": "string",
  "templateTimelineVersion": 0,
  "timelineId": "string",
  "timelineType": "default"
}
```

#### curl

```curl
curl -X PATCH "${KIBANA_URL}/api/timeline/_favorite" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "templateTimelineId": "string",
    "templateTimelineVersion": 0,
    "timelineId": "string",
    "timelineType": "default"
  }'
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "data": {
    "persistFavorite": {
      "code": 0,
      "favorite": [
        {
          "favoriteDate": 1741337636741,
          "userName": "elastic"
        }
      ],
      "message": "string",
      "savedObjectId": "string",
      "templateTimelineId": "string",
      "templateTimelineVersion": 0,
      "timelineType": "default",
      "version": "string"
    }
  }
}
```

#### 403

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "body": "string",
  "statusCode": 0
}
```

