Appearance
Commit event
POST /v4/stream/{stream}
Commit a binary event to a stream. The path parameter stream specifies which stream to commit to.
Request body
The request body should contain the binary event data as application/octet-stream.
Response schema
| Field | Type | Description |
|---|---|---|
| tx | integer<int64> | Event ID of the commit operation. |
| duration | string | Time taken to process the commit request, returned in a human-readable format (e.g., "1.234567ms"). |
Example
Commit a text event
sh
curl --location 'https://api.litebase.io/v4/stream/sample' \
--header 'Content-Type: text/plain' \
--header "Authorization: Bearer $LITEBASE_API_KEY" \
--data 'hello world'Response:
json
HTTP/1.1 200 OK
Content-Type: application/json
{
"tx": 1,
"duration": "2.345678ms"
}Commit a JSON event
sh
curl --location 'https://api.litebase.io/v4/stream/sample' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $LITEBASE_API_KEY" \
--data '{"name": "Braavos", "type": "city_created"}'Response:
json
HTTP/1.1 200 OK
Content-Type: application/json
{
"tx": 2,
"duration": "2.345678ms"
}Commit a binary event
sh
curl --location 'https://api.litebase.io/v4/stream/sample' \
--header 'Content-Type: application/octet-stream' \
--header "Authorization: Bearer $LITEBASE_API_KEY" \
--data-binary '@image.png'Response:
json
HTTP/1.1 200 OK
Content-Type: application/json
{
"tx": 3,
"duration": "2.345678ms"
}Note: The binary event format is client implementation specific.