# conversations

```graphql
query Conversations {
  conversations {
    data {
      id
      projectId
      respondingAgentId
      type
      title
      summary
      status
      currentNode
      messageCount
      lastMessageAt
      metadata
      createdBy
      archivedAt
      createdAt
      updatedAt
      initialMessageId
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

List the conversations the caller can read, newest activity first, to build a conversation picker or to find a conversation of a project; returns one page of conversations, filtered by project reference and paged with the returned cursor until it is null.

## Arguments

| Name               | Type   | Required | Description                                                                        |
| ------------------ | ------ | -------- | ---------------------------------------------------------------------------------- |
| `projectReference` | String |          |                                                                                    |
| `limit`            | Int    |          |                                                                                    |
| `cursor`           | String |          |                                                                                    |
| `type`             | String |          | Only conversations of this type, e.g. chat.                                        |
| `participantIds`   | \[ID!] |          | Only conversations that include every listed participant id (at most 20 UUIDs).    |
| `agentId`          | String |          | Only conversations with this agent participant (public agent id).                  |
| `userId`           | ID     |          | Only conversations with this user participant (user UUID).                         |
| `search`           | String |          | Case-insensitive title substring (1-200 characters).                               |
| `sortBy`           | String |          | Sort key, as on REST: updated\_at (default), created\_at, title or message\_count. |
| `sortOrder`        | String |          | Sort direction, as on REST: desc (default) or asc.                                 |

## Responses

| Status | Description                                        |
| ------ | -------------------------------------------------- |
| 200    | The ConversationConnection! in data.conversations. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query Conversations {\n  conversations {\n    data {\n      id\n      projectId\n      respondingAgentId\n      type\n      title\n      summary\n      status\n      currentNode\n      messageCount\n      lastMessageAt\n      metadata\n      createdBy\n      archivedAt\n      createdAt\n      updatedAt\n      initialMessageId\n    }\n    pageInfo {\n      hasNextPage\n      hasPreviousPage\n      startCursor\n      endCursor\n    }\n  }\n}"
}'
```

## Example response

```json
{
  "data": {
    "conversations": {
      "data": [
        {
          "id": "string",
          "projectId": "string",
          "respondingAgentId": "string",
          "type": "string",
          "title": "string",
          "summary": "string",
          "status": "string",
          "currentNode": "string",
          "messageCount": 0,
          "lastMessageAt": "string",
          "metadata": {},
          "createdBy": "string",
          "archivedAt": "string",
          "createdAt": "string",
          "updatedAt": "string",
          "initialMessageId": "string"
        }
      ],
      "pageInfo": {
        "hasNextPage": false,
        "hasPreviousPage": false,
        "startCursor": "string",
        "endCursor": "string"
      }
    }
  }
}
```
