Interface definition is in s2-streamstore/s2-protos.

Buf documentation is also available, as an alternative to this reference.

AccountService

Operate on an S2 account.

Method NameRequest TypeResponse TypeDescriptionOptions
ListBasinsListBasinsRequestListBasinsResponseList basins.
  • idempotency_level: NO_SIDE_EFFECTS
CreateBasinCreateBasinRequestCreateBasinResponseCreate a new basin. Provide a client request token with the S2-Request-Token header for idempotent retry behaviour.
  • idempotency_level: IDEMPOTENT
DeleteBasinDeleteBasinRequestDeleteBasinResponseDelete a basin. Basin deletion is asynchronous, and may take a few minutes to complete.
  • idempotency_level: IDEMPOTENT
ReconfigureBasinReconfigureBasinRequestReconfigureBasinResponseUpdate basin configuration.
  • idempotency_level: IDEMPOTENT
GetBasinConfigGetBasinConfigRequestGetBasinConfigResponseGet basin configuration.
  • idempotency_level: NO_SIDE_EFFECTS
IssueAccessTokenIssueAccessTokenRequestIssueAccessTokenResponseIssue a new access token.None
RevokeAccessTokenRevokeAccessTokenRequestRevokeAccessTokenResponseRevoke an access token.
  • idempotency_level: IDEMPOTENT
ListAccessTokensListAccessTokensRequestListAccessTokensResponseList access tokens.
  • idempotency_level: NO_SIDE_EFFECTS

BasinService

Operate on an S2 basin.

Method NameRequest TypeResponse TypeDescriptionOptions
ListStreamsListStreamsRequestListStreamsResponseList streams.
  • idempotency_level: NO_SIDE_EFFECTS
CreateStreamCreateStreamRequestCreateStreamResponseCreate a stream. Provide a client request token with the S2-Request-Token header for idempotent retry behaviour.
  • idempotency_level: IDEMPOTENT
DeleteStreamDeleteStreamRequestDeleteStreamResponseDelete a stream. Stream deletion is asynchronous, and may take a few minutes to complete.
  • idempotency_level: IDEMPOTENT
GetStreamConfigGetStreamConfigRequestGetStreamConfigResponseGet stream configuration.
  • idempotency_level: NO_SIDE_EFFECTS
ReconfigureStreamReconfigureStreamRequestReconfigureStreamResponseUpdate stream configuration.
  • idempotency_level: IDEMPOTENT

StreamService

Operate on an S2 stream.

Method NameRequest TypeResponse TypeDescriptionOptions
CheckTailCheckTailRequestCheckTailResponseCheck the sequence number that will be assigned to the next record on a stream.
  • idempotency_level: NO_SIDE_EFFECTS
AppendAppendRequestAppendResponseAppend a batch of records to a stream.None
AppendSessionAppendSessionRequest streamAppendSessionResponse streamAppend batches of records to a stream continuously, while guaranteeing pipelined requests are processed in order. If any request fails, the session is terminated.None
ReadReadRequestReadResponseRetrieve a batch of records from a stream.
  • idempotency_level: NO_SIDE_EFFECTS
ReadSessionReadSessionRequestReadSessionResponse streamRetrieve batches of records from a stream continuously.
  • idempotency_level: NO_SIDE_EFFECTS

AccessTokenInfo

Access token information.

FieldTypeLabelDescription
idstringAccess token ID. It must be unique to the account and between 1 and 50 characters.
expires_atuint32optionalExpiration time in seconds since Unix epoch. If not set, the expiration will be set to that of the requestor’s token.
auto_prefix_streamsboolNamespace streams based on the configured stream-level scope, which must be a prefix. Stream name arguments will be automatically prefixed, and the prefix will be stripped when listing streams.
scopeAccessTokenScopeAccess token scope.

AccessTokenScope

Access token scope.

FieldTypeLabelDescription
basinsResourceSetBasin names allowed.
streamsResourceSetStream names allowed.
tokensResourceSetToken IDs allowed.
op_groupsPermittedOperationGroupsAccess permissions at operation group level.
opsOperationrepeatedOperations allowed for the token. A union of allowed operations and groups is used as an effective set of allowed operations.

AppendInput

Input for append requests.

FieldTypeLabelDescription
streamstringStream name. Optional for subsequent requests in the session.
recordsAppendRecordrepeatedBatch of records to append atomically, which must contain at least one record, and no more than 1000. The total size of a batch of records may not exceed 1MiB of metered bytes.
match_seq_numuint64optionalEnforce that the sequence number issued to the first record matches.
fencing_tokenbytesoptionalEnforce a fencing token which must have been previously set by a fence command record.

AppendOutput

Output from append response.

FieldTypeLabelDescription
start_seq_numuint64Sequence number of first record appended.
end_seq_numuint64Sequence number of last record appended + 1. end_seq_num - start_seq_num will be the number of records in the batch.
next_seq_numuint64Sequence number of last durable record on the stream + 1. This can be greater than end_seq_num in case of concurrent appends.

AppendRecord

Record to be appended to a stream.

FieldTypeLabelDescription
timestampuint64optionalTimestamp for this record in milliseconds since Unix epoch. The service ensures monotonicity by adjusting it up if necessary to the maximum observed timestamp. A timestamp detected to be in the future will be adjusted down. If not provided, the semantics depend on the stream’s require_client_timestamps config.
headersHeaderrepeatedSeries of name-value pairs for this record.
bodybytesBody of this record.

AppendRequest

Append request.

FieldTypeLabelDescription
inputAppendInputRequest parameters for an append.

AppendResponse

Append response.

FieldTypeLabelDescription
outputAppendOutputResponse details for an append.

AppendSessionRequest

Append session request.

FieldTypeLabelDescription
inputAppendInputRequest parameters for an append.

AppendSessionResponse

Append session response.

FieldTypeLabelDescription
outputAppendOutputResponse details for an append.

BasinConfig

Basin configuration.

FieldTypeLabelDescription
default_stream_configStreamConfigDefault stream configuration.
create_stream_on_appendboolCreate stream on append if it doesn’t exist, using the default stream configuration.
create_stream_on_readboolCreate stream on read if it doesn’t exist, using the default stream configuration.

BasinInfo

Basin information.

FieldTypeLabelDescription
namestringBasin name.
scopeBasinScopeBasin scope.
stateBasinStateBasin state.

CheckTailRequest

Check tail request.

FieldTypeLabelDescription
streamstringStream name.

CheckTailResponse

Check tail response.

FieldTypeLabelDescription
next_seq_numuint64Sequence number that will be assigned to the next record on the stream.

CreateBasinRequest

Create basin request.

FieldTypeLabelDescription
basinstringBasin name, which must be globally unique. It can be omitted to let the service assign a unique name. The name must be between 8 and 48 characters, comprising lowercase letters, numbers and hyphens. It cannot begin or end with a hyphen.
configBasinConfigBasin configuration.
scopeBasinScopeBasin scope.

CreateBasinResponse

Create basin response.

FieldTypeLabelDescription
infoBasinInfoInformation about the newly created basin.

CreateStreamRequest

Create stream request.

FieldTypeLabelDescription
streamstringStream name, which must be unique within the basin. It can be an arbitrary string upto 512 characters. Backslash (/) is recommended as a delimiter for hierarchical naming.
configStreamConfigConfiguration for the new stream.

CreateStreamResponse

Create stream response.

FieldTypeLabelDescription
infoStreamInfoInformation about the newly created stream.

DeleteBasinRequest

Delete basin request.

FieldTypeLabelDescription
basinstringName of the basin to delete.

DeleteBasinResponse

Delete basin response.

DeleteStreamRequest

Delete stream request.

FieldTypeLabelDescription
streamstringStream name.

DeleteStreamResponse

Delete stream response.

GetBasinConfigRequest

Get basin configuration request.

FieldTypeLabelDescription
basinstringBasin name.

GetBasinConfigResponse

Get basin configuration response.

FieldTypeLabelDescription
configBasinConfigBasin configuration.

GetStreamConfigRequest

Get stream configuration request.

FieldTypeLabelDescription
streamstringStream name.

GetStreamConfigResponse

Get stream configuration response.

FieldTypeLabelDescription
configStreamConfigStream configuration.

Headers add structured information to a record as name-value pairs.

FieldTypeLabelDescription
namebytesHeader name blob. The name cannot be empty, with the exception of an S2 command record.
valuebytesHeader value blob.

IssueAccessTokenRequest

Issue access token request.

FieldTypeLabelDescription
infoAccessTokenInfoAccess token information.

IssueAccessTokenResponse

Issue access token response.

FieldTypeLabelDescription
tokenstringCreated token.

ListAccessTokensRequest

List access tokens request.

FieldTypeLabelDescription
prefixstringList access tokens that begin with this prefix.
start_afterstringOnly return access tokens that lexicographically start after this token ID.
limituint64optionalNumber of results, up to a maximum of 1000.

ListAccessTokensResponse

List access tokens response.

FieldTypeLabelDescription
tokensAccessTokenInforepeatedAccess tokens information.
has_moreboolIf set, indicates there are more results that can be listed with start_after.

ListBasinsRequest

List basins request.

FieldTypeLabelDescription
prefixstringList basin names that begin with this prefix.
start_afterstringOnly return basins names that lexicographically start after this name. This can be the last basin name seen in a previous listing, to continue from there. It must be greater than or equal to the prefix if specified.
limituint64optionalNumber of results, up to a maximum of 1000.

ListBasinsResponse

List basins response.

FieldTypeLabelDescription
basinsBasinInforepeatedMatching basins.
has_moreboolIf set, indicates there are more results that can be listed with start_after.

ListStreamsRequest

List streams request.

FieldTypeLabelDescription
prefixstringList stream names that begin with this prefix.
start_afterstringOnly return stream names that lexicographically start after this name. This can be the last stream name seen in a previous listing, to continue from there. It must be greater than or equal to the prefix if specified.
limituint64optionalNumber of results, up to a maximum of 1000.

ListStreamsResponse

List streams response.

FieldTypeLabelDescription
streamsStreamInforepeatedMatching streams.
has_moreboolIf set, indicates there are more results that can be listed with start_after.

PermittedOperationGroups

Access permissions for a group.

FieldTypeLabelDescription
accountReadWritePermissionsAccess permissions at account level.
basinReadWritePermissionsAccess permissions at basin level.
streamReadWritePermissionsAccess permissions at stream level.

ReadLimit

Limit how many records can be retrieved. If both count and bytes are specified, either limit may be hit.

FieldTypeLabelDescription
countuint64optionalRecord count limit.
bytesuint64optionalMetered bytes limit.

ReadOutput

Output of a read.

FieldTypeLabelDescription
batchSequencedRecordBatchBatch of records. It can only be empty outside of a session context, if the request cannot be satisfied without violating its limit.
next_seq_numuint64Tail of the stream, i.e. sequence number that will be assigned to the next record. It will primarily be returned either because the requested starting point was larger, or only in case of a limited read, equal to the tail. It will also be returned if there are no records on the stream between the requested starting point and the tail.

ReadRequest

Read request.

FieldTypeLabelDescription
streamstringStream name.
start_seq_numuint64Starting sequence number (inclusive).
limitReadLimitLimit how many records can be returned. This will get capped at the default limit, which is up to 1000 records or 1MiB of metered bytes.

ReadResponse

Read response.

FieldTypeLabelDescription
outputReadOutputResponse details for a read.

ReadSessionRequest

Read session request.

FieldTypeLabelDescription
streamstringStream name.
start_seq_numuint64Starting sequence number (inclusive).
limitReadLimitLimit on how many records can be returned. When a limit is specified, the session will be terminated as soon as the limit is met, or when the current tail of the stream is reached — whichever occurs first. If no limit is specified, the session will remain open after catching up to the tail, and continue tailing as new messages are written to the stream.
heartbeatsboolHeartbeats can be enabled to monitor end-to-end session health. A heartbeat will be sent when the initial switch to real-time tailing happens, as well as when no records are available at a randomized interval between 5 and 15 seconds.

ReadSessionResponse

Read session response.

FieldTypeLabelDescription
outputReadOutputoptionalResponse details for a read. This will not be set in case of a heartbeat message.

ReadWritePermissions

Read/Write permissions.

FieldTypeLabelDescription
readboolRead permission.
writeboolWrite permission.

ReconfigureBasinRequest

Reconfigure basin request.

FieldTypeLabelDescription
basinstringBasin name.
configBasinConfigBasin configuration.
maskgoogle.protobuf.FieldMaskSpecifies the pieces of configuration being updated. See https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask

ReconfigureBasinResponse

Reconfigure basin response.

FieldTypeLabelDescription
configBasinConfigBasin configuration.

ReconfigureStreamRequest

Reconfigure stream request.

FieldTypeLabelDescription
streamstringStream name.
configStreamConfigStream configuration with updated values.
maskgoogle.protobuf.FieldMaskSpecifies the pieces of configuration being updated. See https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask

ReconfigureStreamResponse

Reconfigure stream response.

FieldTypeLabelDescription
configStreamConfigStream configuration.

ResourceSet

Set of named resources.

FieldTypeLabelDescription
exactstringMatch only the resource with this exact name. Use an empty string to match no resources.
prefixstringMatch all resources that start with this prefix. Use an empty string to match all resource.

RevokeAccessTokenRequest

Revoke access token request.

FieldTypeLabelDescription
idstringToken to revoke.

RevokeAccessTokenResponse

Revoke access token response.

FieldTypeLabelDescription
infoAccessTokenInfoAccess token information.

SequencedRecord

Record retrieved from a stream.

FieldTypeLabelDescription
seq_numuint64Sequence number assigned to this record.
timestampuint64Timestamp for this record in milliseconds since Unix epoch.
headersHeaderrepeatedSeries of name-value pairs for this record.
bodybytesBody of this record.

SequencedRecordBatch

A batch of sequenced records.

FieldTypeLabelDescription
recordsSequencedRecordrepeatedBatch of sequenced records.

StreamConfig

Stream configuration.

FieldTypeLabelDescription
storage_classStorageClassStorage class for recent writes. This is the main cost:performance knob in S2.
ageuint64Age in seconds for automatic trimming of records older than this threshold. If set to 0, the stream will have infinite retention.
require_client_timestampsbooloptionalControls how to handle timestamps when they are not provided by the client. If this is false (or not set), the record’s arrival time will be assigned as its timestamp. If this is true, then any append without a client-specified timestamp will be rejected as invalid.

StreamInfo

Stream information.

FieldTypeLabelDescription
namestringStream name.
created_atuint32Creation time in seconds since Unix epoch.
deleted_atuint32optionalDeletion time in seconds since Unix epoch, if the stream is being deleted.

BasinScope

Basin scope.

NameNumberDescription
BASIN_SCOPE_UNSPECIFIED0Unspecified basin scope.
BASIN_SCOPE_AWS_US_EAST_11aws us-east-1 region.

BasinState

Current state of the basin.

NameNumberDescription
BASIN_STATE_UNSPECIFIED0Unspecified.
BASIN_STATE_ACTIVE1Basin is active.
BASIN_STATE_CREATING2Basin is being created.
BASIN_STATE_DELETING3Basin is being deleted.

Operation

API operations.

NameNumberDescription
OPERATION_UNSPECIFIED0Unspecified operation.
OPERATION_LIST_BASINS1List basins.
OPERATION_CREATE_BASIN2Create a basin.
OPERATION_DELETE_BASIN3Delete a basin.
OPERATION_RECONFIGURE_BASIN4Update basin configuration.
OPERATION_GET_BASIN_CONFIG5Get basin configuration.
OPERATION_ISSUE_ACCESS_TOKEN6Issue an access token.
OPERATION_REVOKE_ACCESS_TOKEN7Revoke an access token.
OPERATION_LIST_ACCESS_TOKENS8List access tokens.
OPERATION_LIST_STREAMS9List streams.
OPERATION_CREATE_STREAM10Create a stream.
OPERATION_DELETE_STREAM11Delete a stream.
OPERATION_GET_STREAM_CONFIG12Get stream configuration.
OPERATION_RECONFIGURE_STREAM13Update stream configuration.
OPERATION_CHECK_TAIL14Check tail of a stream.
OPERATION_APPEND15Append records to a stream.
OPERATION_READ16Read records from a stream.
OPERATION_TRIM17Trim records up to a sequence number.
OPERATION_FENCE18Set a fencing token for a stream.

StorageClass

Storage class for recent writes.

NameNumberDescription
STORAGE_CLASS_UNSPECIFIED0Unspecified, which is currently overridden to STORAGE_CLASS_EXPRESS.
STORAGE_CLASS_STANDARD1Standard, which offers end-to-end latencies under 500 ms.
STORAGE_CLASS_EXPRESS2Express, which offers end-to-end latencies under 50 ms.