Create a Kafka cluster
Create a Kafka cluster, and optionally its first topics.
Bearer $TOKEN
application/json
The ID of the team to create the cluster in. betterstack team list shows it.
The cluster's name, at most 255 characters.
The cluster's type, such as KA1. List the types with betterstack kafka-type list.
The Kafka version, such as 4.4. List the versions with betterstack kafka-version list. Defaults to the latest version.
The number of brokers, 1 or 3. Defaults to 3. Can't be changed later. A single broker keeps one copy of your data, so a lost broker can't be rebuilt from another one.
Whether the cluster also gets public bootstrap and broker endpoints. The public endpoints use the same TLS and SCRAM credentials as the private ones.
The IDs of your networks to attach to every broker. The networks must be in the cluster's team.
The ID of a firewall to attach to every broker, at most one. The firewall must be in the cluster's team.
Topics to create with the cluster. The topics must fit in the storage budget, as when you create a topic later.
The topic's name, 1–249 letters, digits, dots, hyphens or underscores. A name can't be . or .., and can't start with __.
The number of partitions, at least 1. All topics together must fit within the type's max_partitions.
The most data to keep in each partition, in bytes, at least 1048576. All topics together, plus one segment for each partition, must fit in the cluster's storage budget.
How long to keep messages, in milliseconds, at least 60000. Send -1 to keep them with no time limit. retention_bytes still limits the size.
How Kafka removes old messages. Defaults to delete.
Valid values:delete: Deletes messages older than the retention time or past the retention size.compact: Keeps only the latest message for each key.compact_delete: Keeps only the latest message for each key, and also deletes messages past retention. Kafka calls it compact,delete.
The largest message the topic accepts, in bytes, from 1024 to 8388608.
The billing term. Defaults to monthly. Possible values: monthly, annual.
Your tags, as an object of string keys and values. Accepts any keys.
{
"id": "example",
"name": "Example Kafka cluster",
"type": "KA1",
"broker_count": 50,
"replication_factor": 1,
"min_insync_replicas": 1,
"usable_storage_gb": 1,
"max_partitions": 1,
"storage_budget_bytes": 1,
"storage_budget_used_bytes": 1,
"partition_count": 50,
"engine_version": "1.4.2",
"engine_patch_version": "1.4.2",
"available_engine_versions": [
"1.4.2"
],
"status": "provisioning",
"status_message": "example",
"public_access": false,
"endpoint": {
"bootstrap_servers": "example",
"hostname": "proxy.example.com",
"port": 443,
"security_protocol": "example",
"sasl_mechanism": "example",
"brokers": [
{
"node_id": 123456789,
"hostname": "proxy.example.com"
}
],
"public_bootstrap_servers": "example",
"public_hostname": "proxy.example.com",
"public_port": 443,
"public_brokers": [
{
"node_id": 123456789,
"hostname": "proxy.example.com"
}
]
},
"brokers": [
{
"id": "example",
"node_id": 123456789,
"status": "provisioning",
"hostname": "proxy.example.com",
"disk_used_bytes": 1,
"under_replicated_partitions": 1,
"private_ips": [
{
"network_id": "123456789",
"ip_address": "example"
}
],
"last_seen_at": "2026-07-01T12:00:00.000Z"
}
],
"topics": [
{
"id": "example",
"name": "Example",
"partitions": 1,
"replication_factor": 1,
"retention_bytes": 1,
"retention_ms": 1,
"cleanup_policy": "delete",
"max_message_bytes": 1,
"budget_bytes": 1,
"created_at": "2026-07-01T12:00:00.000Z",
"updated_at": "2026-07-01T12:00:00.000Z"
}
],
"users": [
{
"id": "example",
"username": "example",
"default_user": false,
"privileges": [
{
"topic_pattern": "example",
"permission": "consume"
}
],
"created_at": "2026-07-01T12:00:00.000Z",
"updated_at": "2026-07-01T12:00:00.000Z"
}
],
"network_ids": [
"123456789"
],
"firewall_ids": [
"123456789"
],
"term": "monthly",
"created_at": "2026-07-01T12:00:00.000Z",
"updated_at": "2026-07-01T12:00:00.000Z",
"team_id": "t123",
"metadata": {
"example": "value"
}
}
{
"error": {
"message": "Malformed JSON body.",
"code": "bad_request"
}
}
{
"error": {
"message": "Missing or invalid token.",
"code": "unauthorized"
}
}
{
"error": {
"message": "We require at least one successful credit card transaction before allowing billable actions via the API. This significantly helps us to prevent fraud. Once your first transaction is processed, you will be able to use the API unrestricted. Please add credit to your account at https://betterstack.com/settings/billing/card/new?credits=10&activate_api=true. Need help? We're here for you at hello@betterstack.com.",
"code": "payment_required"
}
}
{
"error": {
"message": "The request could not be completed right now. Please try again in a few moments.",
"code": "internal_error"
}
}
Returns the newly created Kafka cluster.
The body isn't valid JSON.
The API token is missing or invalid.
The organization hasn't made its first payment yet, and the request creates a resource we charge for. The code is payment_required. A request that creates a server, load balancer, object cache, database, reserved IP or volume can also return first_purchase. The url in first_purchase opens a page where you make the payment. The resource is created after the payment. The page works until expires_at, 24 hours after the response.
The organization has reached its quota of Kafka clusters. The code is quota_exceeded.
The team, type, network or firewall doesn't exist, or your token can't access it.
The resource's state doesn't allow the request, such as starting a running server or removing a placement group that still has servers.
A value isn't valid, such as a broker_count other than 1 or 3, or a topic that doesn't fit. The code is validation_failed.
We've locked the resource, with the code locked. Every change to a locked resource is refused, and so is a change that involves one.
Too many requests, with the code rate_limited. We limit requests per client IP and per organization, and some costly endpoints have a stricter limit. Wait as long as the Retry-After header says.
An unexpected, temporary error on our side, with the code internal_error. Try again.
Another Kafka cluster is being created in the organization at the same time, with the code concurrent_create_limit. Or we couldn't start the brokers, with the code orchestration_failed. Try again shortly.
The cluster's ID, a UUID.
The cluster's name, at most 255 characters, unique among your organization's clusters that aren't destroyed or failed.
The cluster's type, such as KA1.
The number of brokers, 1 for development or 3 to survive the loss of a broker. Can't be changed after the cluster is created.
The number of copies of each partition, always equal to broker_count. Every broker stores every partition.
The number of copies that must confirm a write, 1 with one broker and 2 with three.
The storage for your topics on each broker, in GiB.
The most partitions the cluster's type allows across all topics.
The storage budget of each broker, in bytes. Every topic must fit in it.
The storage your topics reserve, in bytes. Each topic reserves its retention_bytes times its number of partitions, plus one segment for each partition.
The number of partitions across all topics.
The Kafka version as major and minor, such as 4.4.
The exact Kafka release installed, such as 4.4.0.
The version you can upgrade the cluster to, the next one we offer. The list is empty when the cluster runs the newest version.
The cluster's state.
Valid values:provisioning: We're starting the brokers and installing Kafka.running: The cluster is ready. Right after it's created, brokers can still be starting.degraded: A broker is down, partitions are missing copies or a disk is almost full. status_message says which.rescaling: We're changing the cluster's type.upgrading: We're upgrading the cluster to a newer Kafka version.failed: We couldn't create the cluster. status_message says why.destroyed: The cluster is destroyed.
Why the cluster is in its current state, such as which broker is down, or null when there's nothing to report.
Whether the cluster also has public endpoints. Clients connect with TLS and SCRAM on both the private and the public endpoints.
The addresses clients connect to, the bootstrap address and one for each broker. The fields that start with public_ are only present when public_access is on. Clients must reach every broker, not only the bootstrap address.
The bootstrap servers.
The hostname.
The port.
The security protocol.
The sasl mechanism.
The brokers.
The node id.
The hostname.
The public bootstrap servers.
The public hostname.
The public port.
The public brokers.
The node id.
The hostname.
The cluster's brokers, with their addresses on your networks and their last reported health. All brokers have the same role.
The id.
The node id.
Possible values: provisioning, starting, running, down.
The hostname.
The disk used bytes.
The under replicated partitions.
The private ips.
The network id.
The ip address.
In ISO 8601 format, such as 2026-07-01T12:00:00Z.
The cluster's topics, ordered by name. Add, update or remove them with betterstack kafka-topic.
The id.
The name.
The partitions.
The replication factor.
The retention bytes.
The retention ms.
Possible values: delete, compact, compact_delete.
The max message bytes.
The budget bytes.
In ISO 8601 format, such as 2026-07-01T12:00:00Z.
In ISO 8601 format, such as 2026-07-01T12:00:00Z.
The cluster's users, ordered by username. Add, update or remove them with betterstack kafka-user, which also gets their passwords.
The id.
The username.
The default user.
The privileges.
The topic pattern.
Possible values: consume, produce, produce_consume.
In ISO 8601 format, such as 2026-07-01T12:00:00Z.
In ISO 8601 format, such as 2026-07-01T12:00:00Z.
The IDs of your networks attached to every broker. Order doesn't matter.
The ID of the firewall attached to every broker, at most one. Order doesn't matter.
The billing term. Defaults to monthly.
Valid values:monthly: Billed every month.annual: Paid for a year.
When the cluster was created. In ISO 8601 format, such as 2026-07-01T12:00:00Z.
When the cluster was last updated. In ISO 8601 format, such as 2026-07-01T12:00:00Z.
The ID of the team that owns the cluster.
Your tags, as an object of string keys and values.