# Create topic

`opensend.topics.create(input)`

Makes a kind of mail readers can say yes or no to, such as product news. A broadcast sent on a topic only reaches the contacts who get that topic.

Needs the scope: `audiences:write`

## Input

- `name` (string, required): A name for the topic, such as `Product news`. Up to 120 characters.
- `description` (string): A line about what the topic is, shown to readers. Up to 300 characters.
- `defaultSubscription` (string): `opt_in` when contacts get the topic unless they say no, `opt_out` when they only get it after they say yes. Without it, `opt_in`. It cannot be changed later. One of: `opt_in`, `opt_out`.
- `visibility` (string): `public` or `private`. Without it, `public`. One of: `public`, `private`.

## Returns

The call resolves to the answer, already parsed. A call the API refuses throws `OpenSendError` with the code and the message of the answer. [SDK](https://opensend.sh/docs/sdk) lists the errors of the client itself.

- `object` ("topic"): Always `topic`.
- `id` (string): The id of the topic.
- `name` (string): The name of the topic, as readers see it.
- `description` (string): What the topic is about, as readers see it. Empty when not set.
- `defaultSubscription` (string): What holds for a contact who never chose: `opt_in`, they get it, or `opt_out`, they do not. One of: `opt_in`, `opt_out`.
- `visibility` (string): `public` when every reader sees the topic on the page where they manage their mail, `private` when only those who chose it do. One of: `public`, `private`.
- `subscription` (string | null): What the contact you listed the topics for gets: `opt_in` or `opt_out`. `null` when you named no contact. One of: `opt_in`, `opt_out`.
- `createdAt` (string): When the topic was made.

## Example

TypeScript:

```ts
await opensend.topics.create({
  name: 'Product news',
  description: 'What we shipped, once a month.',
})
```

CLI:

```bash
opensend topics create \
  --name 'Product news' \
  --description 'What we shipped, once a month.'
```

Answer:

```json
{
  "object": "topic",
  "id": "top_02",
  "name": "Product news",
  "description": "What we shipped, once a month.",
  "defaultSubscription": "opt_in",
  "visibility": "public",
  "subscription": null,
  "createdAt": "2026-11-27T09:30:00.000Z"
}
```
