# Replies

## Overview

The Replies API allows querying replies associated with specific contracts and parent IDs, as well as retrieving summaries of reply counts and user participation.

## Endpoints

### Get Reply Summaries

```
POST /api/v1/reply/summary
```

**Description**: Retrieves a summary of replies for specific target contracts and parent IDs, including the total count and whether the current user has participated in the discussion.

**Authentication Required**: No

### Parameters

#### Request Body

| Name                   | Type            | Required | Description                                               |
| ---------------------- | --------------- | -------- | --------------------------------------------------------- |
| `targetContract`       | string          | Yes      | Ethereum address of the target contract                   |
| `parentIds`            | array           | Yes      | Array of parent IDs to fetch reply summaries for          |
| `currentUserProfileId` | integer or null | No       | Profile ID of the current user to check for participation |

### Responses

#### Success Response

**Code**: 200 OK

```json
{
  "ok": true,
  "data": {
    "0x2820b3aB3543ADB80810f11F2651f0DD9A04E801": {
      "1": {
        "count": 0,
        "participated": false
      }
    }
  }
}
```

| Property                                      | Type    | Description                                                         |
| --------------------------------------------- | ------- | ------------------------------------------------------------------- |
| `ok`                                          | boolean | Success status                                                      |
| `data`                                        | object  | Map of target contracts to parent IDs to reply summaries            |
| `data[targetContract]`                        | object  | Map of parent IDs to reply summaries for a specific target contract |
| `data[targetContract][parentId]`              | object  | Reply summary for a specific parent ID                              |
| `data[targetContract][parentId].count`        | integer | Total number of replies                                             |
| `data[targetContract][parentId].participated` | boolean | Whether the current user has participated in the discussion         |

#### Error Response

**Code**: 400 Bad Request

```json
{
  "ok": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation error",
    "fields": [
      {
        "code": "invalid_type",
        "expected": "number",
        "message": "Expected number, received nan",
        "path": ["currentUserProfileId"],
        "received": "nan"
      }
    ]
  }
}
```

### Example

#### Request

```bash
http POST "https://api.ethos.network/api/v1/reply/summary" \
  targetContract=0x2820b3aB3543ADB80810f11F2651f0DD9A04E801 \
  parentIds:='[1]' \
  currentUserProfileId:=null
```

### Notes

* The reply summary endpoint provides an efficient way to get the total number of replies and participation status without fetching all the individual replies.
* The structure of the response allows querying multiple target contracts and parent IDs in a single request.
* When `currentUserProfileId` is `null`, the `participated` field will always be `false`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.ethos.network/api-documentation/api-v1-deprecated/replies.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
