# 다운로드

머신 리더블 스펙 + Postman 컬렉션. 직접 SDK를 코드 생성하거나, 어떤 HTTP 도구에도 가져올 수 있습니다.

## OpenAPI 3.1 (REST)

공개 REST 사양 — **21개 태그 그룹에 걸쳐 209개 경로 / 240개 운영**: Discovery, Builders, Apps, Attribution, Revenue, Orders, Auth, Subaccounts, Competitions, Composer, Weather, Liquidity, Data, Webhooks, Marketplace, Oracle, Sandbox, Audit, Portfolio, Copy trading, Provider Keys. 감사 체인(`/v1/audit/head`, `/root`, `/batches`, `/health`, `/anchor`)은 공개되며 인증이 필요하지 않습니다. 관리자/팀/정산 엔드포인트는 런타임에 존재하지만 공개 사양에서 의도적으로 제외되었습니다. [openapi-generator](https://openapi-generator.tech)(50개 이상의 대상 언어)로 코드 생성이 가능합니다.

| 형식 | 파일 | 크기 | 사용 |
|---|---|---|---|
| YAML | [openapi.yaml](https://docs.predictasiax.com/downloads/openapi.yaml) | 273 KB | 사람이 읽기 쉽고, diff가 용이 |
| JSON | [openapi.json](https://docs.predictasiax.com/downloads/openapi.json) | 388 KB | Redoc / Swagger UI / 코드 생성 도구 |

```
# Codegen Python client
openapi-generator generate -i https://docs.predictasiax.com/downloads/openapi.json -g python -o pax-python-client

# Codegen TypeScript axios client
openapi-generator generate -i https://docs.predictasiax.com/downloads/openapi.json -g typescript-axios -o pax-ts-client

# Codegen Go client
openapi-generator generate -i https://docs.predictasiax.com/downloads/openapi.json -g go -o pax-go-client
```

## AsyncAPI 2.6 (WebSocket)

WebSocket 사양 — **서버 메시지 78개(Ev*) + 클라이언트 메시지 7개(Cmd*: 6개 명령어 및 ping keepalive)**, `components.messages`에 총 85개. 각 메시지는 `x-access`를 포함합니다: 39개 `public` 채널, 16개 `account` 채널(AUTH 후 SUBSCRIBE), 12개 `push` 이벤트(인증된 소켓으로 전송) 및 11개 `control` 응답. 클라이언트 명령어: `AUTH` / `SUBSCRIBE` / `UNSUBSCRIBE` / `LOCALE` / `RFQ_SUBSCRIBE` / `RFQ_UNSUBSCRIBE`(두 RFQ 동사는 request-for-quote 업데이트를 위해 소켓을 등록합니다). public 및 account 채널 목록은 라이브 게이트웨이 ACL과 일치합니다.

| 형식 | 파일 | 크기 | 사용 |
|---|---|---|---|
| YAML | [asyncapi.yaml](https://docs.predictasiax.com/downloads/asyncapi.yaml) | 50 KB | 사람이 읽기 쉽고, diff가 용이 |
| JSON | [asyncapi.json](https://docs.predictasiax.com/downloads/asyncapi.json) | 73 KB | AsyncAPI Studio, 코드 생성 도구 |

```
# Codegen Node.js WebSocket client from AsyncAPI
npm i -g @asyncapi/generator
ag https://docs.predictasiax.com/downloads/asyncapi.json @asyncapi/nodejs-ws-template -o pax-ws-client
```

## Postman Collection

PredictAsiaX는 [Postman의 Public Workspace로 게시되어 있습니다](https://www.postman.com/predictasiax-2938441/predictasiax-api). 이를 본인의 Postman 워크스페이스로 포크하면 스펙이 업데이트될 때마다 자동으로 동기화됩니다:

- **워크스페이스**: `PredictAsiaX API` · 1개 컬렉션 + 2개 환경(production + sandbox).
- **Fork**: Postman에 로그인 → 워크스페이스 열기 → *Fork Collection* 클릭.
- **환경 설정**: 포크 후, `PAX Sandbox` 환경을 편집하고 `apiKey`를 `sk_live_*`로 설정하십시오 (`POST /v1/sandbox-keys`에서 가져온 값).

직접 다운로드(에어갭/감사 검토용 미러):

| 파일 | 목적 | 크기 |
|---|---|---|
| [postman.json](https://docs.predictasiax.com/downloads/postman.json) | 컬렉션 — openapi.json에서 생성된 예제 바디가 포함된 모든 239개 공개 REST 연산; 환경에서 `apiKey`를 설정하세요 | 486 KB |
| [pax-sandbox.postman_environment.json](https://docs.predictasiax.com/downloads/pax-sandbox.postman_environment.json) | 샌드박스 환경 — `baseUrl`, `apiKey`, HMAC 시크릿 | <1 KB |
| [pax-production.postman_environment.json](https://docs.predictasiax.com/downloads/pax-production.postman_environment.json) | 프로덕션 환경 — 동일한 구조, 프로덕션 URL | <1 KB |

### Postman에 가져오기

1. Postman을 열고 **Import**(좌측 상단)를 클릭합니다.
2. 모든 3개 파일(컬렉션 + 2개 환경)을 드래그하거나, URL을 붙여넣으세요:
  ```
  https://docs.predictasiax.com/downloads/postman.json
  https://docs.predictasiax.com/downloads/pax-sandbox.postman_environment.json
  https://docs.predictasiax.com/downloads/pax-production.postman_environment.json
  ```
3. 오른쪽 상단 환경 선택기 → **PAX Sandbox** 선택.
4. Environment 탭 → `apiKey` = `sk_live_*` 샌드박스 키 입력 (`POST /v1/sandbox-keys`, tier=sandbox). 저장.
5. 요청을 열고 **Send**를 누르세요. 완료.

**Postman → cURL:** Postman에서 요청을 구성한 후, 요청 패널 오른쪽 상단의 **Code** 버튼을 클릭하여 해당 cURL, Python, Node 또는 Go 스니펫을 복사합니다.

## MCP 서버

PredictAsiaX는 [공식 MCP Registry에](https://registry.modelcontextprotocol.io/v0/servers?search=predictasiax) `com.predictasiax/mcp`로 게시되어 있습니다. AI 에이전트 앱(Claude Desktop, Cursor, Windsurf, 커스텀 에이전트)은 MCP 클라이언트 레지스트리 검색을 통해 서버를 발견하고 직접 연결할 수 있습니다:

| 필드 | 값 |
|---|---|
| 레지스트리 이름 | `com.predictasiax/mcp` |
| 서버 URL | `https://mcp.predictasiax.com` |
| 전송 | SSE + 스트리밍 가능한 HTTP |
| 인증 | Bearer `sk_live_*` (`POST /v1/sandbox-keys`에서 셀프 서브로 발급); 공개 데이터(마켓, 호가창, 수수료, 문서)를 읽는 19개 도구는 자격 증명 없이 사용 가능합니다 |
| 도구 (46개) | `market_search`, `market_get`, `market_orderbook`, `market_price_history`, `probability_movers`, `markets_top_volume`, `category_list`, `portfolio_read`, `portfolio_history`, `balance_get`, `positions_list`, `subaccount_list`, `place_order`, `cancel_order`, `cancel_all_orders`, `orders_open`, `orders_history`, `fee_estimate`, `mm_stipend_estimate`, `mm_stipend_history`, `liquidity_leaderboard`, `subaccount_create`, `subaccount_transfer`, `subaccount_close`, `composer_templates_list`, `composer_template_get`, `composer_proposal_submit`, `resolution_evidence`, `mm_quote_post`, `mm_quotes_list`, `rfq_create`, `rfq_accept`, `builder_me`, `builder_apps_list`, `builder_apikeys_list`, `tier_status`, `fee_ledger_read`, `webhook_endpoints_list`, `webhook_create`, `webhook_deliveries`, `access_request_create`, `access_request_status`, `docs_search`, `docs_read`, `sandbox_agent_examples`, `health` — `tools/list`를 통해 네임스페이스 `pax.*`로 제공 |

## SDKs

네이티브 SDK가 제공됩니다. 둘 다 `https://api.predictasiax.com` 게이트웨이를 대상으로 하며(메서드는 `/v1/…` 경로를 추가), Bearer 또는 HMAC(`PAX-*` 헤더) 인증, 오프라인 감사 검증기, 쓰기 시 자동 `Idempotency-Key` 생성, 그리고 안전한 기본값(HTTPS 전용, 스트림 응답 상한, CRLF 헤더 가드, 응답 본문 크기 상한 10 MB)을 지원합니다.

| 언어 | 패키지 | 버전 | 설치 |
|---|---|---|---|
| Python | `pax-api` | 3.3.2 LIVE | `pip install "pax-api>=3"` |
| 타입스크립트 / 자바스크립트 | `@predictasiax/api` | 3.4.1 LIVE | `npm i @predictasiax/api@3` |
| Go | OpenAPI 코드 생성을 통해 | — | `oapi-codegen -package pax https://docs.predictasiax.com/downloads/openapi.yaml` |
| Rust | OpenAPI 코드 생성을 통해 | — | `openapi-generator generate -g rust -i https://docs.predictasiax.com/downloads/openapi.json` |
| 기타 50개 이상의 언어 | OpenAPI 코드 생성을 통해 | — | `openapi-generator generate -g <lang> -i https://docs.predictasiax.com/downloads/openapi.json` |

### TypeScript 빠른 시작

```
# npm i @predictasiax/api@3    (2.x cannot authenticate against the current gateway)
import { PaxClient } from '@predictasiax/api';

// 1. Public endpoints need no key; mint a sandbox key (api_key is shown once)
const pub = new PaxClient();
const minted = await pub.sandboxKeys.mint({ orgName: 'my-app' });

// 2. Use the key: Authorization: Bearer sk_live_...
//    (or { apiKey, keyId: 'api_...' } to HMAC-sign with PAX-* headers instead)
const pax = new PaxClient({ apiKey: minted.api_key });

for await (const market of pax.markets.list({ category: 'crypto' })) {
  console.log(market.id, market.title);
}

// Limit BUY of one outcome. Idempotency-Key and client_order_id are generated
// once per call and reused across retries.
const { data, requestId } = await pax.orders.place({
  marketId: 'hadjar-f1-2026', side: 'yes', price: '0.05', size: '20',
}).withResponse();
console.log('Order:', data, 'Request:', requestId);

// Price an order first (public, nothing placed), then wait for the fill and the settlement.
// Both waits read the result over REST and ride out 429, 5xx and network errors.
const q = await pub.markets.quote('hadjar-f1-2026', { side: 'yes', amount: 25 });
console.log(q.fill?.avg_price, q.fill?.fee_usdt, q.fill?.filled_all);
const { status, filledSize } = await pax.orders.waitForFill(data, { marketId: 'hadjar-f1-2026', timeoutMs: 30_000 });
const res = await pub.markets.waitForSettlement('hadjar-f1-2026');   // until status "settled"

// Offline audit verification
console.log((await pub.audit.verify(110841)).ok);

// WebSocket streaming
import { PaxWSClient } from '@predictasiax/api';
const ws = new PaxWSClient({ apiKey: minted.api_key, subscribeOnConnect: ['fast_tick', 'account'] });
ws.on('fast_tick', (e) => console.log(e));
await ws.connect();
```

### Python 빠른 시작

```
# pip install "pax-api>=3"    (2.x cannot authenticate against the current gateway)
from pax_api import PaxClient

# 1. Public endpoints need no key; mint a sandbox key (api_key is shown once)
key = PaxClient().mint_sandbox_key(org_name="my-app")["data"]["api_key"]

# 2. Use the key: Authorization: Bearer sk_live_...
#    (or PaxClient(api_key=key, key_id="api_...") to HMAC-sign instead)
pax = PaxClient(api_key=key)
print(pax.get_balance())

# 3. Limit BUY of one outcome; client_order_id + Idempotency-Key fixed across retries
order = pax.place_order(market_id="hadjar-f1-2026", side="yes", price="0.05", size="20")

# Price an order first (public, nothing placed), then wait for the fill and the settlement.
# Both waits read the result over REST and ride out 429, 5xx and connection errors.
q = PaxClient().quote("hadjar-f1-2026", side="yes", amount=25)["data"]
print(q["fill"])
r = pax.wait_for_fill(order, market_id="hadjar-f1-2026", timeout=30)   # r["status"], r["filled_size"]
res = PaxClient().wait_for_settlement("hadjar-f1-2026")                 # until status "settled"

# Offline audit verification
print(PaxClient().verify_audit_event(110841)["ok"])

# WebSocket streaming (multiplexed subscriptions, sequence# gap detection)
from pax_api import PaxWSClient
ws = PaxWSClient(api_key=key)
ws.on("fast_tick", lambda evt: print("tick:", evt))
ws.subscribe(["fast_tick", "orderbook", "account"])
ws.run_forever()
```

직접 다운로드 (에어갭/감사 검토용 미러; PyPI와 동일한 파일): [pax_api-3.3.2-py3-none-any.whl](https://docs.predictasiax.com/downloads/sdk/python/pax_api-3.3.2-py3-none-any.whl) (SHA-256 `6be3f9ad00533b540728239b7ec133dcbfe8d118b3f3269b027765b659077bc3`) · [pax_api-3.3.2.tar.gz](https://docs.predictasiax.com/downloads/sdk/python/pax_api-3.3.2.tar.gz) (SHA-256 `c4ef72a0dbbe155f9a0c7ffd458211bb5de7198d5952b88a5bfe219fe3437c3a`).

## 모의 서버 (Prism)

오프라인 개발을 위해 OpenAPI 사양에 대해 로컬 목 서버를 실행하세요:

```
npm i -g @stoplight/prism-cli
prism mock https://docs.predictasiax.com/downloads/openapi.json
# → mock server on http://localhost:4010
```

Prism은 OpenAPI 예시에 따라 가짜 응답을 생성합니다 — 샌드박스 접근이 프로비저닝되기 전 CI 또는 클라이언트 개발에 적합합니다.

Source: https://docs.predictasiax.com/ko/downloads
