<!-- https://developers.silktide.com/v1/presence/setup/get-topics | Presence / Setup -->

# List the topics Presence asks about

`GET /v1/results/accounts/presence/topics/table`

Lists the topics whose prompts Presence puts to assistants. A topic is a group of prompts: a subject you compete on, or one brand.

A topic can be in several markets, or in none. With `marketId` it lists one market's topics. Without it, it lists the topics of every market the API key's user can see; a user who can see every market also gets the topics that are in none.

Topics are sorted by name. `search` matches the name and the description.

## Request

### Query parameters

- `workspaceId` (integer, required, at least 1): Where the account's markets live. [Get the workspace](https://developers.silktide.com/v1/presence/setup/get-workspace.md) answers with it.
- `marketId` (integer, optional, at least 1): Only this market: the number after `/presence/` in the market's address in Silktide. Left out, every market the API key's user can see.
- `columns` (string, optional): The columns to return, comma-separated, such as `url,pageViews`. Left out, the table's default columns. Send a string even in a JSON body: an array is ignored.
- `sort` (string, optional): The column to sort by, then `:a` for ascending or `:d` for descending, such as `pageViews:d`. Left out, the table's own order.
- `search` (string, optional): Only rows matching this text. What it searches depends on the table, most often the URL or title.
- `page` (integer, optional, at least 1): The page of rows to return, from `1`. Defaults to `1`.
- `rowsPerPage` (integer, optional, at least 1): How many rows a page holds. Defaults to `100`.
- `criteria` (string, optional): Filters on the table's columns, as `column:value`, joined with `;`. `status` takes `active` (the default), `suggested`, `deleted` or `all`, such as `status:all`.

## Response

Status `200`.

- `result` (object, required): The answer.
  - `page` (integer, required, at least 1): The page returned. Not always the page asked for, when that was out of range.
  - `minPage` (integer, required, at least 1): The first page. Always `1`.
  - `maxPage` (integer, required): The last page at this `rowsPerPage`. With no rows, `0` or `1` depending on the table.
  - `numRows` (integer, required): How many rows there are across every page.
  - `rowsPerPage` (integer, required, at least 1): How many rows a page holds.
  - `rows` (list of objects, required): The rows on this page.
    - `topicId` (integer, required, at least 1): The topic.
    - `brandId` (integer, required, can be null, at least 1): The brand the topic is about, when `kind` is `brand`. Null for a `subject`.
    - `name` (string, required): The topic's name.
    - `kind` (string, required): `subject` for something you compete on, or `brand` for questions about one brand itself. One of: `subject`, `brand`.
    - `status` (string, required): `active`, `suggested` (not in use yet) or `deleted`. One of: `active`, `suggested`, `deleted`.
    - `updated` (integer, required): When it was last changed.
    - `description` (string, optional): What the topic covers. Only when `columns` names it.
- `selector` (string, required): The query that answered, as its path: `/v1/results/scores`.
- `duration` (number, required): Seconds Silktide took to answer.

## Errors

| Status | Type | When |
| --- | --- | --- |
| 200 | `EditionNotAvailable` | The account does not have Silktide 5. Its `status` is `403`. The body is an error despite the status. |
| 200 | `Runtime` | No `workspaceId` was sent. Its `status` is `500`, and its message does not say why. The body is an error despite the status. |
| 200 | `AccessDenied` | No such workspace or market exists in the account, or the API key's user cannot see it. Its `status` is `403`. The body is an error despite the status. |
| 401 | `NotLoggedIn` | No API key was sent, or it is not a key for this region. |
| 429 | `TooManyRequests` | Too many requests to this path in five seconds. Retry after the number of seconds in the `Retry-After` header, which `properties.retryAfter` repeats. |
| 503 | - | Silktide is busy. Retry after the number of seconds in the `Retry-After` header. |

## Access

- Permission: Can see this market
- Plan feature: none
- Edition: Silktide 5 only
- Cost: free
- Stability: stable, since 1.2.0

## Example: Every topic in use

```bash
curl "https://api.eu.silktide.com/v1/results/accounts/presence/topics/table?workspaceId=1&columns=name%2Ckind%2Cstatus%2Cupdated%2Cdescription" \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

Response:

```json
{
  "result": {
    "page": 1,
    "minPage": 1,
    "maxPage": 1,
    "numRows": 2,
    "rowsPerPage": 100,
    "rows": [
      {
        "topicId": 11,
        "brandId": 4,
        "name": "Fake Wine Barrel",
        "kind": "brand",
        "status": "active",
        "description": "Questions about Fake Wine Barrel itself.",
        "updated": 1793610000
      },
      {
        "topicId": 7,
        "brandId": null,
        "name": "Oak barrel suppliers",
        "kind": "subject",
        "status": "active",
        "description": "Who sells new and used oak barrels to small wineries.",
        "updated": 1793610420
      }
    ]
  },
  "selector": "/v1/results/accounts/presence/topics/table",
  "duration": 0.01
}
```
