Skip to main content

Create Topic

POST /public/v1/topics

Creates a new topic in the connected Kafka cluster with the specified configuration.


Request

Body Parameters

FieldTypeDescriptionRequired
namestringName of the topic to createYes
metadataobject (TopicMetadata)Topic metadata configurationYes
configsarray of objects (TopicConfig)Key-value configuration pairsOptional

TopicMetadata Structure

FieldTypeDescriptionRequired
partitionsintegerNumber of partitions for the topicYes
replicationFactorintegerReplication factor for the topicYes

TopicConfig Structure

FieldTypeDescriptionRequired
namestringConfiguration parameter nameYes
valuestringConfiguration parameter valueYes

Example Request

curl --location 'https://your-instance.com/public/v1/topics' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your-api-key>' \
--data-raw '{
"name": "my.new.topic",
"metadata": {
"partitions": 3,
"replicationFactor": 2
},
"configs": [
{
"name": "cleanup.policy",
"value": "delete"
},
{
"name": "retention.ms",
"value": "604800000"
}
]
}'

Response

HTTP Status Code: 200 OK
Response Body: (empty)


Possible Errors

Status CodeDescriptionSolution
400Invalid requestCheck your request payload format
401UnauthorizedCheck your API key
409Topic already existsUse a different topic name or delete the existing topic first

Best Practices

  • Choose an appropriate partition count based on expected throughput and parallelism.
  • Set a replication factor of at least 2–3 for data durability.
  • Configure retention policies carefully according to your data lifecycle requirements.