Skip to content
Start here

Streams

List K2 streams
k2.streams.list(StreamListParams**kwargs) -> SyncV4PagePaginationArray[StreamListResponse]
GET/accounts/{account_id}/k2/streams
Get K2 stream
k2.streams.get(strstream_id, StreamGetParams**kwargs) -> StreamGetResponse
GET/accounts/{account_id}/k2/streams/{stream_id}
Create K2 stream
k2.streams.create(StreamCreateParams**kwargs) -> StreamCreateResponse
POST/accounts/{account_id}/k2/streams
Update K2 stream
k2.streams.update(strstream_id, StreamUpdateParams**kwargs) -> StreamUpdateResponse
PATCH/accounts/{account_id}/k2/streams/{stream_id}
Delete K2 stream
k2.streams.delete(strstream_id, StreamDeleteParams**kwargs) -> object
DELETE/accounts/{account_id}/k2/streams/{stream_id}
ModelsExpand Collapse
class StreamListResponse: …
id: str

Specifies the public ID of the K2 stream.

maxLength32
minLength32
created_at: datetime
formatdate-time
endpoint: str

Indicates the base HTTP endpoint for producing and consuming records.

formaturi
http: HTTP

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

enabled: bool

Indicates whether the HTTP endpoint accepts records.

authentication: Optional[bool]

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.

cors: Optional[HTTPCORS]
origins: Optional[List[str]]

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 ['*'] when HTTP is enabled without stored origins.

modified_at: datetime
formatdate-time
name: str

Indicates the name of the K2 stream.

maxLength128
minLength1
retention_seconds: int

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

maximum2592000
minimum3600
worker_binding: WorkerBinding
One of the following:
class WorkerBindingEnabled: …
enabled: Literal[false]

Indicates whether Workers bindings can produce records to the stream.

class WorkerBindingEnabled: …
enabled: Literal[true]

Indicates whether Workers bindings can produce records to the stream.

class StreamGetResponse: …
id: str

Specifies the public ID of the K2 stream.

maxLength32
minLength32
created_at: datetime
formatdate-time
endpoint: str

Indicates the base HTTP endpoint for producing and consuming records.

formaturi
http: HTTP

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

enabled: bool

Indicates whether the HTTP endpoint accepts records.

authentication: Optional[bool]

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.

cors: Optional[HTTPCORS]
origins: Optional[List[str]]

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 ['*'] when HTTP is enabled without stored origins.

modified_at: datetime
formatdate-time
name: str

Indicates the name of the K2 stream.

maxLength128
minLength1
retention_seconds: int

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

maximum2592000
minimum3600
worker_binding: WorkerBinding
One of the following:
class WorkerBindingEnabled: …
enabled: Literal[false]

Indicates whether Workers bindings can produce records to the stream.

class WorkerBindingEnabled: …
enabled: Literal[true]

Indicates whether Workers bindings can produce records to the stream.

class StreamCreateResponse: …
id: str

Specifies the public ID of the K2 stream.

maxLength32
minLength32
created_at: datetime
formatdate-time
endpoint: str

Indicates the base HTTP endpoint for producing and consuming records.

formaturi
http: HTTP

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

enabled: bool

Indicates whether the HTTP endpoint accepts records.

authentication: Optional[bool]

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.

cors: Optional[HTTPCORS]
origins: Optional[List[str]]

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 ['*'] when HTTP is enabled without stored origins.

modified_at: datetime
formatdate-time
name: str

Indicates the name of the K2 stream.

maxLength128
minLength1
retention_seconds: int

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

maximum2592000
minimum3600
worker_binding: WorkerBinding
One of the following:
class WorkerBindingEnabled: …
enabled: Literal[false]

Indicates whether Workers bindings can produce records to the stream.

class WorkerBindingEnabled: …
enabled: Literal[true]

Indicates whether Workers bindings can produce records to the stream.

class StreamUpdateResponse: …
id: str

Specifies the public ID of the K2 stream.

maxLength32
minLength32
created_at: datetime
formatdate-time
endpoint: str

Indicates the base HTTP endpoint for producing and consuming records.

formaturi
http: HTTP

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

enabled: bool

Indicates whether the HTTP endpoint accepts records.

authentication: Optional[bool]

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.

cors: Optional[HTTPCORS]
origins: Optional[List[str]]

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 ['*'] when HTTP is enabled without stored origins.

modified_at: datetime
formatdate-time
name: str

Indicates the name of the K2 stream.

maxLength128
minLength1
retention_seconds: int

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

maximum2592000
minimum3600
worker_binding: WorkerBinding
One of the following:
class WorkerBindingEnabled: …
enabled: Literal[false]

Indicates whether Workers bindings can produce records to the stream.

class WorkerBindingEnabled: …
enabled: Literal[true]

Indicates whether Workers bindings can produce records to the stream.

StreamsSubscriptions

List K2 stream subscriptions
k2.streams.subscriptions.list(strstream_id, SubscriptionListParams**kwargs) -> SyncSinglePage[SubscriptionListResponse]
GET/accounts/{account_id}/k2/streams/{stream_id}/subscriptions
ModelsExpand Collapse
class SubscriptionListResponse: …
id: str
created_at: datetime
formatdate-time
lag: Lag
records: Optional[str]

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.

status: Literal["available", "unsupported", "unavailable"]

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

One of the following:
"available"
"unsupported"
"unavailable"
modified_at: datetime
formatdate-time
name: str
start_at: StartAt
type: Literal["earliest", "latest"]
One of the following:
"earliest"
"latest"