# Rhun REST API

{% hint style="info" %}
You will need an API Key to access the Rhun REST API. Get your API Key at <https://beta.rhun.io/account>
{% endhint %}

The Rhun REST API provides programmatic access to the core functionality of the Rhun trading and research platform. Designed for developers, quants, and crypto analysts, this API enables seamless integration with Rhun’s suite of financial intelligence tools.

**Key Features:**

* Access real-time and historical market data
* Analyze token trends, movements, and sentiment
* Execute custom research queries through AI-enhanced endpoints
* Integrate Rhun tools into custom dashboards, bots, or trading strategies

## POST /api/chat

> Chat with the AI

```json
{"openapi":"3.0.0","info":{"title":"RHUN API","version":"1.0.0"},"servers":[{"url":"https://beta.rhun.io","description":"Production server"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/api/chat":{"post":{"summary":"Chat with the AI","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["messages","agent"],"properties":{"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string"}}}},"agent":{"type":"object","required":["id","userId"],"properties":{"id":{"type":"string"},"userId":{"type":"string"}}}}}}}},"responses":{"200":{"description":"Chat response","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## GET /api/agents

> List agents

```json
{"openapi":"3.0.0","info":{"title":"RHUN API","version":"1.0.0"},"servers":[{"url":"https://beta.rhun.io","description":"Production server"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Agent":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"imageUrl":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"model":{"type":"string","enum":["claude-3-5-sonnet-20240620","deepseek-chat","gpt-4-turbo","mistral-large-latest"]},"configuration":{"type":"object","properties":{"coreCapabilities":{"type":"string","description":"Core capabilities and knowledge domains of the agent"},"interactionStyle":{"type":"string","description":"How the agent should interact with users"},"analysisApproach":{"type":"string","description":"The agent's approach to analysis"},"riskCommunication":{"type":"string","description":"How the agent communicates risks"},"responseFormat":{"type":"string","description":"Format for agent responses"},"limitationsDisclaimers":{"type":"string","description":"Limitations and disclaimers for the agent"},"prohibitedBehaviors":{"type":"string","description":"Behaviors the agent must avoid"},"knowledgeUpdates":{"type":"string","description":"How the agent should handle knowledge updates"},"specialInstructions":{"type":"string","description":"Special instructions for the agent"},"wallets":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string"},"network":{"type":"string"},"type":{"type":"string"}}}}}}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/api/agents":{"get":{"summary":"List agents","responses":{"200":{"description":"List of agents","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## POST /api/agents

> Create new agent

```json
{"openapi":"3.0.0","info":{"title":"RHUN API","version":"1.0.0"},"servers":[{"url":"https://beta.rhun.io","description":"Production server"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/api/agents":{"post":{"summary":"Create new agent","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"data":{"type":"object","description":"Agent data object","properties":{"name":{"type":"string"},"description":{"type":"string"},"model":{"type":"string","enum":["claude-3-5-sonnet-20240620","deepseek-chat","gpt-4-turbo","mistral-large-latest"]},"configuration":{"type":"object","properties":{"coreCapabilities":{"type":"string"},"interactionStyle":{"type":"string"},"analysisApproach":{"type":"string"},"riskCommunication":{"type":"string"},"responseFormat":{"type":"string"},"limitationsDisclaimers":{"type":"string"},"prohibitedBehaviors":{"type":"string"},"knowledgeUpdates":{"type":"string"},"specialInstructions":{"type":"string"}}}}},"image":{"type":"string","format":"binary","description":"Agent profile image (optional)"}}}}}},"responses":{"201":{"description":"Agent created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"agentId":{"type":"string"},"userId":{"type":"string"},"imageUrl":{"type":"string","nullable":true}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## GET /api/watchers

> List watchers

```json
{"openapi":"3.0.0","info":{"title":"RHUN API","version":"1.0.0"},"servers":[{"url":"https://beta.rhun.io","description":"Production server"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/api/watchers":{"get":{"summary":"List watchers","responses":{"200":{"description":"List of watchers","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"}}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## POST /api/watchers

> Create new watcher

```json
{"openapi":"3.0.0","info":{"title":"RHUN API","version":"1.0.0"},"servers":[{"url":"https://beta.rhun.io","description":"Production server"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}}}}},"paths":{"/api/watchers":{"post":{"summary":"Create new watcher","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"configuration":{"type":"object"}}}}}},"responses":{"201":{"description":"Watcher created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## The Error object

```json
{"openapi":"3.0.0","info":{"title":"RHUN API","version":"1.0.0"},"components":{"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"string"}}}}}}
```

## The Agent object

```json
{"openapi":"3.0.0","info":{"title":"RHUN API","version":"1.0.0"},"components":{"schemas":{"Agent":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"imageUrl":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"model":{"type":"string","enum":["claude-3-5-sonnet-20240620","deepseek-chat","gpt-4-turbo","mistral-large-latest"]},"configuration":{"type":"object","properties":{"coreCapabilities":{"type":"string","description":"Core capabilities and knowledge domains of the agent"},"interactionStyle":{"type":"string","description":"How the agent should interact with users"},"analysisApproach":{"type":"string","description":"The agent's approach to analysis"},"riskCommunication":{"type":"string","description":"How the agent communicates risks"},"responseFormat":{"type":"string","description":"Format for agent responses"},"limitationsDisclaimers":{"type":"string","description":"Limitations and disclaimers for the agent"},"prohibitedBehaviors":{"type":"string","description":"Behaviors the agent must avoid"},"knowledgeUpdates":{"type":"string","description":"How the agent should handle knowledge updates"},"specialInstructions":{"type":"string","description":"Special instructions for the agent"},"wallets":{"type":"array","items":{"type":"object","properties":{"address":{"type":"string"},"network":{"type":"string"},"type":{"type":"string"}}}}}}}}}}}
```

<br>
