> For the complete documentation index, see [llms.txt](https://minara.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://minara.ai/docs/minara-handbook/ru/torgovlya/agent-api/api-reference-x402.md).

# Справочник API (x402)

### API разработчика x402

Технические спецификации конечных точек x402 Minara с использованием модели Pay-As-You-Go.

**Базовый URL**: `https://x402.minara.ai`

## Chat (Base Chain)

> Ask Minara AI - Intelligent crypto assistant

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"ChatRequest":{"type":"object","required":["userQuery"],"properties":{"userQuery":{"type":"string","description":"Required. User query content."}}},"ChatResponse":{"type":"object","properties":{"content":{"type":"string","description":"AI response content."}}},"BadRequestError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}},"UnauthorizedError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/chat":{"post":{"summary":"Chat (Base Chain)","description":"Ask Minara AI - Intelligent crypto assistant","operationId":"x402Chat","tags":["AI"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"400":{"description":"Bad Request - Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}},"401":{"description":"Unauthorized - Invalid payment response token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Chat Expert (Base Chain)

> Ask Minara AI - Intelligent crypto assistant

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"ChatRequest":{"type":"object","required":["userQuery"],"properties":{"userQuery":{"type":"string","description":"Required. User query content."}}},"ChatResponse":{"type":"object","properties":{"content":{"type":"string","description":"AI response content."}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/chat/expert":{"post":{"summary":"Chat Expert (Base Chain)","description":"Ask Minara AI - Intelligent crypto assistant","operationId":"x402ChatExpert","tags":["AI"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"400":{"description":"Bad Request - Invalid parameters"},"401":{"description":"Unauthorized - Invalid payment response token"},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Chat (Polygon Chain)

> Ask Minara AI - Intelligent crypto assistant

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"ChatRequest":{"type":"object","required":["userQuery"],"properties":{"userQuery":{"type":"string","description":"Required. User query content."}}},"ChatResponse":{"type":"object","properties":{"content":{"type":"string","description":"AI response content."}}},"BadRequestError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}},"UnauthorizedError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/polygon/chat":{"post":{"summary":"Chat (Polygon Chain)","description":"Ask Minara AI - Intelligent crypto assistant","operationId":"x402PolygonChat","tags":["AI"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"400":{"description":"Bad Request - Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}},"401":{"description":"Unauthorized - Invalid payment response token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Chat Expert (Polygon Chain)

> Ask Minara AI - Intelligent crypto assistant

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"ChatRequest":{"type":"object","required":["userQuery"],"properties":{"userQuery":{"type":"string","description":"Required. User query content."}}},"ChatResponse":{"type":"object","properties":{"content":{"type":"string","description":"AI response content."}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/polygon/chat/expert":{"post":{"summary":"Chat Expert (Polygon Chain)","description":"Ask Minara AI - Intelligent crypto assistant","operationId":"x402PolygonChatExpert","tags":["AI"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"400":{"description":"Bad Request - Invalid parameters"},"401":{"description":"Unauthorized - Invalid payment response token"},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Chat (Solana Chain)

> Ask Minara AI - Intelligent crypto assistant

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"ChatRequest":{"type":"object","required":["userQuery"],"properties":{"userQuery":{"type":"string","description":"Required. User query content."}}},"ChatResponse":{"type":"object","properties":{"content":{"type":"string","description":"AI response content."}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/solana/chat":{"post":{"summary":"Chat (Solana Chain)","description":"Ask Minara AI - Intelligent crypto assistant","operationId":"x402SolanaChat","tags":["AI"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"400":{"description":"Bad Request - Invalid parameters"},"401":{"description":"Unauthorized - Invalid payment response token"},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Chat Expert (Solana Chain)

> Ask Minara AI - Intelligent crypto assistant

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"ChatRequest":{"type":"object","required":["userQuery"],"properties":{"userQuery":{"type":"string","description":"Required. User query content."}}},"ChatResponse":{"type":"object","properties":{"content":{"type":"string","description":"AI response content."}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/solana/chat/expert":{"post":{"summary":"Chat Expert (Solana Chain)","description":"Ask Minara AI - Intelligent crypto assistant","operationId":"x402SolanaChatExpert","tags":["AI"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"400":{"description":"Bad Request - Invalid parameters"},"401":{"description":"Unauthorized - Invalid payment response token"},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Perpetual Trading Suggestion

> Get AI-powered perpetual trading suggestions with long/short recommendations, entry price, stop loss, take profit levels, and confidence score.

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"PerpTradingRequest":{"type":"object","required":["symbol"],"properties":{"symbol":{"type":"string","description":"Required. Trading symbol (e.g., 'BTC', 'ETH', 'SOL')."},"style":{"type":"string","enum":["scalping","day-trading","swing-trading"],"default":"scalping","description":"Optional. Trading style: 'scalping', 'day-trading', or 'swing-trading'. Default: 'scalping'."},"marginUSD":{"type":"number","default":1000,"description":"Optional. Margin in USD. Default: 1000."},"leverage":{"type":"number","default":10,"minimum":1,"maximum":40,"description":"Optional. Leverage multiplier (max: 40). Default: 10."},"strategy":{"type":"string","default":"max-profit","description":"Optional. Strategy type. Default: 'max-profit'. More strategies coming soon."}}},"PerpTradingResponse":{"type":"object","properties":{"entryPrice":{"type":"number","description":"Recommended entry price."},"side":{"type":"string","enum":["long","short"],"description":"Trading side recommendation."},"stopLossPrice":{"type":"number","description":"Recommended stop loss price."},"takeProfitPrice":{"type":"number","description":"Recommended take profit price."},"confidence":{"type":"number","minimum":0,"maximum":100,"description":"Confidence score (0-100)."},"reasons":{"type":"array","items":{"type":"string"},"description":"Analysis reasons based on technical indicators."},"risks":{"type":"array","items":{"type":"string"},"description":"Risk factors to consider."}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/perp-trading-suggestion":{"post":{"summary":"Perpetual Trading Suggestion","description":"Get AI-powered perpetual trading suggestions with long/short recommendations, entry price, stop loss, take profit levels, and confidence score.","operationId":"x402PerpTradingSuggestion","tags":["Trading"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PerpTradingRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PerpTradingResponse"}}}},"400":{"description":"Bad Request - Invalid parameters"},"401":{"description":"Unauthorized - Invalid payment response token"},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Intent to Swap Transaction

> Convert natural language trading intent into an executable swap transaction payload. Compatible with OKX DEX by default.

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"IntentToSwapRequest":{"type":"object","required":["intent","walletAddress"],"properties":{"intent":{"type":"string","description":"Required. Natural language swap intent (e.g., 'swap 0.1 ETH to USDC')."},"walletAddress":{"type":"string","description":"Required. User wallet address (0x...)."},"chain":{"type":"string","description":"Optional. Chain name (e.g., 'base', 'ethereum', 'bsc', 'arbitrum', 'optimism')."}}},"SwapTransactionResponse":{"type":"object","properties":{"transaction":{"type":"object","description":"Swap transaction details","properties":{"chain":{"type":"string","description":"Chain name."},"inputTokenAddress":{"type":"string","description":"Input token contract address."},"inputTokenSymbol":{"type":"string","description":"Input token symbol."},"outputTokenAddress":{"type":"string","description":"Output token contract address."},"outputTokenSymbol":{"type":"string","description":"Output token symbol."},"amount":{"type":"string","description":"Transaction amount."},"amountPercentage":{"type":"number","description":"Amount percentage."},"slippagePercent":{"type":"string","description":"Slippage percentage."}}}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/intent-to-swap-tx":{"post":{"summary":"Intent to Swap Transaction","description":"Convert natural language trading intent into an executable swap transaction payload. Compatible with OKX DEX by default.","operationId":"x402IntentToSwap","tags":["Trading"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntentToSwapRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapTransactionResponse"}}}},"400":{"description":"Bad Request - Invalid parameters"},"401":{"description":"Unauthorized - Invalid payment response token"},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Prediction Market Analysis (Base Chain)

> AI-powered prediction market analysis. Analyze prediction market events and get probability estimates for each outcome with detailed reasoning.

```json
{"openapi":"3.0.0","info":{"title":"Minara x402 API","version":"1.0"},"servers":[{"url":"https://x402.minara.ai"}],"security":[{"x402Payment":[]}],"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"header","name":"x-payment-response","description":"Payment proof token obtained from x402 payment challenge flow. Required after completing payment."}},"schemas":{"PredictionMarketRequest":{"type":"object","required":["link","mode"],"properties":{"link":{"type":"string","description":"Required. Prediction market page link (e.g., Polymarket event URL)."},"mode":{"type":"string","enum":["fast","expert"],"description":"Required. Chat mode: 'fast' or 'expert'."},"only_result":{"type":"boolean","default":false,"description":"Optional. Only return prediction probabilities without reasoning. Default: false."},"customPrompt":{"type":"string","description":"Optional. Custom instructions to guide the analysis. Use this to specify focus areas, risk preferences, or analysis style."}}},"PredictionMarketResponse":{"type":"object","properties":{"predictions":{"type":"array","description":"Array of prediction outcomes. Each outcome represents an event option with its yes/no probabilities.","items":{"type":"object","properties":{"outcome":{"type":"string","description":"Outcome name (event option, e.g., candidate name, team name)."},"yesProb":{"type":"number","description":"Probability of YES for this outcome (0-1)."},"noProb":{"type":"number","description":"Probability of NO for this outcome (0-1)."}}}},"reasoning":{"type":"string","description":"AI reasoning and analysis (empty if only_result=true)."}}},"BadRequestError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}},"UnauthorizedError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}},"PaymentRequiredError":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"paymentInstructions":{"type":"object","properties":{"amount":{"type":"string","description":"Payment amount required."},"currency":{"type":"string","description":"Payment currency (e.g., USDC)."},"recipient":{"type":"string","description":"Payment recipient address."},"chain":{"type":"string","description":"Blockchain for payment."}}}}}}},"paths":{"/x402/prediction-market-ask":{"post":{"summary":"Prediction Market Analysis (Base Chain)","description":"AI-powered prediction market analysis. Analyze prediction market events and get probability estimates for each outcome with detailed reasoning.","operationId":"x402PredictionMarketAsk","tags":["Prediction"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionMarketRequest"}}}},"responses":{"201":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionMarketResponse"}}}},"400":{"description":"Bad Request - Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestError"}}}},"401":{"description":"Unauthorized - Invalid payment response token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedError"}}}},"402":{"description":"Payment Required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequiredError"}}}}}}}}}
```

## Конечные точки

### Чат (сеть Base)

**Конечная точка:** `POST /x402/chat`

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр    | Тип    | Требуется | Описание                             |
| ----------- | ------ | --------- | ------------------------------------ |
| `userQuery` | string | Да        | Содержимое пользовательского запроса |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/chat \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "userQuery": "Какова текущая цена BTC и какие ключевые уровни поддержки?"
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "content": "Сейчас BTC торгуется по $98,450. Ключевые уровни поддержки находятся на $96,500 и $94,200. Недавний пробой выше $97,000 на высоком объеме указывает на продолжение бычьего движения..."
}
```

***

### Чат-эксперт (сеть Base)

**Конечная точка:** `POST /x402/chat/expert`

Спросите Minara AI - интеллектуального крипто-ассистента в сети Base в режиме эксперта

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр    | Тип    | Требуется | Описание                             |
| ----------- | ------ | --------- | ------------------------------------ |
| `userQuery` | string | Да        | Содержимое пользовательского запроса |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/chat/expert \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "userQuery": "Предоставьте подробный анализ ETH, включая ончейн-метрики и торговую стратегию"
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "content": "Подробный анализ ETH:\n\n**Движение цены**: ETH торгуется по $3,420, консолидируясь в диапазоне $3,400-$3,500...\n\n**Ончейн-метрики**: Количество активных адресов увеличилось на 12% по сравнению с прошлой неделей, что указывает на рост активности сети...\n\n**Торговая стратегия**: Рассмотрите накопление на откатах к поддержке $3,300 с целями на $3,600 и $3,850..."
}
```

***

### Чат (сеть Solana)

**Конечная точка:** `POST /x402/solana/chat`

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр    | Тип    | Требуется | Описание                             |
| ----------- | ------ | --------- | ------------------------------------ |
| `userQuery` | string | Да        | Содержимое пользовательского запроса |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/solana/chat \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "userQuery": "Покажи мне самые трендовые токены на Solana прямо сейчас"
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "content": "Самые трендовые токены Solana:\n1. WIF - рост на 24% при объеме $45M за 24ч\n2. BONK - рост на 18% при высокой активности сообщества\n3. JUP - консолидация после недавнего пампа, объем $38M..."
}
```

### Чат-эксперт (сеть Solana)

**Конечная точка:** `POST /x402/solana/chat/expert`

Спросите Minara AI - интеллектуального крипто-ассистента в сети Solana в режиме эксперта

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр    | Тип    | Требуется | Описание                             |
| ----------- | ------ | --------- | ------------------------------------ |
| `userQuery` | string | Да        | Содержимое пользовательского запроса |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/solana/chat/expert \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "userQuery": "Проанализируйте распределение ликвидности и движения китов для токена JUP"
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "content": "**Глубокий анализ токена JUP**\n\n**Распределение ликвидности**: Общая ликвидность на основных DEX составляет $125M, при этом 65% сосредоточено в диапазоне $0.85-$0.92...\n\n**Активность китов**: Топ-10 держателей контролируют 34% предложения. За последние 24ч обнаружено 3 значимые транзакции китов на общую сумму $4.2M в покупках...\n\n**Оценка риска**: Умеренный риск ликвидности выше отметки $1.00. Учитывайте это при размере позиции..."
}
```

***

### Чат (сеть Polygon)

**Конечная точка:** `POST /x402/polygon/chat`

Спросите Minara AI - интеллектуального крипто-ассистента в сети Polygon

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр    | Тип    | Требуется | Описание                             |
| ----------- | ------ | --------- | ------------------------------------ |
| `userQuery` | string | Да        | Содержимое пользовательского запроса |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/polygon/chat \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "userQuery": "Какова текущая цена BTC и какие ключевые уровни поддержки?"
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "content": "Сейчас BTC торгуется по $98,450. Ключевые уровни поддержки находятся на $96,500 и $94,200. Недавний пробой выше $97,000 на высоком объеме указывает на продолжение бычьего движения..."
}
```

***

### Чат-эксперт (сеть Polygon)

**Конечная точка:** `POST /x402/polygon/chat/expert`

Спросите Minara AI - интеллектуального крипто-ассистента в сети Polygon в режиме эксперта

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр    | Тип    | Требуется | Описание                             |
| ----------- | ------ | --------- | ------------------------------------ |
| `userQuery` | string | Да        | Содержимое пользовательского запроса |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/polygon/chat/expert \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "userQuery": "Предоставьте подробный анализ ETH, включая ончейн-метрики и торговую стратегию"
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "content": "**Подробный анализ ETH**\n\n**Движение цены**: ETH торгуется по $3,420, консолидируясь в диапазоне $3,400-$3,500...\n\n**Ончейн-метрики**: Количество активных адресов увеличилось на 12% по сравнению с прошлой неделей, что указывает на рост активности сети...\n\n**Торговая стратегия**: Рассмотрите накопление на откатах к поддержке $3,300 с целями на $3,600 и $3,850..."
}
```

***

## Торговые конечные точки

### Транзакция по намерению обмена

**Конечная точка:** `POST /x402/intent-to-swap-tx`

Преобразуйте торговое намерение на естественном языке в исполняемый полезный payload транзакции обмена. По умолчанию совместимо с OKX DEX.

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр        | Тип    | Требуется | Описание                                                                    |
| --------------- | ------ | --------- | --------------------------------------------------------------------------- |
| `intent`        | string | Да        | Намерение свопа на естественном языке (например, "обменяй 0.1 ETH на USDC") |
| `walletAddress` | string | Да        | Адрес кошелька пользователя (0x...)                                         |
| `chain`         | string | Нет       | Имя сети (например, "base", "ethereum", "bsc", "arbitrum", "optimism")      |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/intent-to-swap-tx \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "intent": "обменять 0.1 ETH на USDC",
    "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
    "chain": "base"
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "transaction": {
    "chain": "base",
    "inputTokenAddress": "0x4200000000000000000000000000000000000006",
    "inputTokenSymbol": "ETH",
    "outputTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "outputTokenSymbol": "USDC",
    "amount": "0.1",
    "amountPercentage": 100,
    "slippagePercent": "0.5"
  }
}
```

***

### Рекомендация по бессрочной торговле

**Конечная точка:** `POST /x402/perp-trading-suggestion`

Получите рекомендации по бессрочной торговле на базе ИИ с рекомендациями long/short, ценой входа, стоп-лоссом, уровнями take-profit и оценкой уверенности на основе всестороннего анализа рынка.

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр    | Тип    | Требуется | По умолчанию | Описание                                                      |
| ----------- | ------ | --------- | ------------ | ------------------------------------------------------------- |
| `symbol`    | string | Да        | -            | Торговый символ (например, "BTC", "ETH", "SOL")               |
| `style`     | string | Нет       | "scalping"   | Стиль торговли: "scalping", "day-trading" или "swing-trading" |
| `marginUSD` | number | Нет       | 1000         | Маржа в USD                                                   |
| `leverage`  | number | Нет       | 10           | Множитель кредитного плеча (макс.: 40)                        |
| `strategy`  | string | Нет       | "max-profit" | Тип стратегии (скоро появятся новые стратегии)                |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/perp-trading-suggestion \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "symbol": "BTC",
    "style": "day-trading",
    "marginUSD": 1000,
    "leverage": 10,
    "strategy": "max-profit"
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "entryPrice": 98450,
  "side": "long",
  "stopLossPrice": 96200,
  "takeProfitPrice": 102800,
  "confidence": 78,
  "reasons": [
    "BTC пробил ключевое сопротивление на уровне $97,500 на фоне высокого объема",
    "RSI на уровне 62 указывает на бычий импульс без перекупленности",
    "MACD показывает бычье пересечение на 4-часовом таймфрейме",
    "Профиль объема показывает накопление на текущих уровнях"
  ],
  "risks": [
    "Возможная коррекция на психологическом сопротивлении $100,000",
    "Ожидается высокая волатильность вокруг предстоящего заседания ФРС",
    "Фандинговые ставки на основных биржах растут"
  ]
}
```

***

### Анализ рынка прогнозов (сеть Base)

**Конечная точка:** `POST /x402/prediction-market-ask`

Анализ рынка прогнозов на базе ИИ. Анализируйте события рынка прогнозов и получайте оценки вероятностей для каждого исхода с подробным обоснованием.

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

| Параметр       | Тип     | Требуется | По умолчанию | Описание                                                              |
| -------------- | ------- | --------- | ------------ | --------------------------------------------------------------------- |
| `link`         | string  | Да        | -            | Ссылка на страницу рынка прогнозов (например, URL события Polymarket) |
| `mode`         | string  | Да        | -            | Режим чата: "fast" или "expert"                                       |
| `only_result`  | boolean | Нет       | false        | Возвращайте только вероятности прогнозов без обоснования              |
| `customPrompt` | string  | Нет       | -            | Пользовательские инструкции для направления анализа                   |

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/prediction-market-ask \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "link": "https://polymarket.com/event/will-there-be-another-us-government-shutdown-by-january-31",
    "mode": "fast",
    "only_result": false,
    "customPrompt": "Сосредоточьтесь на последних новостях и анализе настроений. Будьте более консервативны в оценках вероятностей."
  }'
```

#### Ответ

**Статус:** 201 Создано

```json
{
  "predictions": [
    {
      "outcome": "Donald Trump",
      "yesProb": 0.65,
      "noProb": 0.35
    },
    {
      "outcome": "Kamala Harris",
      "yesProb": 0.3,
      "noProb": 0.7
    }
  ],
  "reasoning": "На основе последних данных опросов и исторических тенденций Трамп сохраняет небольшое преимущество в ключевых колеблющихся штатах. Однако гонка остается крайне конкурентной, с высокой степенью неопределенности..."
}
```

***

### Анализ рынка прогнозов (сеть Polygon)

**Конечная точка:** `POST /x402/polygon/prediction-market-ask`

Анализ рынка прогнозов на базе ИИ в сети Polygon. Та же функциональность, что и у конечной точки Base chain.

#### Запрос

**Заголовки:**

* `x-payment-response` (обязательно) - токен подтверждения оплаты из протокола x402
* `Content-Type: application/json`

**Параметры тела:**

То же, что и у конечной точки Base chain выше.

#### Пример запроса

```bash
curl -X POST https://x402.minara.ai/x402/polygon/prediction-market-ask \\
  -H "x-payment-response: <payment_proof_token>" \\
  -H "Content-Type: application/json" \\
  -d '{
    "link": "https://polymarket.com/event/will-there-be-another-us-government-shutdown-by-january-31",
    "mode": "fast",
    "only_result": false
  }'
```

#### Ответ

**Статус:** 201 Создано

Такой же формат ответа, как и у конечной точки Base chain.

***

## Ответы с ошибками

### 402 Требуется оплата

При первоначальном запросе без платежных учетных данных будет возвращено:

```json
{
  "error": "payment_required",
  "message": "Требуется оплата для доступа к этому ресурсу",
  "paymentInstructions": {
    "amount": "0.20",
    "currency": "USDC",
    "recipient": "0x...",
    "chain": "base"
  }
}
```

### 401 Неавторизовано

Недействительное или просроченное подтверждение оплаты:

```json
{
  "error": "unauthorized",
  "message": "Недействительный токен ответа об оплате"
}
```

### 400 Неверный запрос

Недопустимые параметры запроса:

```json
{
  "error": "bad_request",
  "message": "Отсутствует обязательный параметр: userQuery"
}
```

***

## Ограничения по частоте запросов

Для конечных точек x402 действует ограничение частоты запросов по адресу кошелька:

* **Конечные точки ИИ:** 60 запросов в минуту
* **Торговые конечные точки:** 30 запросов в минуту

При превышении лимита будет возвращено:

```json
{
  "error": "rate_limit_exceeded",
  "message": "Слишком много запросов. Пожалуйста, попробуйте снова через 30 секунд.",
  "retryAfter": 30
}
```

***

## Примечания

* Для всех конечных точек x402 требуется `x-payment-response` заголовок после завершения платежного челленджа
* Цены могут изменяться в зависимости от состояния сети
* Для получения дополнительной информации о протоколе x402 см. [Документация x402](https://x402scan.com/server)


---

# 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://minara.ai/docs/minara-handbook/ru/torgovlya/agent-api/api-reference-x402.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.
