---
title: Streams
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/typescript)

[K2](https://developers.cloudflare.com/api/typescript/resources/k2)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Streams

##### [List K2 streams](https://developers.cloudflare.com/api/typescript/resources/k2/subresources/streams/methods/list)

client.k2.streams.list(StreamListParams {account\_id, name, page, per\_page } params, RequestOptionsoptions?): V4PagePaginationArray< [StreamListResponse](<https://developers.cloudflare.com/api/typescript/resources/k2#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)>) {id, created\_at, endpoint, 5 more } >

GET/accounts/{account\_id}/k2/streams

##### [Get K2 stream](https://developers.cloudflare.com/api/typescript/resources/k2/subresources/streams/methods/get)

client.k2.streams.get(stringstreamID, StreamGetParams {account\_id } params, RequestOptionsoptions?): [StreamGetResponse](<https://developers.cloudflare.com/api/typescript/resources/k2#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)>) {id, created\_at, endpoint, 5 more }

GET/accounts/{account\_id}/k2/streams/{stream\_id}

##### [Create K2 stream](https://developers.cloudflare.com/api/typescript/resources/k2/subresources/streams/methods/create)

client.k2.streams.create(StreamCreateParams {account\_id, name, http, 2 more } params, RequestOptionsoptions?): [StreamCreateResponse](<https://developers.cloudflare.com/api/typescript/resources/k2#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)>) {id, created\_at, endpoint, 5 more }

POST/accounts/{account\_id}/k2/streams

##### [Update K2 stream](https://developers.cloudflare.com/api/typescript/resources/k2/subresources/streams/methods/update)

client.k2.streams.update(stringstreamID, StreamUpdateParams {account\_id, http, retention\_seconds, worker\_binding } params, RequestOptionsoptions?): [StreamUpdateResponse](<https://developers.cloudflare.com/api/typescript/resources/k2#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)>) {id, created\_at, endpoint, 5 more }

PATCH/accounts/{account\_id}/k2/streams/{stream\_id}

##### [Delete K2 stream](https://developers.cloudflare.com/api/typescript/resources/k2/subresources/streams/methods/delete)

client.k2.streams.delete(stringstreamID, StreamDeleteParams {account\_id } params, RequestOptionsoptions?): [StreamDeleteResponse](<https://developers.cloudflare.com/api/typescript/resources/k2#(resource)%20k2.streams%20%3E%20(model)%20stream_delete_response%20%3E%20(schema)>)

DELETE/accounts/{account\_id}/k2/streams/{stream\_id}

##### ModelsExpand Collapse

<details>

<summary>

StreamListResponse {id, created\_at, endpoint, 5 more }

</summary>

id: string

Specifies the public ID of the K2 stream.

maxLength32

minLength32

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

created\_at: string

formatdate-time

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

endpoint: string

Indicates the base HTTP endpoint for producing and consuming records.

formaturi

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20endpoint">Link to this property</a>

<details>

<summary>

http: HTTP {enabled, authentication, cors }

Configures the HTTP endpoint. Disabling HTTP keeps <code>authentication</code> and <code>cors</code>, so enabling it again restores them.

</summary>

enabled: boolean

Indicates whether the HTTP endpoint accepts records.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20enabled">Link to this property</a>

authentication?: boolean

Indicates whether the HTTP endpoint requires an API token with K2 produce permission. When false, the endpoint accepts unauthenticated records. Defaults to true when HTTP is enabled without a stored value.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20authentication">Link to this property</a>

<details>

<summary>

cors?: CORS {origins }

</summary>

origins?: Array&lt;string&gt;

Allows browser requests from these HTTP or HTTPS origins. Use a wildcard only as the sole origin. An empty list blocks cross-origin browser requests. Defaults to <code>['*']</code> when HTTP is enabled without stored origins.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20cors%20%3E%20(property)%20origins">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20cors">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20http">Link to this property</a>

modified\_at: string

formatdate-time

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20modified_at">Link to this property</a>

name: string

Indicates the name of the K2 stream.

maxLength128

minLength1

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

retention\_seconds: number

Shows the configured record retention period from 1 hour (3600 seconds) to 30 days (2592000 seconds), inclusive.

maximum2592000

minimum3600

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20retention_seconds">Link to this property</a>

<details>

<summary>

worker\_binding: WorkerBinding {enabled }

</summary>

enabled: boolean

Indicates whether Workers bindings can produce records to the stream.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20worker_binding%20%3E%20(property)%20enabled">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)%20%3E%20(property)%20worker_binding">Link to this property</a>

</details>

[Link to this property](<#(resource)%20k2.streams%20%3E%20(model)%20stream_list_response%20%3E%20(schema)>)

<details>

<summary>

StreamGetResponse {id, created\_at, endpoint, 5 more }

</summary>

id: string

Specifies the public ID of the K2 stream.

maxLength32

minLength32

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

created\_at: string

formatdate-time

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

endpoint: string

Indicates the base HTTP endpoint for producing and consuming records.

formaturi

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20endpoint">Link to this property</a>

<details>

<summary>

http: HTTP {enabled, authentication, cors }

Configures the HTTP endpoint. Disabling HTTP keeps <code>authentication</code> and <code>cors</code>, so enabling it again restores them.

</summary>

enabled: boolean

Indicates whether the HTTP endpoint accepts records.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20enabled">Link to this property</a>

authentication?: boolean

Indicates whether the HTTP endpoint requires an API token with K2 produce permission. When false, the endpoint accepts unauthenticated records. Defaults to true when HTTP is enabled without a stored value.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20authentication">Link to this property</a>

<details>

<summary>

cors?: CORS {origins }

</summary>

origins?: Array&lt;string&gt;

Allows browser requests from these HTTP or HTTPS origins. Use a wildcard only as the sole origin. An empty list blocks cross-origin browser requests. Defaults to <code>['*']</code> when HTTP is enabled without stored origins.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20cors%20%3E%20(property)%20origins">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20cors">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20http">Link to this property</a>

modified\_at: string

formatdate-time

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20modified_at">Link to this property</a>

name: string

Indicates the name of the K2 stream.

maxLength128

minLength1

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

retention\_seconds: number

Shows the configured record retention period from 1 hour (3600 seconds) to 30 days (2592000 seconds), inclusive.

maximum2592000

minimum3600

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20retention_seconds">Link to this property</a>

<details>

<summary>

worker\_binding: WorkerBinding {enabled }

</summary>

enabled: boolean

Indicates whether Workers bindings can produce records to the stream.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20worker_binding%20%3E%20(property)%20enabled">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)%20%3E%20(property)%20worker_binding">Link to this property</a>

</details>

[Link to this property](<#(resource)%20k2.streams%20%3E%20(model)%20stream_get_response%20%3E%20(schema)>)

<details>

<summary>

StreamCreateResponse {id, created\_at, endpoint, 5 more }

</summary>

id: string

Specifies the public ID of the K2 stream.

maxLength32

minLength32

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

created\_at: string

formatdate-time

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

endpoint: string

Indicates the base HTTP endpoint for producing and consuming records.

formaturi

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20endpoint">Link to this property</a>

<details>

<summary>

http: HTTP {enabled, authentication, cors }

Configures the HTTP endpoint. Disabling HTTP keeps <code>authentication</code> and <code>cors</code>, so enabling it again restores them.

</summary>

enabled: boolean

Indicates whether the HTTP endpoint accepts records.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20enabled">Link to this property</a>

authentication?: boolean

Indicates whether the HTTP endpoint requires an API token with K2 produce permission. When false, the endpoint accepts unauthenticated records. Defaults to true when HTTP is enabled without a stored value.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20authentication">Link to this property</a>

<details>

<summary>

cors?: CORS {origins }

</summary>

origins?: Array&lt;string&gt;

Allows browser requests from these HTTP or HTTPS origins. Use a wildcard only as the sole origin. An empty list blocks cross-origin browser requests. Defaults to <code>['*']</code> when HTTP is enabled without stored origins.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20cors%20%3E%20(property)%20origins">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20cors">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20http">Link to this property</a>

modified\_at: string

formatdate-time

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20modified_at">Link to this property</a>

name: string

Indicates the name of the K2 stream.

maxLength128

minLength1

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

retention\_seconds: number

Shows the configured record retention period from 1 hour (3600 seconds) to 30 days (2592000 seconds), inclusive.

maximum2592000

minimum3600

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20retention_seconds">Link to this property</a>

<details>

<summary>

worker\_binding: WorkerBinding {enabled }

</summary>

enabled: boolean

Indicates whether Workers bindings can produce records to the stream.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20worker_binding%20%3E%20(property)%20enabled">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)%20%3E%20(property)%20worker_binding">Link to this property</a>

</details>

[Link to this property](<#(resource)%20k2.streams%20%3E%20(model)%20stream_create_response%20%3E%20(schema)>)

<details>

<summary>

StreamUpdateResponse {id, created\_at, endpoint, 5 more }

</summary>

id: string

Specifies the public ID of the K2 stream.

maxLength32

minLength32

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

created\_at: string

formatdate-time

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

endpoint: string

Indicates the base HTTP endpoint for producing and consuming records.

formaturi

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20endpoint">Link to this property</a>

<details>

<summary>

http: HTTP {enabled, authentication, cors }

Configures the HTTP endpoint. Disabling HTTP keeps <code>authentication</code> and <code>cors</code>, so enabling it again restores them.

</summary>

enabled: boolean

Indicates whether the HTTP endpoint accepts records.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20enabled">Link to this property</a>

authentication?: boolean

Indicates whether the HTTP endpoint requires an API token with K2 produce permission. When false, the endpoint accepts unauthenticated records. Defaults to true when HTTP is enabled without a stored value.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20authentication">Link to this property</a>

<details>

<summary>

cors?: CORS {origins }

</summary>

origins?: Array&lt;string&gt;

Allows browser requests from these HTTP or HTTPS origins. Use a wildcard only as the sole origin. An empty list blocks cross-origin browser requests. Defaults to <code>['*']</code> when HTTP is enabled without stored origins.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20cors%20%3E%20(property)%20origins">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20http%20%3E%20(property)%20cors">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20http">Link to this property</a>

modified\_at: string

formatdate-time

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20modified_at">Link to this property</a>

name: string

Indicates the name of the K2 stream.

maxLength128

minLength1

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

retention\_seconds: number

Shows the configured record retention period from 1 hour (3600 seconds) to 30 days (2592000 seconds), inclusive.

maximum2592000

minimum3600

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20retention_seconds">Link to this property</a>

<details>

<summary>

worker\_binding: WorkerBinding {enabled }

</summary>

enabled: boolean

Indicates whether Workers bindings can produce records to the stream.

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20worker_binding%20%3E%20(property)%20enabled">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)%20%3E%20(property)%20worker_binding">Link to this property</a>

</details>

[Link to this property](<#(resource)%20k2.streams%20%3E%20(model)%20stream_update_response%20%3E%20(schema)>)

StreamDeleteResponse = unknown

[Link to this property](<#(resource)%20k2.streams%20%3E%20(model)%20stream_delete_response%20%3E%20(schema)>)

#### StreamsSubscriptions

##### [List subscriptions with consumer lag](https://developers.cloudflare.com/api/typescript/resources/k2/subresources/streams/subresources/subscriptions/methods/list)

client.k2.streams.subscriptions.list(stringstreamID, SubscriptionListParams {account\_id } params, RequestOptionsoptions?): SinglePage< [SubscriptionListResponse](<https://developers.cloudflare.com/api/typescript/resources/k2#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)>) {id, created\_at, lag, 3 more } >

GET/accounts/{account\_id}/k2/streams/{stream\_id}/subscriptions

##### ModelsExpand Collapse

<details>

<summary>

SubscriptionListResponse {id, created\_at, lag, 3 more }

</summary>

id: string

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

created\_at: string

formatdate-time

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

<details>

<summary>

lag: Lag {records, status }

</summary>

records: string| null

Decimal-string distance from the subscription’s committed position to the observed exclusive stream tail, in records. Includes in-flight records and may include expired records or records acknowledged beyond an earlier gap. Null unless status is available.

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20lag%20%3E%20(property)%20records">Link to this property</a>

<details>

<summary>

status: "available"| "unsupported"| "unavailable"

Unsupported means the subscription or stream topology cannot be measured; unavailable means a required observation failed or was inconsistent.

</summary>

One of the following:

"available"

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20lag%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"unsupported"

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20lag%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

"unavailable"

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20lag%20%3E%20(property)%20status%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20lag%20%3E%20(property)%20status">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20lag">Link to this property</a>

modified\_at: string

formatdate-time

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20modified_at">Link to this property</a>

name: string

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

<details>

<summary>

start\_at: StartAt {type }

</summary>

<details>

<summary>

type: "earliest"| "latest"

</summary>

One of the following:

"earliest"

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20start_at%20%3E%20(property)%20type%20%3E%20(member)%200">Link to this property</a>

"latest"

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20start_at%20%3E%20(property)%20type%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20start_at%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)%20%3E%20(property)%20start_at">Link to this property</a>

</details>

[Link to this property](<#(resource)%20k2.streams.subscriptions%20%3E%20(model)%20subscription_list_response%20%3E%20(schema)>)