[role="xpack"]
[[indices-create-data-stream]]
=== Create data stream API
++++
<titleabbrev>Create data stream</titleabbrev>
++++

Creates a new <<data-streams,data stream>>.

////
[source,console]
----
PUT /_index_template/template
{
  "index_patterns": ["my-data-stream*"],
  "data_stream": { }
}
----
////

[source,console]
----
PUT /_data_stream/my-data-stream
----
// TEST[continued]

////
[source,console]
-----------------------------------
DELETE /_data_stream/my-data-stream
DELETE /_index_template/template
-----------------------------------
// TEST[continued]
////

[[indices-create-data-stream-request]]
==== {api-request-title}

`PUT /_data_stream/<data-stream>`

[[indices-create-data-stream-prereqs]]
==== {api-prereq-title}

* If the {es} {security-features} are enabled, you must have the `create_index`
or `manage` <<privileges-list-indices,index privilege>> for the data stream.

* A matching <<index-templates,index template>> with data stream enabled.
See <<set-up-a-data-stream>>.

[[indices-create-data-stream-api-path-params]]
==== {api-path-parms-title}

`<data-stream>`::
+
--
(Required, string) Name of the data stream to create. Data stream names must
meet the following criteria:

- Lowercase only
- Cannot include `\`, `/`, `*`, `?`, `"`, `<`, `>`, `|`, `,`, `#`, `:`, or a
space character
- Cannot start with `-`, `_`, `+`, or `.ds-`
- Cannot be `.` or `..`
- Cannot be longer than 255 bytes. Multi-byte characters
count towards this limit faster.
--

