# A topic's grouped insights, newest given first (/api/feedback/list_topic_insights)

`GET /v1/products/{productId}/topics/{topicId}/insights`

Operation name: `list_topic_insights`

Every insight grouped in the topic now (its link reads where the topic does), with its customer company (the record's company, else its contact's current company) and contact. With `customerStatus`, only insights whose customer has that status. With `period`, only insights given in it; `type`, `sentiment` and `source` narrow them the same way. To quote two customers, read on by `meta.nextCursor` until two different companies (or contacts) are found: one customer can give several insights in a row. Send `meta.feedbackVersion` as `expectedVersion` with a feedback change planned from this read.

## Authentication

An OAuth access token for the person who allowed your tool: register a client, then the authorization code flow with PKCE (S256). Send it as `Authorization: Bearer <token>` on every route that needs a signed-in person. Calls with a token are limited per person, across all their apps, to 120 calls a minute and 10,000 a UTC day; calls that start AI runs or knowledge base reads (creating an organization, starting a knowledge base read, rebuilding categories, retrying topics or rechecking) also to 10 a minute and 200 a UTC day. Over a limit a call answers 429 `rate_limited` with `Retry-After` and `details.retryAfter` in seconds, and changes nothing.

Or: An API key, sent as `Authorization: Bearer ha_…` (keys made before the rename to Heuristic start `fsa_` and keep working). Keys are created only in the Heuristic web app and shown once. A personal key (Settings → Personal → My API keys) acts as its person in one of their organizations, with exactly their access there, checked on every call; its calls count toward the person's limits on calls through apps and agents, as described for OAuth tokens, and it can't change the person's account (their profile, organizations, invitations or connected apps). An organization key (Settings → Organization → API keys, created by Admins) acts for the organization, not a person: it can see and change every product and its feedback as an Admin can, but not people, product access, CRM connections or the organization's settings, and it can't delete a product; each organization key has its own limits, with the same numbers. Either kind is Full access or Read only (a change with a read-only key answers 403 `read_only_key`), reaches only its own organization (others answer 404), works on /v1 only, not on the MCP server, and can't create keys or manage the organization's API keys. Other refused calls answer 403 `api_key_not_allowed`. A wrong, expired or revoked key, or a disabled member's personal key, answers 401 `unauthorized`. A full-access key sends feedback: a personal key as its person, to the products they own; an organization key to any product of its organization; the record's `sentBy` names the key.

## Path parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `productId` | path | string | yes | A Heuristic id: a uuid, in any case (it is read in lower case). Anything else answers 400 `validation_error`. |
| `topicId` | path | string | yes | A Heuristic id: a uuid, in any case (it is read in lower case). Anything else answers 400 `validation_error`. |

## Query parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no | How many items to return, 1 to 100 (50 when left out). |
| `cursor` | query | string | no | Where the next page starts: the `meta.nextCursor` of the previous page. Leave out for the first page. |
| `customerStatus` | query | string | no | Only customers with this status count: `customer` or `prospect`. Left out: customers and prospects, and customers with no status. A customer's status is taken the way its ARR is: a company's own (the record's, else its contact's company); a contact counted alone, the status of their most recent record that carried one; a record counted alone, its own. `withoutStatus` says how many counted customers have no status, whatever this is. |
| `period` | query | string | no | Only feedback given in this period counts, by the date it was given: `30d` and `90d` are the last 30 or 90 days, `12m` the last 12 calendar months (UTC), all measured back from the moment of the request; feedback dated later counts too. Left out: all time. Counts, ARR, `insights`, which topics are listed and `withoutStatus` follow it; `trend`, `trendByType`, `change`, `changeByType` and `meta` do not (they keep the reporting unit's own windows). |
| `type` | query | string | no | Only insights of this type. Left out: every type. |
| `sentiment` | query | string | no | Only insights with this sentiment. Left out: every one. |
| `source` | query | string | no | Only insights from this source (an id from `list_topics`' `meta.sources`). Left out: every source. A Heuristic id: a uuid, in any case (it is read in lower case). Anything else answers 400 `validation_error`. |
| `customerKind` | query | string | no | With `customerId`, only that customer's insights here, every insight type (narrow by each insight's `type`); the cursor stays a position in the newest first order: the customer's `kind` as the customers reads answer it (`company`, `contact` or `record`), and `customerId` its `id`. The two go together; a customer with nothing here answers an empty page. |
| `customerId` | query | string | no | A Heuristic id: a uuid, in any case (it is read in lower case). Anything else answers 400 `validation_error`. |

## Responses

### 200

One page of insights

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "statement": {
            "type": "string"
          },
          "quote": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "feature_request",
              "bug",
              "praise",
              "complaint",
              "question"
            ]
          },
          "sentiment": {
            "type": "string",
            "enum": [
              "positive",
              "neutral",
              "negative"
            ]
          },
          "saidAt": {
            "type": "string"
          },
          "recordId": {
            "type": "string"
          },
          "company": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "contact": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            },
            "required": [
              "name",
              "email"
            ]
          },
          "edited": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "statement",
          "quote",
          "type",
          "sentiment",
          "saidAt",
          "recordId",
          "company",
          "contact",
          "edited"
        ]
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "nextCursor": {
          "type": [
            "string",
            "null"
          ]
        },
        "feedbackVersion": {
          "type": "string",
          "description": "The feedback's version (see `apply_feedback_changes`)."
        }
      },
      "required": [
        "nextCursor",
        "feedbackVersion"
      ]
    }
  },
  "required": [
    "data",
    "meta"
  ]
}
```

### 400

Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "details": {}
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 401

Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "details": {}
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

### 404

Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "details": {}
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

## Example request

```bash
curl "https://staging.heuristic.app/v1/products/{productId}/topics/{topicId}/insights" \
  -H "Authorization: Bearer <access token>"
```
