Skip to content
Start here

List subscriptions with consumer lag

GET/accounts/{account_id}/k2/streams/{stream_id}/subscriptions

Lists every subscription on one stream, oldest first. Lag uses committed positions, not reserved read positions. A failed tail observation preserves subscription metadata and returns unavailable lag.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Path ParametersExpand Collapse
account_id: string

Specifies the public ID of the account.

maxLength32
minLength32
stream_id: string

Specifies the public ID of the K2 stream.

maxLength32
minLength32
ReturnsExpand Collapse
errors: array of object { message, code }
message: string
code: optional number
messages: array of object { message, code }
message: string
code: optional number
result: array of object { id, created_at, lag, 3 more }
id: string
created_at: string
formatdate-time
lag: object { records, status }
records: string

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: "available" or "unsupported" or "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: string
formatdate-time
name: string
start_at: object { type }
type: "earliest" or "latest"
One of the following:
"earliest"
"latest"
success: boolean

Indicates whether the API call was successful.

List subscriptions with consumer lag

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/k2/streams/$STREAM_ID/subscriptions \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
{
  "errors": [
    {
      "message": "message",
      "code": 0
    }
  ],
  "messages": [
    {
      "message": "message",
      "code": 0
    }
  ],
  "result": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "lag": {
        "records": "records",
        "status": "available"
      },
      "modified_at": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "start_at": {
        "type": "earliest"
      }
    }
  ],
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "message": "message",
      "code": 0
    }
  ],
  "messages": [
    {
      "message": "message",
      "code": 0
    }
  ],
  "result": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "lag": {
        "records": "records",
        "status": "available"
      },
      "modified_at": "2019-12-27T18:11:19.117Z",
      "name": "name",
      "start_at": {
        "type": "earliest"
      }
    }
  ],
  "success": true
}