---
# System prepended metadata

title: Topic operator

---

# Topic operator

## Environments
- Sta: https://orgs.sta.masstack.com/v1
- Prod: https://orgs.masstack.com/v1

## List topics

### Request

GET `/topics/clusters/:cluster/productdomains/:productdomain/subjects/:subject/versions/:version/`


### Example responses:

#### Available topics for selected version (multitenant topic found)

Status code: `200`
Posible values for `$.topics[*].status`:
* `in_sync`: indicates that the topic has already been created and it is available
* `topic_in_standby`: The topic has been correctly defined in the configuration, but it hasn't been created yet.

```
{
    "topics": [
        {
            "cluster": "bss",
            "product_domain": "appointments",
            "version": "v1",
            "subject": "updatestatus",
            "topic_full_name": "bss.appointments.updatestatus.v1.ahimas",
            "num_partitions": 1,
            "replication_factor": 3,
            "tenant": {
                "tenant_id": 17,
                "position_of_bit": 15,
                "org": "ahimas",
                "name": "ahimas",
                "iam": "authz.ahimas",
                "tier": 4
            },
            "status": "in_sync"
        },
        {
            "cluster": "bss",
            "product_domain": "billing",
            "version": "v1",
            "subject": "bonusconsumption",
            "topic_full_name": "bss.billing.bonusconsumption.v1.ahimas",
            "num_partitions": 1,
            "replication_factor": 3,
            "tenant": {
                "tenant_id": 17,
                "position_of_bit": 15,
                "org": "ahimas",
                "name": "ahimas",
                "iam": "authz.ahimas",
                "tier": 4
            },
            "status": "in_sync"
        }
    ]
}
```

#### Multitenant topic not found

If multitenant topic is not found it means that it hasn't been defined in the topic-operator configuration in the monorepo.

Status code: `404`
```
{
    "error": "Topic not found"
}
```

## Create topic

POST `/topics/clusters/:cluster/productdomains/:productdomain/subjects/:subject/versions/:version/tenants/:tenantid`

### Example responses:


#### Topic created successfully
Status: `200` or `201` (It will be `201` but the current deployed version responds with `200`)

#### Error creating topic

Status: `500` (it will be changed to `400` BadRequest)
> "couldn't get the Avro schema associated to topic with subject: roamingnotification2 and TenantID: vodafone doesn't exists in configuration"