> 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/ko/trade/agent-api/api-reference-x402.md).

# API 참조 (x402)

### 개발자 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"}}}}}}}}}
```

## 엔드포인트

### 채팅(베이스 체인)

**엔드포인트:** `POST /x402/chat`

#### 요청

**헤더:**

* `x-payment-response` (필수) - x402 프로토콜의 결제 증명 토큰
* `Content-Type: application/json`

**본문 매개변수:**

| 매개변수        | 유형  | 필수 | 설명        |
| ----------- | --- | -- | --------- |
| `userQuery` | 문자열 | 예  | 사용자 질의 내용 |

#### 예시 요청

```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를 강한 거래량으로 최근 돌파한 것은 상승 추세 지속을 시사합니다..."
}
```

***

### 채팅 전문가(베이스 체인)

**엔드포인트:** `POST /x402/chat/expert`

Minara AI에게 묻기 - 베이스 체인에서 전문가 모드를 갖춘 지능형 암호화폐 어시스턴트

#### 요청

**헤더:**

* `x-payment-response` (필수) - x402 프로토콜의 결제 증명 토큰
* `Content-Type: application/json`

**본문 매개변수:**

| 매개변수        | 유형  | 필수 | 설명        |
| ----------- | --- | -- | --------- |
| `userQuery` | 문자열 | 예  | 사용자 질의 내용 |

#### 예시 요청

```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입니다..."
}
```

***

### 채팅(솔라나 체인)

**엔드포인트:** `POST /x402/solana/chat`

#### 요청

**헤더:**

* `x-payment-response` (필수) - x402 프로토콜의 결제 증명 토큰
* `Content-Type: application/json`

**본문 매개변수:**

| 매개변수        | 유형  | 필수 | 설명        |
| ----------- | --- | -- | --------- |
| `userQuery` | 문자열 | 예  | 사용자 질의 내용 |

#### 예시 요청

```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": "지금 솔라나에서 가장 트렌딩 중인 토큰을 보여줘"
  }'
```

#### 응답

**상태:** 201 Created

```json
{
  "content": "현재 트렌딩 중인 솔라나 토큰:\n1. WIF - 24% 상승, 24시간 거래량 $45M\n2. BONK - 강한 커뮤니티 활동과 함께 18% 상승\n3. JUP - 최근 급등 이후 횡보 중, 거래량 $38M..."
}
```

### 채팅 전문가(솔라나 체인)

**엔드포인트:** `POST /x402/solana/chat/expert`

Minara AI에게 묻기 - 솔라나 체인에서 전문가 모드를 갖춘 지능형 암호화폐 어시스턴트

#### 요청

**헤더:**

* `x-payment-response` (필수) - x402 프로토콜의 결제 증명 토큰
* `Content-Type: application/json`

**본문 매개변수:**

| 매개변수        | 유형  | 필수 | 설명        |
| ----------- | --- | -- | --------- |
| `userQuery` | 문자열 | 예  | 사용자 질의 내용 |

#### 예시 요청

```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 전반의 총 유동성은 $125M이며, 65%가 $0.85-$0.92 구간에 집중되어 있습니다...\n\n**고래 활동**: 상위 10개 보유자가 공급량의 34%를 통제합니다. 최근 24시간 동안 총 $4.2M 규모의 매수로 이어진 의미 있는 고래 거래 3건이 감지되었습니다...\n\n**위험 평가**: $1.00선 위에서는 중간 수준의 유동성 위험이 있습니다. 포지션 규모를 정할 때 이를 고려하세요..."
}
```

***

### 채팅(폴리곤 체인)

**엔드포인트:** `POST /x402/polygon/chat`

Minara AI에게 묻기 - 폴리곤 체인에서 작동하는 지능형 암호화폐 어시스턴트

#### 요청

**헤더:**

* `x-payment-response` (필수) - x402 프로토콜의 결제 증명 토큰
* `Content-Type: application/json`

**본문 매개변수:**

| 매개변수        | 유형  | 필수 | 설명        |
| ----------- | --- | -- | --------- |
| `userQuery` | 문자열 | 예  | 사용자 질의 내용 |

#### 예시 요청

```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를 강한 거래량으로 최근 돌파한 것은 상승 추세 지속을 시사합니다..."
}
```

***

### 채팅 전문가(폴리곤 체인)

**엔드포인트:** `POST /x402/polygon/chat/expert`

Minara AI에게 묻기 - 폴리곤 체인에서 전문가 모드를 갖춘 지능형 암호화폐 어시스턴트

#### 요청

**헤더:**

* `x-payment-response` (필수) - x402 프로토콜의 결제 증명 토큰
* `Content-Type: application/json`

**본문 매개변수:**

| 매개변수        | 유형  | 필수 | 설명        |
| ----------- | --- | -- | --------- |
| `userQuery` | 문자열 | 예  | 사용자 질의 내용 |

#### 예시 요청

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

**본문 매개변수:**

| 매개변수    | 유형  | 필수  | 설명                                                          |
| ------- | --- | --- | ----------------------------------------------------------- |
| `의도`    | 문자열 | 예   | 자연어 스왑 의도(예: "0.1 ETH를 USDC로 스왑")                           |
| `지갑 주소` | 문자열 | 예   | 사용자 지갑 주소(0x...)                                            |
| `체인`    | 문자열 | 아니요 | 체인 이름(예: "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`

**본문 매개변수:**

| 매개변수      | 유형  | 필수  | 기본값          | 설명                                                   |
| --------- | --- | --- | ------------ | ---------------------------------------------------- |
| `심볼`      | 문자열 | 예   | -            | 거래 심볼(예: "BTC", "ETH", "SOL")                        |
| `스타일`     | 문자열 | 아니요 | "scalping"   | 거래 스타일: "scalping", "day-trading" 또는 "swing-trading" |
| `USD 증거금` | 숫자  | 아니요 | 1000         | USD 기준 증거금                                           |
| `레버리지`    | 숫자  | 아니요 | 10           | 레버리지 배수(최대: 40)                                      |
| `전략`      | 문자열 | 아니요 | "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 Created

```json
{
  "entryPrice": 98450,
  "side": "long",
  "stopLossPrice": 96200,
  "takeProfitPrice": 102800,
  "confidence": 78,
  "reasons": [
    "BTC가 강한 거래량으로 주요 저항선 $97,500를 상향 돌파했습니다",
    "RSI가 62로 과매수 구간이 아닌 상태에서 상승 모멘텀을 나타냅니다",
    "MACD가 4시간 차트에서 강세 교차를 보이고 있습니다",
    "거래량 프로필이 현재 수준에서의 매집을 보여줍니다"
  ],
  "risks": [
    "심리적 저항선인 $100,000 부근에서 되돌림 가능성",
    "예정된 연준 회의 전후로 높은 변동성이 예상됨",
    "주요 거래소의 펀딩 비율이 상승 추세"
  ]
}
```

***

### 예측 시장 분석(베이스 체인)

**엔드포인트:** `POST /x402/prediction-market-ask`

AI 기반 예측 시장 분석입니다. 예측 시장 이벤트를 분석하고 각 결과의 확률 추정치와 상세한 근거를 제공합니다.

#### 요청

**헤더:**

* `x-payment-response` (필수) - x402 프로토콜의 결제 증명 토큰
* `Content-Type: application/json`

**본문 매개변수:**

| 매개변수          | 유형  | 필수  | 기본값   | 설명                                  |
| ------------- | --- | --- | ----- | ----------------------------------- |
| `링크`          | 문자열 | 예   | -     | 예측 시장 페이지 링크(예: Polymarket 이벤트 URL) |
| `mode`        | 문자열 | 예   | -     | 채팅 모드: "fast" 또는 "expert"           |
| `결과만`         | 불리언 | 아니요 | false | 추론 없이 예측 확률만 반환                     |
| `사용자 지정 프롬프트` | 문자열 | 아니요 | -     | 분석을 안내하는 사용자 지정 지침                  |

#### 예시 요청

```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": "최근 여론조사 데이터와 역사적 추세를 바탕으로 트럼프는 주요 경합주에서 약간의 우위를 유지하고 있습니다. 그러나 경주는 여전히 매우 치열하며 불확실성이 큽니다..."
}
```

***

### 예측 시장 분석(폴리곤 체인)

**엔드포인트:** `POST /x402/polygon/prediction-market-ask`

폴리곤 체인에서의 AI 기반 예측 시장 분석입니다. 베이스 체인 엔드포인트와 동일한 기능을 제공합니다.

#### 요청

**헤더:**

* `x-payment-response` (필수) - x402 프로토콜의 결제 증명 토큰
* `Content-Type: application/json`

**본문 매개변수:**

위의 베이스 체인 엔드포인트와 동일합니다.

#### 예시 요청

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

베이스 체인 엔드포인트와 동일한 응답 형식.

***

## 오류 응답

### 402 Payment Required

결제 자격 증명 없이 초기 요청을 보내면 다음이 반환됩니다:

```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 엔드포인트는 지갑 주소별로 요금이 제한됩니다:

* **AI 엔드포인트:** 분당 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/ko/trade/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.
