Create a new Kafka topic
curl --request POST \
--url https://api.streamkap.com/topics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"topic_name": "<string>",
"num_partitions": 1,
"replication_factor": 2,
"min_insync_replicas": 2,
"retention_ms": 0,
"retention_bytes": 0,
"max_message_bytes": 2,
"custom_configs": {},
"tags": [
"<string>"
]
}
'import requests
url = "https://api.streamkap.com/topics"
payload = {
"topic_name": "<string>",
"num_partitions": 1,
"replication_factor": 2,
"min_insync_replicas": 2,
"retention_ms": 0,
"retention_bytes": 0,
"max_message_bytes": 2,
"custom_configs": {},
"tags": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
topic_name: '<string>',
num_partitions: 1,
replication_factor: 2,
min_insync_replicas: 2,
retention_ms: 0,
retention_bytes: 0,
max_message_bytes: 2,
custom_configs: {},
tags: ['<string>']
})
};
fetch('https://api.streamkap.com/topics', 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.streamkap.com/topics",
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([
'topic_name' => '<string>',
'num_partitions' => 1,
'replication_factor' => 2,
'min_insync_replicas' => 2,
'retention_ms' => 0,
'retention_bytes' => 0,
'max_message_bytes' => 2,
'custom_configs' => [
],
'tags' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.streamkap.com/topics"
payload := strings.NewReader("{\n \"topic_name\": \"<string>\",\n \"num_partitions\": 1,\n \"replication_factor\": 2,\n \"min_insync_replicas\": 2,\n \"retention_ms\": 0,\n \"retention_bytes\": 0,\n \"max_message_bytes\": 2,\n \"custom_configs\": {},\n \"tags\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.streamkap.com/topics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"topic_name\": \"<string>\",\n \"num_partitions\": 1,\n \"replication_factor\": 2,\n \"min_insync_replicas\": 2,\n \"retention_ms\": 0,\n \"retention_bytes\": 0,\n \"max_message_bytes\": 2,\n \"custom_configs\": {},\n \"tags\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.streamkap.com/topics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"topic_name\": \"<string>\",\n \"num_partitions\": 1,\n \"replication_factor\": 2,\n \"min_insync_replicas\": 2,\n \"retention_ms\": 0,\n \"retention_bytes\": 0,\n \"max_message_bytes\": 2,\n \"custom_configs\": {},\n \"tags\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"entity": {
"entity_type": "sources",
"entity_id": "<string>",
"name": "<string>",
"connector": "alloydb",
"topic_ids": [
"<string>"
],
"topic_db_ids": [
"<string>"
],
"display_name": "<string>",
"filtered_snapshot_language": "<string>"
},
"num_partitions": 123,
"replication_factor": 123,
"prefix": "<string>",
"serialization": {
"key_format": "unknown",
"value_format": "unknown",
"key_converter": "<string>",
"value_converter": "<string>",
"schema_registry_enabled": false
},
"warnings": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Topics
Create a new Kafka topic
POST
/
topics
Create a new Kafka topic
curl --request POST \
--url https://api.streamkap.com/topics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"topic_name": "<string>",
"num_partitions": 1,
"replication_factor": 2,
"min_insync_replicas": 2,
"retention_ms": 0,
"retention_bytes": 0,
"max_message_bytes": 2,
"custom_configs": {},
"tags": [
"<string>"
]
}
'import requests
url = "https://api.streamkap.com/topics"
payload = {
"topic_name": "<string>",
"num_partitions": 1,
"replication_factor": 2,
"min_insync_replicas": 2,
"retention_ms": 0,
"retention_bytes": 0,
"max_message_bytes": 2,
"custom_configs": {},
"tags": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
topic_name: '<string>',
num_partitions: 1,
replication_factor: 2,
min_insync_replicas: 2,
retention_ms: 0,
retention_bytes: 0,
max_message_bytes: 2,
custom_configs: {},
tags: ['<string>']
})
};
fetch('https://api.streamkap.com/topics', 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.streamkap.com/topics",
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([
'topic_name' => '<string>',
'num_partitions' => 1,
'replication_factor' => 2,
'min_insync_replicas' => 2,
'retention_ms' => 0,
'retention_bytes' => 0,
'max_message_bytes' => 2,
'custom_configs' => [
],
'tags' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.streamkap.com/topics"
payload := strings.NewReader("{\n \"topic_name\": \"<string>\",\n \"num_partitions\": 1,\n \"replication_factor\": 2,\n \"min_insync_replicas\": 2,\n \"retention_ms\": 0,\n \"retention_bytes\": 0,\n \"max_message_bytes\": 2,\n \"custom_configs\": {},\n \"tags\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.streamkap.com/topics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"topic_name\": \"<string>\",\n \"num_partitions\": 1,\n \"replication_factor\": 2,\n \"min_insync_replicas\": 2,\n \"retention_ms\": 0,\n \"retention_bytes\": 0,\n \"max_message_bytes\": 2,\n \"custom_configs\": {},\n \"tags\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.streamkap.com/topics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"topic_name\": \"<string>\",\n \"num_partitions\": 1,\n \"replication_factor\": 2,\n \"min_insync_replicas\": 2,\n \"retention_ms\": 0,\n \"retention_bytes\": 0,\n \"max_message_bytes\": 2,\n \"custom_configs\": {},\n \"tags\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"entity": {
"entity_type": "sources",
"entity_id": "<string>",
"name": "<string>",
"connector": "alloydb",
"topic_ids": [
"<string>"
],
"topic_db_ids": [
"<string>"
],
"display_name": "<string>",
"filtered_snapshot_language": "<string>"
},
"num_partitions": 123,
"replication_factor": 123,
"prefix": "<string>",
"serialization": {
"key_format": "unknown",
"value_format": "unknown",
"key_converter": "<string>",
"value_converter": "<string>",
"schema_registry_enabled": false
},
"warnings": []
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Kafka topic name
Required string length:
1 - 249Number of partitions
Required range:
x >= 1Replication factor (defaults to broker count)
Required range:
x >= 1Topic cleanup policy
Available options:
delete, compact, delete,compact Minimum in-sync replicas
Required range:
x >= 1Time to retain data in ms (-1 for unlimited)
Required range:
x >= -1Max size on disk in bytes (-1 for unlimited)
Required range:
x >= -1Maximum message size in bytes
Required range:
x >= 1Additional topic configs as key-value pairs
Show child attributes
Show child attributes
Tag IDs to assign to the topic
Response
Successful Response
Show child attributes
Show child attributes
Serialization format information for a topic.
Topics inherit their serialization format from their producer (source/transform). Most Streamkap sources use Avro by default with Schema Registry.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
⌘I