# Get a thread

`GET /api/v1/videos/{id}/comment-threads/{threadId}`

Since PeerTube 8.3 the returned tree is truncated: only the first replies of each comment are included, and only down to `maxDepth` nesting levels. Use `GET /api/v1/videos/{id}/comments/{commentId}/replies` to fetch the replies that are missing, comparing `children` and `totalChildren` of each node of the tree.


Authentication: no security requirement declared for this operation.

Parameters:

- `id` (path, id | UUIDv4 | shortUUID, required) - The object id, uuid or short uuid
  Type: id | UUIDv4 | shortUUID
  
  oneOf:
    Reference: [id](https://sourcey-peertube.pages.dev/api-rest-reference/models/id.md); Type: id
    
    minimum: 1
    
    Example:
    
    ```json
    42
    ```
  
    Reference: [UUIDv4](https://sourcey-peertube.pages.dev/api-rest-reference/models/uuidv4.md); Type: UUIDv4, uuid
    
    minLength: 36
    
    maxLength: 36
    
    pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
    
    Example:
    
    ```json
    "9c9de5e8-0a1e-484a-b099-e80766180a6d"
    ```
  
    Reference: [shortUUID](https://sourcey-peertube.pages.dev/api-rest-reference/models/shortuuid.md); Type: shortUUID
    
    translation of a uuid v4 with a bigger alphabet to have a shorter uuid
    
    Example:
    
    ```json
    "2y84q2MQUMWPbiEcxNXMgC"
    ```

- `threadId` (path, integer, required) - The thread id (root comment id)
  Type: integer

- `maxDepth` (query, integer, optional) - Number of nesting levels to include below the requested comment.
Bounded by `repliesPerLevel` and `count`, see the note on `repliesPerLevel`

  Type: integer
  
  default: 5
  
  minimum: 1
  
  maximum: 10

- `repliesPerLevel` (query, integer, optional) - Number of direct replies to include for each comment of the tree. Does not apply to the first level of `GET /api/v1/videos/{id}/comments/{commentId}/replies`, which is paginated using `start` and `count`.
A tree can make the server walk through `count * (repliesPerLevel ^ maxDepth - 1) / (repliesPerLevel - 1)` comments, which grows exponentially. Combinations above 2000000 are rejected A deep tree has to be narrow and a wide tree has to be shallow.

  Type: integer
  
  default: 10
  
  minimum: 1
  
  maximum: 30

- `x-peertube-video-password` (header, string, optional) - Required on password protected video
  Type: string

Responses:

- 200: successful operation

Content type: application/json

Type: VideoCommentThreadTree

Schema: [VideoCommentThreadTree](https://sourcey-peertube.pages.dev/api-rest-reference/models/videocommentthreadtree.md)

- `comment` (optional)
  Reference: [VideoComment](https://sourcey-peertube.pages.dev/api-rest-reference/models/videocomment.md); Type: VideoComment

- `children` (optional)
  Type: Array<VideoCommentThreadTree>
  
  Direct replies of `comment`. The server truncates the tree in depth (see the `maxDepth` parameter) and in width, so this array may contain less elements than `totalChildren`. Missing replies can be fetched using `GET /api/v1/videos/{id}/comments/{commentId}/replies`
  
  
  Items:
    Reference: [VideoCommentThreadTree](https://sourcey-peertube.pages.dev/api-rest-reference/models/videocommentthreadtree.md); Type: VideoCommentThreadTree

- `totalChildren` (optional)
  Type: integer
  
  Total number of direct replies of `comment` the current user can see
  
  minimum: 0

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/videos/42/comment-threads/0?maxDepth=5&repliesPerLevel=10'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/videos/42/comment-threads/0?maxDepth=5&repliesPerLevel=10', {
  method: 'GET',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get('https://peertube2.cpy.re/api/v1/videos/42/comment-threads/0?maxDepth=5&repliesPerLevel=10')
print(response.text)
```
