# social.coves.community.comment.getComments

> Published by [coves.social](https://lexicon.garden/identity/did:web:coves.social)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:web:coves.social/social.coves.community.comment.getComments)
- [Documentation](https://lexicon.garden/lexicon/did:web:coves.social/social.coves.community.comment.getComments/docs)
- [Examples](https://lexicon.garden/lexicon/did:web:coves.social/social.coves.community.comment.getComments/examples)

## Definitions

### `social.coves.community.comment.getComments`

**Type**: `query`

Get comments for a post with threading and sorting support. Supports hot/top/new sorting, configurable nesting depth, and pagination.

#### Parameters

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `post` | `string` (at-uri) | Yes | AT-URI of the post to get comments for |
| `sort` | `string` | No | Sort order: hot (trending), top (highest score), new (most recent) |
| `depth` | `integer` | No | Maximum reply nesting depth to return. 0 returns only top-level comments. |
| `limit` | `integer` | No | Maximum number of top-level comments to return per page |
| `cursor` | `string` | No | Pagination cursor from previous response |
| `timeframe` | `string` | No | Timeframe for 'top' sort. Ignored for other sort types. |
| `parentRkey` | `string` (record-key) | No | Record key of a comment within the post. When provided, the response contains only the subtree rooted at that comment: the comment itself as the sole top-level entry, with its descendants nested beneath it. depth is relative to this comment (0 returns only the comment itself), and limit/cursor paginate its direct replies. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `post` | `ref` → `social.coves.community.post.defs#postView` | Yes | The post these comments belong to |
| `cursor` | `string` | No | Pagination cursor for fetching next page of top-level comments |
| `comments` | `array` | Yes | Top-level comments with nested replies up to requested depth |

#### Errors

- **NotFound**: Post not found
- **ParentNotFound**: No comment with the given parentRkey exists within the post
- **InvalidRequest**: Invalid parameters (malformed URI, invalid sort/timeframe combination, etc.)

## Raw Schema

```json
{
  "id": "social.coves.community.comment.getComments",
  "defs": {
    "main": {
      "type": "query",
      "errors": [
        {
          "name": "NotFound",
          "description": "Post not found"
        },
        {
          "name": "ParentNotFound",
          "description": "No comment with the given parentRkey exists within the post"
        },
        {
          "name": "InvalidRequest",
          "description": "Invalid parameters (malformed URI, invalid sort/timeframe combination, etc.)"
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "comments",
            "post"
          ],
          "properties": {
            "post": {
              "ref": "social.coves.community.post.defs#postView",
              "type": "ref",
              "description": "The post these comments belong to"
            },
            "cursor": {
              "type": "string",
              "maxLength": 500,
              "description": "Pagination cursor for fetching next page of top-level comments"
            },
            "comments": {
              "type": "array",
              "items": {
                "ref": "social.coves.community.comment.defs#threadViewComment",
                "type": "ref"
              },
              "description": "Top-level comments with nested replies up to requested depth"
            }
          }
        },
        "encoding": "application/json"
      },
      "parameters": {
        "type": "params",
        "required": [
          "post"
        ],
        "properties": {
          "post": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the post to get comments for"
          },
          "sort": {
            "type": "string",
            "default": "hot",
            "maxLength": 64,
            "description": "Sort order: hot (trending), top (highest score), new (most recent)",
            "knownValues": [
              "hot",
              "top",
              "new"
            ]
          },
          "depth": {
            "type": "integer",
            "default": 10,
            "maximum": 100,
            "minimum": 0,
            "description": "Maximum reply nesting depth to return. 0 returns only top-level comments."
          },
          "limit": {
            "type": "integer",
            "default": 50,
            "maximum": 100,
            "minimum": 1,
            "description": "Maximum number of top-level comments to return per page"
          },
          "cursor": {
            "type": "string",
            "maxLength": 500,
            "description": "Pagination cursor from previous response"
          },
          "timeframe": {
            "type": "string",
            "maxLength": 64,
            "description": "Timeframe for 'top' sort. Ignored for other sort types.",
            "knownValues": [
              "hour",
              "day",
              "week",
              "month",
              "year",
              "all"
            ]
          },
          "parentRkey": {
            "type": "string",
            "format": "record-key",
            "description": "Record key of a comment within the post. When provided, the response contains only the subtree rooted at that comment: the comment itself as the sole top-level entry, with its descendants nested beneath it. depth is relative to this comment (0 returns only the comment itself), and limit/cursor paginate its direct replies."
          }
        }
      },
      "description": "Get comments for a post with threading and sorting support. Supports hot/top/new sorting, configurable nesting depth, and pagination."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
