> 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/ja/qu-yin/agent-api/api-reference-x402.md).

# APIリファレンス（x402）

### Developer x402 API

Pay-As-You-Goモデルを使用したMinaraのx402エンドポイントの技術仕様。

**ベース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 Created

```json
{
  "content": "BTCは現在98,450ドルで取引されています。主要なサポートレベルは96,500ドルと94,200ドルです。97,000ドルを強い出来高で上抜けした最近のブレイクアウトは、強気継続を示唆しています..."
}
```

***

### チャットエキスパート（Baseチェーン）

**エンドポイント:** `POST /x402/chat/expert`

Baseチェーン上のインテリジェントな暗号資産アシスタントMinara AIに、エキスパートモードで質問

#### リクエスト

**ヘッダー:**

* `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 Created

```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 '{
    Solanaで今トレンド上位のトークンを表示して
  }'
```

#### レスポンス

**ステータス:** 201 Created

```json
{
  "content": "トレンド上位のSolanaトークン:\n1. WIF - 24%上昇、24時間出来高は4,500万ドル\n2. BONK - 強いコミュニティ活動で18%上昇\n3. JUP - 最近の急騰後に持ち合い、出来高は3,800万ドル..."
}
```

### チャットエキスパート（Solanaチェーン）

**エンドポイント:** `POST /x402/solana/chat/expert`

Solanaチェーン上のインテリジェントな暗号資産アシスタントMinara AIに、エキスパートモードで質問

#### リクエスト

**ヘッダー:**

* `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 Created

```json
{
  "content": "**JUPトークン詳細分析**\n\n**流動性分布**: 主要DEX全体の総流動性は1億2,500万ドルで、その65%が0.85〜0.92ドルのレンジに集中しています...\n\n**クジラ活動**: 上位10保有者が供給量の34%を支配しています。過去24時間で合計420万ドルの買いを伴う重要なクジラ取引が3件検出されました...\n\n**リスク評価**: 1.00ドルを超えると流動性リスクは中程度です。ポジションサイズを決める際に考慮してください..."
}
```

***

### チャット（Polygonチェーン）

**エンドポイント:** `POST /x402/polygon/chat`

Polygonチェーン上のインテリジェントな暗号資産アシスタントMinara AIに質問

#### リクエスト

**ヘッダー:**

* `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 Created

```json
{
  "content": "BTCは現在98,450ドルで取引されています。主要なサポートレベルは96,500ドルと94,200ドルです。97,000ドルを強い出来高で上抜けした最近のブレイクアウトは、強気継続を示唆しています..."
}
```

***

### チャットエキスパート（Polygonチェーン）

**エンドポイント:** `POST /x402/polygon/chat/expert`

Polygonチェーン上のインテリジェントな暗号資産アシスタントMinara AIに、エキスパートモードで質問

#### リクエスト

**ヘッダー:**

* `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 Created

```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`

自然言語の取引意図を、実行可能なスワップ取引ペイロードに変換します。デフォルトではOKX DEXと互換性があります。

#### リクエスト

**ヘッダー:**

* `x-payment-response` （必須）- x402プロトコルの支払い証明トークン
* `Content-Type: application/json`

**ボディパラメータ:**

| パラメータ           | 種類     | 必須  | 説明                                                          |
| --------------- | ------ | --- | ----------------------------------------------------------- |
| `intent`        | string | はい  | 自然言語のスワップ意図（例: "swap 0.1 ETH to 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": "swap 0.1 ETH to USDC",
    "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
    "chain": "base"
  }'
```

#### レスポンス

**ステータス:** 201 Created

```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`

包括的な市場分析に基づき、ロング/ショートの推奨、エントリー価格、ストップロス、利確水準、信頼度スコアを含むAI搭載のパーペチュアル取引提案を取得します。

#### リクエスト

**ヘッダー:**

* `x-payment-response` （必須）- x402プロトコルの支払い証明トークン
* `Content-Type: application/json`

**ボディパラメータ:**

| パラメータ       | 種類     | 必須  | デフォルト     | 説明                                                     |
| ----------- | ------ | --- | --------- | ------------------------------------------------------ |
| `symbol`    | string | はい  | -         | 取引シンボル（例: "BTC", "ETH", "SOL"）                         |
| `style`     | string | いいえ | "スキャルピング" | 取引スタイル: "scalping", "day-trading", または "swing-trading" |
| `marginUSD` | number | いいえ | 1000      | USD建ての証拠金                                              |
| `leverage`  | number | いいえ | 10        | レバレッジ倍率（最大: 40）                                        |
| `strategy`  | string | いいえ | "最大利益"    | 戦略タイプ（今後さらに追加予定）                                       |

#### リクエスト例

```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": "最大利益"
  }'
```

#### レスポンス

**ステータス:** 201 Created

```json
{
  "entryPrice": 98450,
  "side": "long",
  "stopLossPrice": 96200,
  "takeProfitPrice": 102800,
  "confidence": 78,
  "reasons": [
    "BTCは強い出来高で97,500ドルの主要レジスタンスを上抜けした",
    "RSIが62で、買われすぎではない強気モメンタムを示している",
    "MACDが4時間足で強気クロスオーバーを示している",
    "出来高プロファイルは現在の水準での蓄積を示している"
  ],
  "risks": [
    "100,000ドルの心理的レジスタンスで押し戻される可能性",
    "今後のFRB会合を前に高いボラティリティが予想される",
    "主要取引所の資金調達率が上昇傾向にある"
  ]
}
```

***

### 予測市場分析（Baseチェーン）

**エンドポイント:** `POST /x402/prediction-market-ask`

AI搭載の予測市場分析。予測市場のイベントを分析し、各結果の確率推定を詳細な理由とともに取得します。

#### リクエスト

**ヘッダー:**

* `x-payment-response` （必須）- x402プロトコルの支払い証明トークン
* `Content-Type: application/json`

**ボディパラメータ:**

| パラメータ          | 種類      | 必須  | デフォルト | 説明                                 |
| -------------- | ------- | --- | ----- | ---------------------------------- |
| `link`         | string  | はい  | -     | 予測市場ページのリンク（例: PolymarketのイベントURL） |
| `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 Created

```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チェーン上のAI搭載予測市場分析。Baseチェーンのエンドポイントと同じ機能です。

#### リクエスト

**ヘッダー:**

* `x-payment-response` （必須）- x402プロトコルの支払い証明トークン
* `Content-Type: application/json`

**ボディパラメータ:**

上記のBaseチェーンのエンドポイントと同じです。

#### リクエスト例

```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 Created

Baseチェーンのエンドポイントと同じレスポンス形式です。

***

## エラーレスポンス

### 402 Payment Required

支払い認証情報なしでの初回リクエストは次を返します:

```json
{
  "error": "payment_required",
  "message": "このリソースにアクセスするには支払いが必要です",
  "paymentInstructions": {
    "amount": "0.20",
    "currency": "USDC",
    "recipient": "0x...",
    "chain": "base"
  }
}
```

### 401 Unauthorized

無効または期限切れの支払い証明:

```json
{
  "error": "unauthorized",
  "message": "無効な支払い応答トークン"
}
```

### 400 Bad Request

無効なリクエストパラメータ:

```json
{
  "error": "bad_request",
  "message": "必須パラメータ userQuery がありません"
}
```

***

## レート制限

x402エンドポイントはウォレットアドレスごとにレート制限があります:

* **AIエンドポイント:** 1分あたり60リクエスト
* **取引エンドポイント:** 1分あたり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/ja/qu-yin/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.
