---
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/4371/api/doc/kibana/operation/operation-persistfavoriteroute
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-persistfavoriteroute
products:
  - Kibana
---

# Favorite a Timeline or Timeline template

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

## Paths

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

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

## Description

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

Favorite a Timeline or Timeline template for the current user.

## Request Body

`application/json`

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

- `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 a successful call.

`application/json`

- `favorite` ([] object)
  - `favoriteDate` (number) — nullable
  - `fullName` (string) — nullable
  - `userName` (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 /api/timeline/_favorite
{
  "templateTimelineId": "null",
  "templateTimelineVersion": "null",
  "timelineId": "15c1929b-0af7-42bd-85a8-56e234cc7c4e",
  "timelineType": "default"
}
```

#### curl

```curl
curl -X PATCH "https://{kibana_url}/api/timeline/_favorite" \
  -H "Content-Type: application/json" \
  -d '{
  "templateTimelineId": "null",
  "templateTimelineVersion": "null",
  "timelineId": "15c1929b-0af7-42bd-85a8-56e234cc7c4e",
  "timelineType": "default"
}'
```

## Response Examples

#### Favorite metadata updated

```json
{
  "favorite": [
    {
      "favoriteDate": 1741337636741,
      "userName": "elastic"
    }
  ],
  "savedObjectId": "15c1929b-0af7-42bd-85a8-56e234cc7c4e",
  "timelineType": "default",
  "version": "WzE2LDFd"
}
```

#### Forbidden

```json
{
  "body": "Forbidden",
  "statusCode": 403
}
```

