> 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-key.md).

# API 키

API 키 방식은 **Pro** 및 **파트너** 요금제 사용자에게 제공됩니다. Minara 프로필에서 키를 생성하고 다음에 포함하세요. `Authorization` 모든 요청의 헤더입니다.

***

## 요구 사항

Minara Agent API는 Pro 및 Partner 요금제 구독자에게만 제공됩니다. 무료 요금제를 사용 중이라면 **API** 탭으로 이동하여 업그레이드 안내를 확인하세요.

구독을 다운그레이드하면 활성 API 키는 모두 자동으로 일시 중지되며, 갱신하면 다시 사용됩니다.

***

## API 키 생성하기

1. 다음으로 이동하세요. **계정 프로필** 에서 [minara.ai](https://minara.ai).
2. 다음을 선택하세요. **API 키** 왼쪽 메뉴에서 탭을 클릭하고 **생성**.

<figure><img src="/files/1afd373ce02a93c8799d249c002756a9cf470da7" alt="API Key tab in Minara account profile showing Create button"><figcaption></figcaption></figure>

3. 키의 용도를 식별할 수 있도록 이름과 설명을 입력하세요.

<figure><img src="/files/7af713c1000b9eff04c84f83d98d7edd45bc3aa4" alt="Create API key dialog with name and description fields"><figcaption></figcaption></figure>

4. 생성되면 API 키가 표시됩니다. 복사해서 안전하게 보관하세요. 다시는 표시되지 않습니다.

<figure><img src="/files/bd16239f36c7c5c744c8866e1818f3ab6e770f04" alt="Newly created API key displayed for copying"><figcaption></figcaption></figure>

***

## API 키 관리

| 작업       | 세부 정보                                       |
| -------- | ------------------------------------------- |
| **키 보기** | 키는 마지막 4자만 보이도록 표시됩니다. 클릭하면 전체 키를 볼 수 있습니다. |
| **키 제한** | Pro/Partner 계정당 최대 5개의 API 키.               |
| **키 삭제** | 2FA 확인이 필요합니다. 삭제는 영구적입니다.                  |

***

## 인증

API 키를 다음에 포함하세요. `Authorization` 모든 요청의 헤더에:

```
Authorization: Bearer <YOUR_API_KEY>
```

**예시:**

```bash
curl -H "Authorization: Bearer sk-minara-xxxxxxxx" \
  https://api.minara.ai/v1/developer/chat
```

{% hint style="warning" %}
API 키를 비밀번호처럼 취급하세요. 클라이언트 측 코드나 공개 저장소에 절대 노출하지 마세요.
{% endhint %}

***

## 결제

모든 API 호출은 **크레딧을 소모합니다** Minara 계정에서 차감됩니다. 크레딧이 소진되면 충전될 때까지 API 요청이 중지됩니다.

***

## API 참조

기본 URL: `https://api.minara.ai`

### 채팅

**`POST /v1/developer/chat`**

## Developer Chat

> Developer chat endpoint supporting both streaming and non-streaming response modes.

```json
{"openapi":"3.0.0","info":{"title":"Minara Agent API","version":"1.0"},"servers":[{"url":"https://api-developer.minara.ai"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API-KEY","description":"Format: Authorization: Bearer <YOUR_API_KEY>"}},"schemas":{"ChatRequest":{"type":"object","required":["mode","stream","message"],"properties":{"mode":{"type":"string","enum":["fast","expert"],"description":"Required. Model mode: 'fast' for quick responses, 'expert' for in-depth analysis."},"stream":{"type":"boolean","description":"Required. Set to true for streaming (SSE), false for standard JSON response."},"message":{"$ref":"#/components/schemas/Message"}}},"Message":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user"],"description":"Required. Message sender role, must be 'user'."},"content":{"type":"string","description":"Required. The user's query content."}}},"ChatResponse":{"type":"object","properties":{"chatId":{"type":"string","description":"Unique conversation ID."},"messageId":{"type":"string","description":"Unique message ID for this response."},"content":{"type":"string","description":"The AI-generated response content."},"usage":{"type":"object","description":"Usage statistics for the request."}}}}},"paths":{"/v1/developer/chat":{"post":{"summary":"Developer Chat","description":"Developer chat endpoint supporting both streaming and non-streaming response modes.","operationId":"developerChat","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}},"text/event-stream":{"schema":{"type":"string","description":"Server-Sent Events (SSE) stream. Each event line starts with `data:`.\nThe final message is formed by concatenating chunk/delta content in order.\n"}}}},"401":{"description":"Unauthorized - Invalid or missing API key"}}}}}}
```

| 매개변수              | 유형      | 필수 | 설명                                 |
| ----------------- | ------- | -- | ---------------------------------- |
| `mode`            | string  | 예  | `빠른` 빠른 응답용, `expert` 심층 분석용       |
| `stream`          | boolean | 예  | `true` SSE 스트리밍용, `false` 표준 JSON용 |
| `message.role`    | string  | 예  | 다음이어야 함 `user`                     |
| `message.content` | string  | 예  | 질의 내용                              |

**예시:**

```bash
curl -X POST https://api.minara.ai/v1/developer/chat \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "fast",
    "stream": false,
    "message": { "role": "user", "content": "SOL의 최근 가격 움직임을 분석해 주세요." }
  }'
```

***

### 스왑 거래 의도

**`POST /v1/developer/intent-to-swap-tx`**

## 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 Agent API","version":"1.0"},"servers":[{"url":"https://api-developer.minara.ai"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API-KEY","description":"Format: Authorization: Bearer <YOUR_API_KEY>"}},"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":{"intent":{"type":"object","description":"Parsed user intent","properties":{"chain":{"type":"string","description":"Chain name (e.g., 'base')."},"inputTokenAddress":{"type":"string","nullable":true,"description":"Input token contract address (null for native token)."},"inputTokenSymbol":{"type":"string","description":"Input token symbol (e.g., 'ETH')."},"outputTokenAddress":{"type":"string","description":"Output token contract address."},"outputTokenSymbol":{"type":"string","description":"Output token symbol (e.g., 'USDC')."},"amount":{"type":"string","description":"Token amount in wei/smallest unit."},"userWalletAddress":{"type":"string","description":"User's wallet address."}}},"quote":{"type":"object","description":"Swap quote and pricing information","properties":{"fromTokenAmount":{"type":"string","description":"Input token amount in smallest unit."},"toTokenAmount":{"type":"string","description":"Expected output token amount in smallest unit."},"estimatedGas":{"type":"string","description":"Estimated gas cost for the transaction."},"priceImpact":{"type":"string","description":"Price impact percentage."},"tradeFee":{"type":"string","description":"Trading fee amount."}}},"inputToken":{"type":"object","description":"Input token details","properties":{"address":{"type":"string","description":"Token contract address."},"symbol":{"type":"string","description":"Token symbol."},"decimals":{"type":"string","description":"Token decimals."},"unitPrice":{"type":"string","description":"Token unit price in USD."}}},"outputToken":{"type":"object","description":"Output token details","properties":{"address":{"type":"string","description":"Token contract address."},"symbol":{"type":"string","description":"Token symbol."},"decimals":{"type":"string","description":"Token decimals."},"unitPrice":{"type":"string","description":"Token unit price in USD."}}},"unsignedTx":{"type":"object","description":"Unsigned transaction ready to be signed and broadcasted","properties":{"chainType":{"type":"string","description":"Chain type (e.g., 'evm')."},"from":{"type":"string","description":"Sender address."},"to":{"type":"string","description":"Contract address to call."},"data":{"type":"string","description":"Encoded transaction data."},"value":{"type":"string","description":"Native token value to send (in wei)."},"gas":{"type":"string","description":"Gas limit."},"gasPrice":{"type":"string","description":"Gas price (legacy)."},"maxPriorityFeePerGas":{"type":"string","description":"Max priority fee per gas (EIP-1559)."}}},"approval":{"type":"object","description":"Token approval information (required for ERC20 token swaps)","properties":{"isRequired":{"type":"boolean","description":"Whether token approval is required before swap."},"tokenAddress":{"type":"string","description":"Token contract address that needs approval."},"spenderAddress":{"type":"string","description":"Spender address (DEX router) that needs approval."},"requiredAmount":{"type":"string","description":"Minimum token amount that needs to be approved."},"approveAmount":{"type":"string","description":"Recommended approval amount."},"currentAllowance":{"type":"string","description":"Current approved allowance for the spender."},"message":{"type":"string","description":"Human-readable approval status message."}}}}}}},"paths":{"/v1/developer/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":"intentToSwap","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntentToSwapRequest"}}}},"responses":{"200":{"description":"Swap transaction generated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapTransactionResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing API key"}}}}}}
```

자연어 거래 의도를 실행 가능한 스왑 거래 페이로드로 변환하며, 기본적으로 OKX DEX와 호환됩니다.

| 매개변수            | 유형     | 필수  | 설명                                       |
| --------------- | ------ | --- | ---------------------------------------- |
| `intent`        | string | 예   | 자연어 스왑 의도(예: "0.1 ETH를 USDC로 스왑")        |
| `walletAddress` | string | 예   | 사용자 지갑 주소(0x...)                         |
| `chain`         | string | 아니요 | 체인 이름(예: "base", "ethereum", "arbitrum") |

**예시:**

```bash
curl -X POST https://api.minara.ai/v1/developer/intent-to-swap-tx \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "intent": "0.1 ETH를 USDC로 스왑",
    "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
    "chain": "base"
  }'
```

***

### 무기한 거래 제안

**`POST /v1/developer/perp-trading-suggestion`**

## Perpetual Trading Suggestion

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

```json
{"openapi":"3.0.0","info":{"title":"Minara Agent API","version":"1.0"},"servers":[{"url":"https://api-developer.minara.ai"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API-KEY","description":"Format: Authorization: Bearer <YOUR_API_KEY>"}},"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."}}}}},"paths":{"/v1/developer/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 based on comprehensive market analysis.","operationId":"perpTradingSuggestion","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PerpTradingRequest"}}}},"responses":{"200":{"description":"Perpetual trading suggestion","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PerpTradingResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing API key"}}}}}}
```

롱/숏 추천, 진입, 손절, 익절, 신뢰도 점수가 포함된 AI 기반 무기한 거래 제안을 받아보세요.

| 매개변수        | 유형     | 필수  | 설명                            |
| ----------- | ------ | --- | ----------------------------- |
| `symbol`    | string | 예   | 거래 심볼(예: "BTC", "ETH", "SOL") |
| `style`     | string | 아니요 | `스캘핑`, `데이 트레이딩`또는 `스윙 트레이딩`  |
| `marginUSD` | number | 아니요 | USD 기준 증거금                    |
| `leverage`  | number | 아니요 | 레버리지 배수(최대: 40)               |
| `strategy`  | string | 아니요 | 전략 유형                         |

**예시:**

```bash
curl -X POST https://api.minara.ai/v1/developer/perp-trading-suggestion \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "BTC",
    "style": "day-trading",
    "marginUSD": 1000,
    "leverage": 10
  }'
```

***

### 예측 시장 분석

**`POST /v1/developer/prediction-market-ask`**

## Prediction Market Analysis

> 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 Agent API","version":"1.0"},"servers":[{"url":"https://api-developer.minara.ai"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API-KEY","description":"Format: Authorization: Bearer <YOUR_API_KEY>"}},"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)."}}}}},"paths":{"/v1/developer/prediction-market-ask":{"post":{"summary":"Prediction Market Analysis","description":"AI-powered prediction market analysis. Analyze prediction market events and get probability estimates for each outcome with detailed reasoning.","operationId":"predictionMarketAsk","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionMarketRequest"}}}},"responses":{"200":{"description":"Prediction market analysis","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictionMarketResponse"}}}},"401":{"description":"Unauthorized - Invalid or missing API key"}}}}}}
```

예측 시장 결과에 대한 AI 기반 확률 추정.

| 매개변수           | 유형      | 필수  | 설명                           |
| -------------- | ------- | --- | ---------------------------- |
| `link`         | string  | 예   | 예측 시장 이벤트 URL(예: Polymarket) |
| `mode`         | string  | 예   | `빠른` 또는 `expert`             |
| `only_result`  | boolean | 아니요 | 추론 없이 확률만 반환                 |
| `customPrompt` | string  | 아니요 | 분석을 안내하는 사용자 지정 지침           |

**예시:**

```bash
curl -X POST https://api.minara.ai/v1/developer/prediction-market-ask \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "link": "https://polymarket.com/event/example",
    "mode": "fast"
  }'
```


---

# 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:

```
GET https://minara.ai/docs/minara-handbook/ko/trade/agent-api/api-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
