# Get request trends (https://notert.io/docs/api/reference/get-request-trends)

`GET /api/v1/insights/request-trends`

How the workspace's requests came in over a stretch of days: for each day, week or month, how many of the requests the filters keep were filed and how many votes were cast for them, with the stretch's sums. A stretch splits into at most 120 periods, past which it is TOO_MANY_PERIODS, and one whose first day comes after its last is BACKWARD_STRETCH.

Access: A token with requests:read.

## Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | No | Words every request counted holds in its title, its details or its author's name. Empty counts them all. At most 200 characters. |
| `statuses` | string or string[] | No | Only the requests in these statuses. Repeat it for several, as statuses=planned&statuses=in_progress. One of: `pending`, `in_review`, `planned`, `in_progress`, `completed`, `closed`. Default []. |
| `boardIds` | string or string[] | No | Only the requests on any of these boards. Repeat it for several, up to 50. Default []. |
| `tagIds` | string or string[] | No | Only the requests wearing any of these tags. Repeat it for several, up to 50. Default []. |
| `ownerIds` | string or string[] | No | Only the requests any of these teammates own, by their m_ id from GET /teammates. Repeat it for several, up to 50. Default []. |
| `wantedBy` | string | No | Only the requests this person filed or voted for, by their id from the people list: m_ and a member's user id, or c_ and a contact's id. |
| `from` | date | Yes | The stretch's first day, as YYYY-MM-DD. |
| `to` | date | Yes | The stretch's last day, as YYYY-MM-DD. Days after today count nothing. |
| `bucket` | string | No | How long each period is: day, week (the default, from Monday) or month. One of: `day`, `week`, `month`. Default "week". |
| `timeZone` | string | No | The IANA time zone its days are counted in, such as Europe/Oslo. UTC by default. At most 64 characters. Default "UTC". |

## Response 200

| Field | Type | Description |
| --- | --- | --- |
| `periods` | object[] | Every period of the stretch in order, those with nothing included. |
| `periods.start` | date | The period's first day, as YYYY-MM-DD. |
| `periods.requests` | integer | How many of the requests the filters keep were filed: in the period, or under totals, in the whole stretch. |
| `periods.votes` | integer | How many votes were cast for them: in the period, or under totals, in the whole stretch. |
| `totals` | object | The whole stretch's sums. |
| `totals.requests` | integer | How many of the requests the filters keep were filed: in the period, or under totals, in the whole stretch. |
| `totals.votes` | integer | How many votes were cast for them: in the period, or under totals, in the whole stretch. |

## Errors

| Status | Code | Message |
| --- | --- | --- |
| 400 | `BACKWARD_STRETCH` | The first day comes before the last. |
| 400 | `BAD_REQUEST` | Input validation failed. |
| 400 | `TOO_MANY_PERIODS` | That stretch splits into more than 120 periods. Pick a longer bucket or a shorter stretch. |
| 401 | `UNAUTHORIZED` | Send a valid API token as a Bearer token. |
| 403 | `HOLDER_NOT_ALLOWED` | The teammate who holds this API token's secret can't do this in the workspace now. A teammate who can should roll it in the workspace's settings. |
| 403 | `INSUFFICIENT_SCOPE` | This API token can't read requests, boards, tags and statuses. Create one that may in the workspace's settings. |
| 403 | `NETWORK_NOT_ALLOWED` | This API token works only from the networks it was made for. Call from one of them, or create a token for this one in the workspace's settings. |
| 429 | `TOO_MANY_REQUESTS` | Too Many Requests. Its data holds `retryAfter`. |

## Example request

```sh
curl "https://app.notert.io/api/v1/insights/request-trends?from=2026-10-01&to=2026-11-21&bucket=week" \
  -H "Authorization: Bearer $NOTERT_API_TOKEN"
```

## Example response 200

```json
{
  "periods": [
    {
      "start": "2026-11-02",
      "requests": 12,
      "votes": 57
    }
  ],
  "totals": {
    "requests": 12,
    "votes": 57
  }
}
```
