# Agent API

{% hint style="warning" %}
The Agent API is currently in Beta - Please report any issues or feedback in our [Telegram Group](https://t.me/+KCMjT02DBX84Zjkx)
{% endhint %}

***

## About

The Agent API is the next evolution of Katoshi - Allowing you to send complex commands to your AI Agents using natural language via simple POST requests or using webhooks. \
\
**Read more about agent capabilities here:**

{% content-ref url="/pages/U6joZrxzgxPg3EpcXPSa" %}
[Agents](/katoshi-docs/app/agents.md)
{% endcontent-ref %}

***

## Quick Start

<mark style="color:green;">`POST`</mark> `https://api.katoshi.ai/agent?id=USER_ID`

Replace `USER_ID` with your unique ID, which can be found in the [Settings Page](https://katoshi.ai/app?view=settings)

### Headers

| Name                                             | Type   | Description        |
| ------------------------------------------------ | ------ | ------------------ |
| `Content-Type`<mark style="color:red;">\*</mark> | String | `application/json` |

### Request Body

| Name                                            | Type   | Description                                                   |
| ----------------------------------------------- | ------ | ------------------------------------------------------------- |
| `api_key`<mark style="color:red;">\*</mark>     | String | Katoshi API Key                                               |
| `agent_id`<mark style="color:red;">\*</mark>    | Number | ID of your agent                                              |
| `message`<mark style="color:$danger;">\*</mark> | String | Message sent to your agent                                    |
| `stream`                                        | Bool   | Enable stream response                                        |
| `aync_run`                                      | Bool   | Runs in the background without waiting for the agent response |

### Example Request

```json
{
  "message": "Long BTC with $11 if the 15m RSI is oversold",
  "api_key": "12345678-1234-1234-1234-123456789012",
  "agent_id": 7
}
```

{% hint style="info" %}
For [TradingView](/katoshi-docs/integrations/tradingview.md), add the Request JSON directly in the alert message field.
{% endhint %}

***

## Testing

Test your commands using the Agents chat interface in Katoshi.

{% hint style="info" %}
Results can vary tremendously based on your selected LLM model, system prompt, and message sent.&#x20;
{% endhint %}

{% content-ref url="/pages/U6joZrxzgxPg3EpcXPSa" %}
[Agents](/katoshi-docs/app/agents.md)
{% endcontent-ref %}


---

# 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://katoshi.gitbook.io/katoshi-docs/api/agent-api.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.
