Skip to main content

HEAD /streams//records/tail

Retrieve the current tail position of a stream without reading any records. This is useful for:
  • Determining the current size of a stream
  • Finding the starting position for a tail read
  • Checking if new records have been appended since last read
  • Verifying stream existence

Authentication

Requires a valid access token with read permissions to the stream.

Path Parameters

string
required
Stream name to check.

Headers

string
required
Basin name where the stream resides.

Response

object
required
Current tail position of the stream.

Status Codes

  • 200 OK - Tail position successfully retrieved
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Stream does not exist
  • 408 Request Timeout - Operation timed out
  • 409 Conflict - Stream is being deleted

Examples

Check tail position

Response

This indicates:
  • The stream has 1000 records (seq_num 0-999)
  • The next append will receive seq_num 1000
  • The last record has timestamp 1709481250000

Empty stream

Both fields are 0, indicating an empty stream.

Use tail for conditional append

Check for new records

Verify stream exists

Use Cases

Stream Size Calculation

The seq_num in the tail response represents the total number of records in the stream (since sequence numbers start at 0).

Efficient Polling

Instead of repeatedly reading records, poll the tail position to detect changes:
For real-time updates, prefer using streaming reads instead.

Read from N Minutes Ago

Combine tail check with timestamp-based reads:

Notes

  • This is a lightweight operation that doesn’t read record data
  • The tail position may change immediately after this call due to concurrent appends
  • For empty streams, both seq_num and timestamp are 0
  • Sequence numbers are always contiguous with no gaps
  • The timestamp of the tail represents the last record’s timestamp, not the current time
  • Deleted streams return 404 Not Found, not a zero tail