<!-- https://developers.silktide.com/v1/presence/news/get-stories | Presence / News -->

# List the news stories written for a market

`GET /v1/results/accounts/presence/news/stories`

Lists the news stories written for one market, from what was published about its topics and brands. Silktide writes each story with AI, from the pages it found.

Stories are sorted newest day first, and within a day by `relevance`. `search` matches the headline and the body.

## Request

### Query parameters

- `workspaceId` (integer, optional, at least 1): The workspace, when you do not send `marketId`. Send at least one of them.
- `marketId` (integer, optional, at least 1): The market: the number after `/presence/` in its address in Silktide. Left out, the account's default market.
- `from` (integer, optional): Only stories about a day at or after this time, in Unix seconds. Defaults to 30 days before `to`.
- `to` (integer, optional): Only stories about a day at or before this time, in Unix seconds. Defaults to now.
- `brands` (string, optional): Only stories that name at least one of these brands, by id, comma-separated.
- `unbranded` (string, optional): `1` for only stories that name no tracked brand. `brands` is then ignored. One of: `0`, `1`.
- `topicId` (integer, optional, at least 1): Only stories about this topic.
- `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 `;`. `relevance` takes `min-1` (every story, the default) to `min-5`, such as `relevance:min-4` for 4 or more.

## 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.
    - `storyId` (integer, required, at least 1): The story.
    - `headline` (string, required): Its headline.
    - `imageUrl` (string, required): An image from one of its sources. Empty when there is none.
    - `day` (integer, required): The day it is about.
    - `relevance` (integer, required, 1 to 5): How much it matters to this market, from `1` (background) to `5` (critical).
    - `pageCount` (integer, required): How many published pages it was written from.
    - `keyPoints` (list of strings, required): What happened, in short points.
    - `actions` (list of strings, required): What you could do about it.
    - `brands` (list of objects, required): The tracked brands it names.
      - `brandId` (integer, required, at least 1): The tracked brand. See [Get brands](https://developers.silktide.com/v1/presence/brands/get-brands.md).
      - `isIdentity` (boolean, required): Whether it is your own brand.
      - `isPrincipal` (boolean, required): Whether the story is mainly about it.
    - `lead` (string, optional): Why it matters, in a sentence or two. Empty on older stories. Only when `columns` names it.
    - `body` (string, optional): The story. Only when `columns` names it.
    - `created` (integer, optional): When it was written. 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` | Neither `workspaceId` nor `marketId` was sent, or `marketId` is not in that workspace. 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: The stories that matter most, in full

```bash
curl "https://api.eu.silktide.com/v1/results/accounts/presence/news/stories?marketId=3&criteria=relevance%3Amin-4&columns=headline%2Cday%2Crelevance%2Clead%2Cbody&rowsPerPage=1" \
  -H "Authorization: silktide token=$SILKTIDE_API_KEY"
```

Response:

```json
{
  "result": {
    "page": 1,
    "minPage": 1,
    "maxPage": 3,
    "numRows": 3,
    "rowsPerPage": 1,
    "rows": [
      {
        "storyId": 14,
        "headline": "Oakmoor promises delivery in two days",
        "imageUrl": "",
        "day": 1793577600,
        "relevance": 4,
        "pageCount": 2,
        "keyPoints": [
          "Oakmoor will deliver stocked barrels in two working days from January"
        ],
        "actions": [
          "Say on your delivery page how long your own barrels take"
        ],
        "brands": [
          {
            "brandId": 5,
            "isIdentity": false,
            "isPrincipal": true
          }
        ],
        "lead": "A direct competitor is now faster than you.",
        "body": "Oakmoor Cooperage will deliver stocked barrels in two working days from January."
      }
    ]
  },
  "selector": "/v1/results/accounts/presence/news/stories",
  "duration": 0.02
}
```
