# topic create

Create one or more topics

Package: @cookiemonsterdev/kafka-cli 1.12.1
Canonical: https://cookiemonsterdev.github.io/kafka/docs/cli/reference/commands/topic/create/
Source revision: b112a684d2b3cdc7deadb3513041fcdbdc1c18b5

<!-- Generated by scripts/generate-cli-docs.mjs. Do not edit by hand. -->

```sh
kafka topic create <topics...>
```

Create one or more topics

## Arguments

| Argument    | Description           |
| ----------- | --------------------- |
| `topics...` | topic names to create |

Shared options and defaults: [connection profiles, JSON output, logging and help](https://cookiemonsterdev.github.io/kafka/docs/cli/reference/global-options/).

## Defaults

Explicit replica assignment excludes partition/replication counts. Otherwise flags override cli.topicDefaults, then omitted values follow client/broker defaults. --dry-run validates without creating.

## Before you run

Creates topics and broker resources. Dry-run validates the request without creation; set explicit partition/replication values for a known cluster.

## Flags

| Flag                                         | Description                                                                                                  |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `--brokers <string>`                         | comma-separated broker list, e.g. localhost:9092                                                             |
| `-p, --partitions <number>`                  | number of partitions                                                                                         |
| `-r, --replication-factor <number>`          | replication factor                                                                                           |
| `--replica-assignment <string> (repeatable)` | explicit partition=replica,replica assignment (repeatable, exclusive with --partitions/--replication-factor) |
| `--config <key=value> (repeatable)`          | a topic config entry, key=value (repeatable)                                                                 |
| `--dry-run`                                  | validate without creating anything                                                                           |
| `--if-not-exists`                            | treat an already-existing topic as success                                                                   |
| `--fail-fast`                                | issue one batched call instead of one call per topic                                                         |

## Examples

```sh
kafka topic create orders --partitions 3 --replication-factor 1
kafka topic create orders payments --dry-run
```

## Output

Illustrative, abbreviated output. Empty arrays show the result envelope; actual entries, identifiers, optional fields and broker errors depend on the request and cluster.

With `--json`:

```json
{
  "results": [
    {
      "topic": "events",
      "ok": true
    }
  ]
}
```

Declared exit codes: `0`, `1`, `2`, `4`. See the exit-code reference for meanings.

## Related commands

[Browse the command group](https://cookiemonsterdev.github.io/kafka/docs/cli/reference/commands/#topic) · [Exit codes](https://cookiemonsterdev.github.io/kafka/docs/cli/reference/exit-codes/)
