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

# List the prompts Presence asks, with how often they name your brands

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

Lists the prompts: the questions Presence puts to assistants on a schedule. It also counts the answers each had between `from` and `to`, the last 30 days unless you say otherwise.

With `marketId` it lists one market's prompts. Without it, it lists the prompts of every market the API key's user can see.

Each brand in `measure` adds two fields to every row, named after its id. For brand 4 they are:

| Field | What it is |
| --- | --- |
| `brand4` | The percentage of the prompt's answers that named the brand, to one decimal place. Null when there are no answers in those dates. |
| `brand4position` | Where it came among the brands named, on average, when it was named. `1` is first. Null when it was never named. |

Rows are sorted by the account's own brand, most often named first, or by `chatText` when that brand is not measured. `search` matches both wordings. Every field is sent whatever `columns` says.

This query is in beta: `chatText` and `searchText` may be replaced by one field. Join on `promptId`, not on the wording.

This query counts every answer in its dates each time, so it can take several seconds. To read prompts often, ask for few days.

## 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.
- `from` (integer, optional): Only answers asked for at or after this time, in Unix seconds. Defaults to 30 days before `to`.
- `to` (integer, optional): Only answers asked for at or before this time, in Unix seconds. Defaults to now.
- `platforms` (string, optional): Only these assistants, by id, comma-separated, such as `chatgpt,gemini`. Left out, all of them. An unknown id matches nothing.
- `topics` (string, optional): Only these topics, by id, comma-separated. Left out, all of them.
- `arena` (string, optional): Which prompts' answers to read: `market` for prompts about a subject, `reputation` for prompts about a brand itself, or `all`. Defaults to `all`. Any other value answers with an error. One of: `all`, `market`, `reputation`.
- `measure` (string, optional): The brands to add figures for, by id, comma-separated, at most four. Left out, the account's own brand.
- `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 `current` (active and paused, the default), `active`, `paused`, `suggested`, `deleted` or `all`. `isBranded` takes `branded` or `non-branded`. Such as `status:all;isBranded:non-branded`.

## 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.
    - `promptId` (integer, required, at least 1): The prompt.
    - `topicId` (integer, required, at least 1): Its topic. See [Get topics](https://developers.silktide.com/v1/presence/setup/get-topics.md).
    - `topicName` (string, required): Its topic's name.
    - `chatText` (string, required): The prompt as put to a chat assistant.
    - `searchText` (string, required): The same question as typed into a search engine.
    - `isBranded` (boolean, required): Whether the prompt names a brand.
    - `status` (string, required): `active` (being asked), `paused` (kept, but over the plan's allowance), `suggested` (not in use yet) or `deleted`. One of: `active`, `paused`, `suggested`, `deleted`.
    - `responses` (integer, required): Answers to it between `from` and `to`.
    - `brandsNamed` (integer, required, can be null): How many tracked brands those answers named between them. Null when it has no answers in those dates.
    - `lastMeasuredAt` (integer, required): When its latest answer in those dates was asked for. `0` when it has none.
- `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, or `arena` is not one of its values. 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. |
| 200 | `Internal` | `sort` names a column the table does not have. Its `status` is `500`. 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: beta, since 1.2.0

## Example: Every current prompt, with its last 30 days

```bash
curl "https://api.eu.silktide.com/v1/results/accounts/presence/prompts/table?workspaceId=1&sort=chatText%3Aa&rowsPerPage=2" \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

Response:

```json
{
  "result": {
    "page": 1,
    "minPage": 1,
    "maxPage": 24,
    "numRows": 48,
    "rowsPerPage": 2,
    "rows": [
      {
        "promptId": 31,
        "topicId": 11,
        "topicName": "Fake Wine Barrel",
        "chatText": "Are Fake Wine Barrel's barrels any good?",
        "searchText": "fake wine barrel reviews",
        "isBranded": true,
        "status": "active",
        "responses": 180,
        "brandsNamed": 3,
        "lastMeasuredAt": 1793610000
      },
      {
        "promptId": 12,
        "topicId": 7,
        "topicName": "Oak barrel suppliers",
        "chatText": "Who sells used oak barrels to small wineries?",
        "searchText": "used oak barrels for small wineries",
        "isBranded": false,
        "status": "active",
        "responses": 0,
        "brandsNamed": null,
        "lastMeasuredAt": 0
      }
    ]
  },
  "selector": "/v1/results/accounts/presence/prompts/table",
  "duration": 2.1
}
```
