Create Basin
curl --request POST \
--url https://api.example.com/basins \
--header 'Content-Type: application/json' \
--data '
{
"basin": "<string>",
"config": {
"default_stream_config": {
"storage_class": "<string>",
"retention_policy": {},
"timestamping": {
"mode": "<string>",
"uncapped": true
},
"delete_on_empty": {
"min_age_secs": 123
}
},
"create_stream_on_append": true,
"create_stream_on_read": true
},
"scope": "<string>"
}
'import requests
url = "https://api.example.com/basins"
payload = {
"basin": "<string>",
"config": {
"default_stream_config": {
"storage_class": "<string>",
"retention_policy": {},
"timestamping": {
"mode": "<string>",
"uncapped": True
},
"delete_on_empty": { "min_age_secs": 123 }
},
"create_stream_on_append": True,
"create_stream_on_read": True
},
"scope": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
basin: '<string>',
config: {
default_stream_config: {
storage_class: '<string>',
retention_policy: {},
timestamping: {mode: '<string>', uncapped: true},
delete_on_empty: {min_age_secs: 123}
},
create_stream_on_append: true,
create_stream_on_read: true
},
scope: '<string>'
})
};
fetch('https://api.example.com/basins', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/basins",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'basin' => '<string>',
'config' => [
'default_stream_config' => [
'storage_class' => '<string>',
'retention_policy' => [
],
'timestamping' => [
'mode' => '<string>',
'uncapped' => true
],
'delete_on_empty' => [
'min_age_secs' => 123
]
],
'create_stream_on_append' => true,
'create_stream_on_read' => true
],
'scope' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/basins"
payload := strings.NewReader("{\n \"basin\": \"<string>\",\n \"config\": {\n \"default_stream_config\": {\n \"storage_class\": \"<string>\",\n \"retention_policy\": {},\n \"timestamping\": {\n \"mode\": \"<string>\",\n \"uncapped\": true\n },\n \"delete_on_empty\": {\n \"min_age_secs\": 123\n }\n },\n \"create_stream_on_append\": true,\n \"create_stream_on_read\": true\n },\n \"scope\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/basins")
.header("Content-Type", "application/json")
.body("{\n \"basin\": \"<string>\",\n \"config\": {\n \"default_stream_config\": {\n \"storage_class\": \"<string>\",\n \"retention_policy\": {},\n \"timestamping\": {\n \"mode\": \"<string>\",\n \"uncapped\": true\n },\n \"delete_on_empty\": {\n \"min_age_secs\": 123\n }\n },\n \"create_stream_on_append\": true,\n \"create_stream_on_read\": true\n },\n \"scope\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/basins")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"basin\": \"<string>\",\n \"config\": {\n \"default_stream_config\": {\n \"storage_class\": \"<string>\",\n \"retention_policy\": {},\n \"timestamping\": {\n \"mode\": \"<string>\",\n \"uncapped\": true\n },\n \"delete_on_empty\": {\n \"min_age_secs\": 123\n }\n },\n \"create_stream_on_append\": true,\n \"create_stream_on_read\": true\n },\n \"scope\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"scope": "<string>",
"state": "<string>"
}Basins
Create Basin
POST
/
basins
Create Basin
curl --request POST \
--url https://api.example.com/basins \
--header 'Content-Type: application/json' \
--data '
{
"basin": "<string>",
"config": {
"default_stream_config": {
"storage_class": "<string>",
"retention_policy": {},
"timestamping": {
"mode": "<string>",
"uncapped": true
},
"delete_on_empty": {
"min_age_secs": 123
}
},
"create_stream_on_append": true,
"create_stream_on_read": true
},
"scope": "<string>"
}
'import requests
url = "https://api.example.com/basins"
payload = {
"basin": "<string>",
"config": {
"default_stream_config": {
"storage_class": "<string>",
"retention_policy": {},
"timestamping": {
"mode": "<string>",
"uncapped": True
},
"delete_on_empty": { "min_age_secs": 123 }
},
"create_stream_on_append": True,
"create_stream_on_read": True
},
"scope": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
basin: '<string>',
config: {
default_stream_config: {
storage_class: '<string>',
retention_policy: {},
timestamping: {mode: '<string>', uncapped: true},
delete_on_empty: {min_age_secs: 123}
},
create_stream_on_append: true,
create_stream_on_read: true
},
scope: '<string>'
})
};
fetch('https://api.example.com/basins', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/basins",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'basin' => '<string>',
'config' => [
'default_stream_config' => [
'storage_class' => '<string>',
'retention_policy' => [
],
'timestamping' => [
'mode' => '<string>',
'uncapped' => true
],
'delete_on_empty' => [
'min_age_secs' => 123
]
],
'create_stream_on_append' => true,
'create_stream_on_read' => true
],
'scope' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/basins"
payload := strings.NewReader("{\n \"basin\": \"<string>\",\n \"config\": {\n \"default_stream_config\": {\n \"storage_class\": \"<string>\",\n \"retention_policy\": {},\n \"timestamping\": {\n \"mode\": \"<string>\",\n \"uncapped\": true\n },\n \"delete_on_empty\": {\n \"min_age_secs\": 123\n }\n },\n \"create_stream_on_append\": true,\n \"create_stream_on_read\": true\n },\n \"scope\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/basins")
.header("Content-Type", "application/json")
.body("{\n \"basin\": \"<string>\",\n \"config\": {\n \"default_stream_config\": {\n \"storage_class\": \"<string>\",\n \"retention_policy\": {},\n \"timestamping\": {\n \"mode\": \"<string>\",\n \"uncapped\": true\n },\n \"delete_on_empty\": {\n \"min_age_secs\": 123\n }\n },\n \"create_stream_on_append\": true,\n \"create_stream_on_read\": true\n },\n \"scope\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/basins")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"basin\": \"<string>\",\n \"config\": {\n \"default_stream_config\": {\n \"storage_class\": \"<string>\",\n \"retention_policy\": {},\n \"timestamping\": {\n \"mode\": \"<string>\",\n \"uncapped\": true\n },\n \"delete_on_empty\": {\n \"min_age_secs\": 123\n }\n },\n \"create_stream_on_append\": true,\n \"create_stream_on_read\": true\n },\n \"scope\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"scope": "<string>",
"state": "<string>"
}Create a new basin with a globally unique name.
Headers
string
Client-specified request token for idempotent retries.
Body Parameters
string
required
Basin name which must be globally unique.
It can be between 8 and 48 bytes in length, and comprise lowercase letters, numbers and hyphens.
It cannot begin or end with a hyphen.
object
Basin configuration.
Show BasinConfig
Show BasinConfig
object
Default stream configuration.
Show StreamConfig
Show StreamConfig
string
Storage class for recent writes.
standard- Append tail latency under 400 millisecondsexpress- Append tail latency under 40 milliseconds
object
Retention policy for the stream. Defaults to 7 days if unspecified.
{"age": <seconds>}- Age in seconds (must be > 0){"infinite": {}}- Retain records unless explicitly trimmed
object
Timestamping behavior.
Show TimestampingConfig
Show TimestampingConfig
string
Timestamping mode:
client-prefer- Prefer client-specified timestamp if present otherwise use arrival time (default)client-require- Require a client-specified timestamparrival- Use arrival time and ignore client-specified timestamp
boolean
Allow client-specified timestamps to exceed the arrival time.
If false or not set, client timestamps will be capped at the arrival time.
boolean
default:"false"
Create stream on append if it doesn’t exist, using the default stream configuration.
boolean
default:"false"
Create stream on read if it doesn’t exist, using the default stream configuration.
string
Basin scope. This cannot be reconfigured after creation.
Possible values:
aws:us-east-1Response
string
Basin name.
string
Basin scope.
string
Basin state.
Example
curl -X POST "https://aws.s2.dev/v1/basins" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"basin": "my-new-basin",
"config": {
"default_stream_config": {
"storage_class": "standard",
"retention_policy": {"age": 604800}
},
"create_stream_on_append": true
},
"scope": "aws:us-east-1"
}'
Response (201 Created)
{
"name": "my-new-basin",
"scope": "aws:us-east-1",
"state": "creating"
}