> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.docs.siftsy.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.siftsy.com/_mcp/server.

# Sample comments behind an analysis

GET https://api.siftsy.app/analyst/v1/analyses/{analysisId}/comments

Requires `comments:read`, plus `analyses:read` (or `analyses:run` for
an `an_…` analysis created by the same key). A **sample of comments
behind** this analysis — the same mix-bar filters as
`GET /posts/{postId}/analysis/comments`. Hidden comments are
excluded.

Siftsy is an analysis platform, not a comment exporter. Do not use
this route to dump full comment sections. Prefer `source=notables`,
`content`, or `all`.

For analyses created with `POST /analyses`, the analysis' own
`filters` and `search` matches are applied first, so the sample is
drawn from the comments the analysis numbers describe; the query
filters below narrow further. Returns `409 analysis_not_ready`
until `status` is `ready`.

Sampled rows include `sampleReasons`. `meta.groups` lists content
topic and message membership; when more than one post is included,
each group includes `postId`.

Analyses with more than 1000 posts return 400.

Rate class `analysis_comments` (20 / minute, 300 / day per key).
Every page re-reads the comments of every post on the analysis, so
take one sample per analysis rather than paging through it.

Reference: https://api.docs.siftsy.com/api-reference/siftsy-analyst-api/list-persisted-analysis-comments

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.
- `X-Api-Key` header (required) — API Key authentication via header

## Servers

- `https://api.siftsy.app/analyst/v1` (Production, default)
- `http://localhost:3000/analyst/v1` (Local development)

## Request

### Path parameters

- `analysisId` (string, required)

### Query parameters

- `cursor` (string, optional)
- `limit` (integer, optional, default: 25)
- `side` (integer, optional) — Comparisons only: sample one side (1-based, in `compare` order). Omit to sample across every side. `400` on other analyses.
- `source` (enum, optional) — How to sample comments behind this analysis. Prefer `notables` (engagement + relevance), `content` (grouped onto creator topics/messages), or `all` (union). This is evidence, not a full-thread export.
  - Allowed values: `all`, `notables`, `content`
- `sentiment` (string, optional) — Only comments whose overall sentiment falls in these mix-bar buckets. Comma-separate or repeat to match several (`positive,lean_positive`). Values: `positive`, `lean_positive`, `neutral`, `lean_negative`, `negative`. Score version 3 uses a five-bucket split (neutral is 4.5–5.5); v1/v2 have no unused middle band.
- `content` (string, optional) — Only comments whose content sentiment (alignment with the post / creator) falls in these buckets. Same keys as `sentiment`. Score version 2+ comments; unscored comments are excluded.
- `topic` (string, optional) — Only comments whose topic sentiment (reception of the subject) falls in these buckets. Same keys as `sentiment`.
- `relevance` (string, optional) — Only comments in these relevance mix-bar buckets. Canonical keys match metrics (`positive`, `lean_positive`, `neutral`, `lean_negative`, `negative`). Dashboard labels also work: `on_topic`, `relevant`, `general`, `off_topic`.
- `consensus` (string, optional) — Only comments in these consensus mix-bar buckets. Canonical keys match metrics. Dashboard labels also work: `agreeing`, `discussing`, `debating`, `fighting`. Consensus is how the commenter is reacting to other commenters, not to the post.

## Response

### 200

Sample of comments behind this analysis

- `data` (list of Comment, optional)
- `meta` (EnvelopeCommentsMeta, optional)

## Errors

### 400 Bad Request Error

Invalid request

- `any`

### 404 Not Found Error

Resource not found

- `any`

### 409 Conflict Error

Analysis is not `ready`. `error.message` is `analysis_not_ready` (still `queued` / `running`; honor `Retry-After`) or `analysis_failed`. `error.status` carries the current status.

- `any`

## Types

### Comment

- `id` (string, optional, nullable)
- `postId` (string, optional, nullable)
- `text` (string, optional, nullable)
- `username` (string, optional, nullable)
- `timestamp` (string, optional, nullable)
- `replyTo` (string, optional, nullable)
- `engagement` (CommentEngagement, optional)
- `scores` (CommentScores, optional) — Per-comment scores on the 1–10 scale. `content` and `topic` are populated for score version 2+ comments.
- `buckets` (CommentBuckets, optional) — Mix-bar bucket for each score, using the same keys as `GET /posts/{postId}/metrics`. Null when that score is missing.
- `sampleReasons` (list of enum, optional) — Why this comment was included when `source` is set (`notable`, `content`).
  - Allowed values: `notable`, `content`

### EnvelopeCommentsMeta

### CommentEngagement

- `likes` (double, optional, nullable)
- `replies` (double, optional, nullable)

### CommentScores

Per-comment scores on the 1–10 scale. `content` and `topic` are populated for score version 2+ comments.

- `sentiment` (double, optional, nullable)
- `content` (double, optional, nullable)
- `topic` (double, optional, nullable)
- `relevance` (double, optional, nullable)
- `consensus` (double, optional, nullable)
- `confidence` (double, optional, nullable)

### CommentBuckets

Mix-bar bucket for each score, using the same keys as `GET /posts/{postId}/metrics`. Null when that score is missing.

- `sentiment` (enum, optional, nullable)
  - Allowed values: `positive`, `lean_positive`, `neutral`, `lean_negative`, `negative`
- `content` (enum, optional, nullable)
  - Allowed values: `positive`, `lean_positive`, `neutral`, `lean_negative`, `negative`
- `topic` (enum, optional, nullable)
  - Allowed values: `positive`, `lean_positive`, `neutral`, `lean_negative`, `negative`
- `relevance` (enum, optional, nullable)
  - Allowed values: `positive`, `lean_positive`, `neutral`, `lean_negative`, `negative`
- `consensus` (enum, optional, nullable)
  - Allowed values: `positive`, `lean_positive`, `neutral`, `lean_negative`, `negative`

## Examples

**Response**

```json
{
  "data": [
    {
      "id": "string",
      "postId": "string",
      "text": "string",
      "username": "string",
      "timestamp": "string",
      "replyTo": "string",
      "engagement": {
        "likes": 1.1,
        "replies": 1.1
      },
      "scores": {
        "sentiment": 1.1,
        "content": 1.1,
        "topic": 1.1,
        "relevance": 1.1,
        "consensus": 1.1,
        "confidence": 1.1
      },
      "buckets": {
        "sentiment": "positive",
        "content": "positive",
        "topic": "positive",
        "relevance": "positive",
        "consensus": "positive"
      },
      "sampleReasons": [
        "notable"
      ]
    }
  ],
  "meta": {}
}
```

**SDK Code**

```python
import requests

url = "https://api.siftsy.app/analyst/v1/analyses/analysisId/comments"

querystring = {"sentiment":"positive","content":"positive","topic":"negative","relevance":"on_topic","consensus":"fighting"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.siftsy.app/analyst/v1/analyses/analysisId/comments?sentiment=positive&content=positive&topic=negative&relevance=on_topic&consensus=fighting';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.siftsy.app/analyst/v1/analyses/analysisId/comments?sentiment=positive&content=positive&topic=negative&relevance=on_topic&consensus=fighting"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.siftsy.app/analyst/v1/analyses/analysisId/comments?sentiment=positive&content=positive&topic=negative&relevance=on_topic&consensus=fighting")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.siftsy.app/analyst/v1/analyses/analysisId/comments?sentiment=positive&content=positive&topic=negative&relevance=on_topic&consensus=fighting")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.siftsy.app/analyst/v1/analyses/analysisId/comments?sentiment=positive&content=positive&topic=negative&relevance=on_topic&consensus=fighting', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.siftsy.app/analyst/v1/analyses/analysisId/comments?sentiment=positive&content=positive&topic=negative&relevance=on_topic&consensus=fighting");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.siftsy.app/analyst/v1/analyses/analysisId/comments?sentiment=positive&content=positive&topic=negative&relevance=on_topic&consensus=fighting")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```