> For the complete documentation index, see [llms.txt](https://docs.reveel.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reveel.id/agents-old.md).

# Agents - old

The Agent API enables conversational interactions and message-driven workflows through a smart assistant interface. Users can send messages like "Send 5 USDC to Alice" and receive structured prompts or automated transaction suggestions.

### Parameter Reference

| Field            | Type    | Required                      | Description                                                    |
| ---------------- | ------- | ----------------------------- | -------------------------------------------------------------- |
| `userId`         | string  | Yes                           | The ID of the user sending/receiving messages                  |
| `message`        | string  | Yes                           | User input text for the agent                                  |
| `walletAddress`  | string  | Optional                      | Wallet context for the conversation                            |
| `roomId`         | string  | Yes (for room-specific fetch) | Identifier for a specific chat room                            |
| `page`           | number  | Optional                      | Page number for pagination                                     |
| `pageSize`       | number  | Optional                      | Number of messages per page                                    |
| `messageContent` | string  | Output                        | Agent or user message body                                     |
| `isSystem`       | boolean | Output                        | Indicates whether the message is generated by the system/agent |
| `action`         | string  | Output                        | Action type, e.g. `"NONE"` (may expand in future)              |

### 1. Send Message to Agent

`POST /agent/message`\
**Authentication:** Required

**Description**

Sends a message to the Reveel agent from a user. The agent can respond with a prompt, system action, or next-step suggestion.

**Request Body**

```json
{
  "message": "Hello, I'd like to send some ETH to bob",
  "walletAddress": "0x...",
  "userId": "user-id"
}
```

**Success Response — `200 OK`**

```json
{
  "roomCreated": {
    "roomId": "room-id",
    "ownerId": "user-id",
    "isNew": true
  },
  "messages": [
    {
      "roomId": "room-id",
      "messageId": "message-id",
      "messageContent": "I'll help you send ETH to bob. How much would you like to send?",
      "ownerId": "user-id",
      "action": "NONE",
      "isSystem": true
    }
  ],
  "data": null
}
```

**Error Responses**

| HTTP Code                   | Description                         |
| --------------------------- | ----------------------------------- |
| `400 Bad Request`           | Missing `userId` or invalid message |
| `404 Not Found`             | User not found                      |
| `500 Internal Server Error` | Messaging or AI agent error         |

***

### 2. Get Rooms

`GET /agent/rooms`\
**Authentication:** Required

**Query Parameters**

* `userId` (string, required)

**Success Response — `200 OK`**

```json
[
  {
    "roomId": "room-id-1",
    "ownerId": "user-id",
    "createdAt": "2023-01-01T00:00:00.000Z",
    "updatedAt": "2023-01-01T00:00:00.000Z"
  },
  {
    "roomId": "room-id-2",
    "ownerId": "user-id",
    "createdAt": "2023-01-01T00:00:00.000Z",
    "updatedAt": "2023-01-01T00:00:00.000Z"
  }
]
```

**Error Responses**

| HTTP Code         | Description                          |
| ----------------- | ------------------------------------ |
| `400 Bad Request` | Missing user ID                      |
| `404 Not Found`   | User not found                       |
| `400 Bad Request` | General error (e.g. malformed input) |

***

### 3. Get Latest Room Messages

&#x20;`GET /agent/get-latest-room-messages`\
**Authentication:** Required

**Query Parameters**

* `userId` (string, required)
* `page` (number, optional, default: 1)
* `pageSize` (number, optional, default: 20)

**Success Response — `200 OK`**

```json
{
  "messages": [
    {
      "id": "message-id",
      "roomId": "room-id",
      "messageId": "message-uuid",
      "messageContent": "Hello, I'd like to send some ETH to bob",
      "ownerId": "user-id",
      "action": "NONE",
      "isSystem": false,
      "createdAt": "2023-01-01T00:00:00.000Z"
    },
    {
      "id": "message-id-2",
      "roomId": "room-id",
      "messageId": "message-uuid-2",
      "messageContent": "I'll help you send ETH to bob. How much would you like to send?",
      "ownerId": "user-id",
      "action": "NONE",
      "isSystem": true,
      "createdAt": "2023-01-01T00:00:00.000Z"
    }
  ],
  "totalCount": 2,
  "page": 1,
  "pageSize": 20,
  "totalPages": 1
}
```

**Error Responses**

| HTTP Code         | Description                   |
| ----------------- | ----------------------------- |
| `400 Bad Request` | Missing user ID or room ID    |
| `404 Not Found`   | User not found                |
| `400 Bad Request` | Invalid input or system error |

***

### 4. Get Messages from Specific Room

`GET /agent/rooms/:roomId`\
**Authentication:** Required

**Path Parameters**

* `roomId` (string, required)

**Query Parameters**

* `userId` (string, required)
* `page` (number, optional, default: 1)
* `pageSize` (number, optional, default: 20)

**Success Response — `200 OK`**

```json
{
  "messages": [
    {
      "id": "message-id",
      "roomId": "room-id",
      "messageId": "message-uuid",
      "messageContent": "Hello",
      "ownerId": "user-id",
      "action": "NONE",
      "isSystem": false,
      "createdAt": "2023-01-01T00:00:00.000Z"
    }
  ],
  "totalCount": 1,
  "page": 1,
  "pageSize": 20,
  "totalPages": 1
}
```

**Error Responses**

| HTTP Code         | Description                |
| ----------------- | -------------------------- |
| `400 Bad Request` | Missing user ID or room ID |
| `404 Not Found`   | User or room not found     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.reveel.id/agents-old.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
