# Replies

The `/replies` endpoint allows you to view the replies you've received.

The shape of a Reply is as follows:

```javascript
type Reply = {
  /** The _id of the reply */
  _id: string;
  /** The cell number (in full international format) that sent the reply */
  Msisdn: string;
  /** The content of the reply */
  Message: string;
  /** The _id of the campaign that triggered the send */
  campaign_id: string;
  /** The _id of the send being replied to (see /API/send-logs for more details) */
  UserReference: string;
  /** The kind of the reply, one of three values */
  kind: "optIn" | "optOut" | "unknown";
  /** When the reply was received (ISO date-string) */
  Received: string;
  /** When the reply was last updated (ISO date-string)
   * (replies can be reclassified as a different kind, or hidden)
   */
  updatedAt: string;
};
```

## **Search Replies**

`POST /replies/search`

Run a search query against your replies, returning all replies that match.

* 🔐 Permissions: `["replies.read"]`

### **Request**

**Body**

You can search on most of the above-mentioned fields using the following input:

* Any field that accepts `string | string[]` allows you to filter on multiple values for that field (using the OR operator, not AND).

```javascript
type SearchInput = {
  _id?: string | string[];
  Message?: string;
  kind?: string | string[];
  Msisdn?: string | string[];
  campaign_id?: string | string[];
  UserReference?: string | string[];
  Received?: {
    /** The lower bound on Received date ("from") */
    $gte?: Date;
    /** The upper bound on Received date ("to" / "until") */
    $lte?: Date;
  };
};
```

**Examples**

Search for all optIns or optOuts, to a given campaign, received in a two week window:

```javascript
{
    kind: ["optIn", "optOut"],
    campaign_id: "652923be1784c66362f2f195",
    Received: {
        $gte: "2023-12-01",
        $lte: "2023-12-14"
    }
}
```

### **Response**


:::success
**Success**

:::

**200**

```javascript
{
  ok: true,
  data: Reply[]
}
```