---
title: "Ask agent"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.sureshake.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Sureshake API › entities

`POST /v2/entities/{entityId}/collections/{id}/agent/messages`

## Path parameters

- `entityId` (`collection-ask-agent.path.entityId`; string, required)
  - format `uuid`
- `id` (`collection-ask-agent.path.id`; string, required)
  - format `uuid`

## Request body

_Required._

- `message` (`collection-ask-agent.message`; string, required)
  - minLength 1; maxLength 4000
- `history` (`collection-ask-agent.history`; array<object>, optional)
  - default `[]`
  - `role` (`collection-ask-agent.history.role`; string, required)
    - one of `"user"`, `"assistant"`
  - `content` (`collection-ask-agent.history.content`; string, required)
    - minLength 1; maxLength 8000
- `scope` (`collection-ask-agent.scope`; string, optional)
  - one of `"collection"`, `"subtree"`; default `"subtree"`

## Example request

```json
{
  "message": "string",
  "history": [],
  "scope": "collection"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.sureshake.com/v2/entities/<entityId>/collections/<id>/agent/messages' \
  --header 'Content-Type: application/json' \
  --data '
{
  "message": "string",
  "history": [],
  "scope": "collection"
}
'
```

### TypeScript

```typescript
const url = 'https://api.sureshake.com/v2/entities/<entityId>/collections/<id>/agent/messages';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({message: 'string', history: [], scope: 'collection'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sureshake.com/v2/entities/<entityId>/collections/<id>/agent/messages"

payload = {
    "message": "string",
    "history": [],
    "scope": "collection"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Default Response

#### Example

```json
{
  "data": {
    "answer": "string",
    "citations": [
      {
        "label": "string",
        "reportId": "836df459-dc40-4aa1-972a-6eb0a864dff9",
        "title": "string",
        "truncated": true,
        "document": "read"
      }
    ],
    "sources": [
      {
        "label": "string",
        "reportId": "836df459-dc40-4aa1-972a-6eb0a864dff9",
        "title": "string",
        "truncated": true,
        "document": "read"
      }
    ],
    "excluded": [
      {
        "reportId": "836df459-dc40-4aa1-972a-6eb0a864dff9",
        "reason": "not_readable"
      }
    ]
  }
}
```

- `data` (`collection-ask-agent.response.200.data`; object, required)
  - `answer` (`collection-ask-agent.response.200.data.answer`; string, required)
  - `citations` (`collection-ask-agent.response.200.data.citations`; array<object>, required)
    - `label` (`collection-ask-agent.response.200.data.citations.label`; string, required)
    - `reportId` (`collection-ask-agent.response.200.data.citations.reportId`; string, required)
      - format `uuid`
    - `title` (`collection-ask-agent.response.200.data.citations.title`; string, required)
    - `truncated` (`collection-ask-agent.response.200.data.citations.truncated`; boolean, required)
    - `document` (`collection-ask-agent.response.200.data.citations.document`; string, optional)
      - one of `"read"`, `"too_large"`, `"over_limit"`, `"unsupported"`, `"unavailable"`
  - `sources` (`collection-ask-agent.response.200.data.sources`; array<object>, required)
    - `label` (`collection-ask-agent.response.200.data.sources.label`; string, required)
    - `reportId` (`collection-ask-agent.response.200.data.sources.reportId`; string, required)
      - format `uuid`
    - `title` (`collection-ask-agent.response.200.data.sources.title`; string, required)
    - `truncated` (`collection-ask-agent.response.200.data.sources.truncated`; boolean, required)
    - `document` (`collection-ask-agent.response.200.data.sources.document`; string, optional)
      - one of `"read"`, `"too_large"`, `"over_limit"`, `"unsupported"`, `"unavailable"`
  - `excluded` (`collection-ask-agent.response.200.data.excluded`; array<object>, required)
    - `reportId` (`collection-ask-agent.response.200.data.excluded.reportId`; string, required)
      - format `uuid`
    - `reason` (`collection-ask-agent.response.200.data.excluded.reason`; string, required)
      - one of `"not_readable"`, `"over_limit"`

### 400

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-ask-agent.response.400.error`; object, required)
  - `code` (`collection-ask-agent.response.400.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-ask-agent.response.400.error.message`; string, required) — Human-readable error message
  - `details` (`collection-ask-agent.response.400.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-ask-agent.response.400.error.traceId`; string, optional) — Unique ID for log correlation

### 401

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-ask-agent.response.401.error`; object, required)
  - `code` (`collection-ask-agent.response.401.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-ask-agent.response.401.error.message`; string, required) — Human-readable error message
  - `details` (`collection-ask-agent.response.401.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-ask-agent.response.401.error.traceId`; string, optional) — Unique ID for log correlation

### 403

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-ask-agent.response.403.error`; object, required)
  - `code` (`collection-ask-agent.response.403.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-ask-agent.response.403.error.message`; string, required) — Human-readable error message
  - `details` (`collection-ask-agent.response.403.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-ask-agent.response.403.error.traceId`; string, optional) — Unique ID for log correlation

### 404

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-ask-agent.response.404.error`; object, required)
  - `code` (`collection-ask-agent.response.404.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-ask-agent.response.404.error.message`; string, required) — Human-readable error message
  - `details` (`collection-ask-agent.response.404.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-ask-agent.response.404.error.traceId`; string, optional) — Unique ID for log correlation

### 409

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-ask-agent.response.409.error`; object, required)
  - `code` (`collection-ask-agent.response.409.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-ask-agent.response.409.error.message`; string, required) — Human-readable error message
  - `details` (`collection-ask-agent.response.409.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-ask-agent.response.409.error.traceId`; string, optional) — Unique ID for log correlation

### 500

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-ask-agent.response.500.error`; object, required)
  - `code` (`collection-ask-agent.response.500.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-ask-agent.response.500.error.message`; string, required) — Human-readable error message
  - `details` (`collection-ask-agent.response.500.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-ask-agent.response.500.error.traceId`; string, optional) — Unique ID for log correlation

### 503

Default Response

#### Example

```json
{
  "error": {
    "code": "string",
    "message": "string",
    "details": null,
    "traceId": "string"
  }
}
```

- `error` (`collection-ask-agent.response.503.error`; object, required)
  - `code` (`collection-ask-agent.response.503.error.code`; string, required) — Machine-readable error code (e.g., NOT_FOUND)
  - `message` (`collection-ask-agent.response.503.error.message`; string, required) — Human-readable error message
  - `details` (`collection-ask-agent.response.503.error.details`; unknown, optional) — Optional structured error details
  - `traceId` (`collection-ask-agent.response.503.error.traceId`; string, optional) — Unique ID for log correlation


Source: https://docs.sureshake.com/reference/collection-ask-agent/index.md
