> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-vector.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Topics

#### Create a topic and add 2 endpoints

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const topics = client.topics();
await topics.addEndpoints({
  name: "topic_name",
  endpoints: [
    { url: "https://my-endpoint-1" },
    { url: "https://my-endpoint-2" },
  ],
});
```

#### Get topic by name

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const topics = client.topics();
const topic = await topics.get("topicName");
console.log(topic.name, topic.endpoints);
```

#### List topics

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const topics = client.topics();
const allTopics = await topics.list();
for (const topic of allTopics) {
  console.log(topic.name, topic.endpoints);
}
```

#### Remove an endpoint from a topic

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const topics = client.topics();
await topics.removeEndpoints({
  name: "topic_name",
  endpoints: [{ url: "https://my-endpoint-1" }],
});
```

#### Delete a topic

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const topics = client.topics();
await topics.delete("topicName");
```
