---
title: "Create Topic"
method: POST
path: "/api/topic"
tags: ["Topic"]
---

# Create Topic

`POST /api/topic`

Create a new chat topic. Topics are attached to a owner_id's and act as a coordinator for conversation message history of gen-AI chat sessions. Auth'ed user or api key must have an admin or owner role for the specified dataset's organization.

## Headers

- `TR-Dataset` string, uuid, required

## Request body

- CreateTopicReqPayload
  - `first_user_message` string, nullable — The first message which will belong to the topic. The topic name is generated based on this message similar to how it works in the OpenAI chat UX if a name is not explicitly provided on the name request body key.
  - `metadata` unknown
  - `name` string, nullable — The name of the topic. If this is not provided, the topic name is generated from the first_user_message.
  - `owner_id` string, required — The owner_id of the topic. This is typically a browser fingerprint or your user's id. It is used to group topics together for a user.

## Response `200`

The JSON response payload containing the created topic

- Topic
  - `created_at` string, date-time, required
  - `dataset_id` string, uuid, required
  - `deleted` boolean, required
  - `id` string, uuid, required
  - `name` string, required
  - `owner_id` string, required
  - `updated_at` string, date-time, required

## Other responses

- `400` — Topic name empty or a service error

---

[API](https://skmtc.net/devflowinc/apis/trieve-api.md) · [All operations](https://skmtc.net/devflowinc/apis/trieve-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/devflowinc/trieve-api/revisions/84583e7c9fc1/schema)
