---
type: api
title: Fork a stream
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/operation/operation-post-streams-name-fork
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/operation/operation-post-streams-name-fork
products:
  - Kibana
---

# Fork a stream

Availability: Experimental since 9.1

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

## Paths

- `POST` `/api/streams/{name}/_fork`
- `POST` `/s/{space_id}/api/streams/{name}/_fork`

#### Path parameters

- `name` (string · max length: 200) — required
  The name of the parent stream to fork from.

## Description

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

Forks a wired stream and creates a child stream

## Required authorization

- Privileges: `manage_stream`

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Header parameters

- `kbn-xsrf` (string) — required
  A required header to protect against CSRF attacks

## Request body

`application/json`

- `draft` (boolean) — optional
- `status` (enum) — optional
  Values: `enabled`, `disabled`
- `stream` (object) — required
  - `name` (string · max length: 200) — required
- `where` (union anyOf) — required
  - **{ contains, endsWith, eq, … }**
    - `contains` (union string | number | boolean) — optional
    - `endsWith` (union string | number | boolean) — optional
    - `eq` (union string | number | boolean) — optional
    - `field` (string · min length: 1 · max length: 256) — required
    - `gt` (union string | number | boolean) — optional
    - `gte` (union string | number | boolean) — optional
    - `includes` (union string | number | boolean) — optional
    - `lt` (union string | number | boolean) — optional
    - `lte` (union string | number | boolean) — optional
    - `neq` (union string | number | boolean) — optional
    - `range` (object) — optional
      - `gt` (union string | number | boolean) — optional
      - `gte` (union string | number | boolean) — optional
      - `lt` (union string | number | boolean) — optional
      - `lte` (union string | number | boolean) — optional
    - `startsWith` (union string | number | boolean) — optional
  - **{ exists }**
    - `exists` (boolean) — optional
    - `field` (string · min length: 1 · max length: 256) — required
  - **{ and }**
    - `and` (union anyOf[] · max items: 50) — required — recursive
      Same options as `where`
  - **{ or }**
    - `or` (union anyOf[] · max items: 50) — required — recursive
      Same options as `where`
  - **{ not }**
    - `not` (union anyOf) — required — recursive
      Same options as `where`
  - **{ always }**
    - `always` (object) — required
  - **{ never }**
    - `never` (object) — required

## Response

The stream was forked successfully.

## Code examples

#### Console

```console
POST kbn:/api/streams/NAME/_fork
{
  "status": "enabled",
  "stream": {
    "name": "logs.nginx.errors"
  },
  "where": {
    "eq": "500",
    "field": "http.response.status_code"
  }
}
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/streams/${NAME}/_fork" \
  -H "kbn-xsrf: true" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "enabled",
    "stream": {
      "name": "logs.nginx.errors"
    },
    "where": {
      "eq": "500",
      "field": "http.response.status_code"
    }
  }'
```

