---
title: "Create a new Kafka topic"
method: POST
path: "/topics"
tags: ["Topics"]
---

# Create a new Kafka topic

`POST /topics`

## Request body

- CreateTopicReq
  - `topic_name` string, required — Kafka topic name
  - `num_partitions` integer — Number of partitions
  - `replication_factor` integer, nullable — Replication factor (defaults to broker count)
  - `cleanup_policy` 'delete' | 'compact' | 'delete,compact'
  - `min_insync_replicas` integer, nullable — Minimum in-sync replicas
  - `retention_ms` integer, nullable — Time to retain data in ms (-1 for unlimited)
  - `retention_bytes` integer, nullable — Max size on disk in bytes (-1 for unlimited)
  - `max_message_bytes` integer, nullable — Maximum message size in bytes
  - `custom_configs` object, nullable — Additional topic configs as key-value pairs
  - `tags` string[], nullable — Tag IDs to assign to the topic

## Response `201`

Successful Response

- CreateTopicRes
  - `id` string, required
  - `name` string, required
  - `entity` TopicDetailsEntity, required
    - `entity_type` 'sources' | 'destinations' | 'transforms' | 'pipelines' | 'manual', required — Enum for topic entity types (producer types).
    - `entity_id` string, required
    - `name` string, required
    - `connector` union, required
      - 'alloydb' | 'elasticsearch' | 'mongodbhosted' | 'mongodb' | 'sqlserveraws' | 'mariadb' | 'mysql' | 'postgresql' | 'oracle' | 'documentdb' | 'oracleaws' | 'kafkadirect' | 'redis' | 's3' | 'webhook' | 'zendesk_webhook' | 'salesforce_webhook' | 'shopify_webhook' | 'stripe_webhook' | 'db2' | 'dynamodb' | 'vitess' | 'planetscale' | 'supabase' | 'informix' — Available source connector types for CDC data ingestion. Includes relational databases (PostgreSQL, MySQL, SQL Server, Oracle), NoSQL databases (MongoDB, DynamoDB), and direct Kafka connections.
      - 'azblob' | 'clickhouse' | 'databricks' | 'mysql' | 'postgresql' | 'redshift' | 's3' | 'r2' | 'gcs' | 'motherduck' | 'weaviate' | 'pinecone' | 'httpsink' | 'sqlserver' | 'bigquery' | 'cockroachdb' | 'db2' | 'oracle' | 'redis' | 'snowflake' | 'starburst' | 'kafka' | 'kafkadirect' | 'iceberg' — Available destination connector types for data delivery. Supports data warehouses (Snowflake, BigQuery, Databricks), databases (ClickHouse, PostgreSQL), and object storage (S3, Iceberg).
      - 'fan_out' | 'sql_join' | 'enrich' | 'enrich_async' | 'map_filter' | 'toast_handling' | 'un_nesting' | 'rollup' | 'topic_router'
      - string
    - `topic_ids` string[], required
    - `topic_db_ids` string[], required
    - `display_name` string, required
    - `filtered_snapshot_language` string, nullable
  - `prefix` string, nullable
  - `serialization` TopicSerialization — 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.
    - `key_format` 'avro' | 'json' | 'json_schema' | 'protobuf' | 'string' | 'bytearray' | 'unknown' — Human-readable serialization format names for API responses.
    - `value_format` 'avro' | 'json' | 'json_schema' | 'protobuf' | 'string' | 'bytearray' | 'unknown' — Human-readable serialization format names for API responses.
    - `key_converter` string, nullable — Converter class for message keys
    - `value_converter` string, nullable — Converter class for message values
    - `schema_registry_enabled` boolean — Whether Schema Registry is used for this topic's serialization
  - `num_partitions` integer, required
  - `replication_factor` integer, required
  - `warnings` CreateTopicWarning[]
    - `message` string, required
    - `level` string

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/streamkap/apis/streamkap-rest-api.md) · [All operations](https://skmtc.net/streamkap/apis/streamkap-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/streamkap/streamkap-rest-api/versions/8aea6143d003/schema)
