n2plug.com valid
NH투자증권 Open API 가이드
외부 LLM·AI coding agent 가 직접 읽는 안내 파일. 정본: https://www.n2plug.com/llms.txt
Their llms.txt
The beginning of the file, from our validated copy saved 2026-10-26T00:39:18.216Z. Cached copy · Source on n2plug.com
# NH투자증권 Open API 가이드
> 외부 LLM·AI coding agent 가 직접 읽는 안내 파일. 정본: https://www.n2plug.com/llms.txt
>
> 기준: API명세서 261015 / N2 환경 · 문서 개정 2026-10-15
국내·해외 주식, 국내·해외 파생, 국내 채권, 국내 금현물의 **주문·계좌조회·시세·실시간 스트리밍**을 REST + WebSocket 으로 제공합니다.
- **REST**: `POST` + JSON. 요청 `Input_0` / 응답 `Output_0`(+`Output_1`·`Output_2` …) + `message`.
- **인증(REST)**: `Authorization: Bearer {access_token}` **하나만** 필요. `x-client-id`·`x-client-secret` 는 **불필요**.
- **인증(WebSocket)**: 구독 메시지 `header.token` 에 토큰 전달. HTTP 헤더는 사용하지 않음.
## 환경
> ⚠️ **기본은 운영(Live). 주문이 실제로 체결됩니다.** 테스트는 모의투자(`moapi.n2plug.com`)를 쓰세요.
**N2** 환경 기준. **포털**: `https://www.n2plug.com`
| 용도 | REST | WebSocket |
|---|---|---|
| 🔴 운영 (기본) | `https://api.n2plug.com:8443` | `wss://api.n2plug.com:7070/websocket` (국내 시세·통보) · `:7080/websocket` (해외 시세) |
| 🟢 모의투자 | `https://moapi.n2plug.com:8443` | `wss://moapi.n2plug.com:17070/websocket` |
- ⚠️ **WebSocket 경로 `/websocket` 필수.** 호스트:포트만으로는 연결되지 않습니다.
- ⚠️ **포트는 국내/해외가 아니라 시세/통보로 갈립니다.** `7070`=국내 시세 + **통보 전부(국내·해외)** · `7080`=**해외 시세 전용** · `17070`=모의투자. 통보를 `7080` 으로 보내면 `WSS10006`(허용되지 않는 tr_cd).
- **접근토큰발급은 운영 전용**(모의투자 미제공). 발급 토큰은 양쪽에서 사용 가능.
- 계좌는 환경별로 다릅니다 — `acct_type` `01`·`02`=운영 / `03`=모의투자.
## 수수료
국내주식 **20bp(0.20%)** · 해외주식 **25bp(0.25%)**.
> 기본 수수료이며 **마케팅 이벤트·협의(별도 약정) 시 위 요율과 다릅니다.** 최신 값은 포털 확인. (1bp=0.01%, 100bp=1%)
## 공통 API (인증·계좌·조회)
자산군 `openapi.json` 에 없는 플랫폼 공통 API. 모든 자산군 호출 전에 사용합니다.
**1. 토큰 발급** — `POST /oauth2/token` (운영 전용)
- Content-Type `application/x-www-form-urlencoded`, 쿼리 파라미터 `appkey`·`appsecretkey`·`grant_type=client_credentials`·`scope=oob`
- 응답: `{ "access_token": "...", "token_type": "Bearer", "expires_in": 86400 }`
> 🔑 **토큰은 24시간 유효. 캐시해서 재사용하세요.**
> 매 호출 재발급 금지 — **재발급은 보안 알림을 유발**합니다. 프로세스 메모리 캐시는 스크립트 재실행 때 사라지니 **파일 등 공유 캐시**에 `expires_in` 기준 만료시각과 함께 저장하세요.
> **재발급은 `401`(토큰 무효)일 때만.** `429`(유량 초과) 재시도에는 기존 토큰을 그대로 씁니다.
**2. 계좌 목록** — `POST /n2/acctinfo`
- 헤더 `Authorization: Bearer {access_token}` · 요청 `{ "Input_0": {} }`
- 응답: `rsp_cd`·`rsp_msg`·`cust_no` + `Output_0[]` = `{ acct_no, acct_type }`
- `acct_no` 를 이후 API 의 **`act_no`** 입력으로 사용합니다(이름만 다르고 값은 동일).
| `acct_type` | 용도 | 사용 도메인 |
|---|---|---|
| `01` | 🔴 운영 (일반) | `https://api.n2plug.com:8443` |
| `02` | 🔴 운영 (주문대리인) | `https://api.n2plug.com:8443` |
| `03` | 🟢 모의투자 | `https://moapi.n2plug.com:8443` |
> 목록에 여러 구분이 섞여 옵니다. **호출 환경과 같은 구분의 계좌를 고르세요.** 첫 계좌를 그대로 쓰지 마세요.
…
Machine-readable: GET /v1/resolve?q=n2plug.com · GET /v1/domain/n2plug.com · this page as Accept: application/json or text/markdown · MCP lookup_domain
Automatically discovered from public files. Inclusion does not imply endorsement or publisher participation.
Own or manage this website?
If you own or manage n2plug.com, you can update its listing and review file health, discovery activity and score history.
Manage this listing — optional
What verification unlocks
See how your site is discovered—and control what agents see.
- See your website in the map
Review your indexed topics, nearby publishers sharing headings, measured listing exposure and map snapshots in a private report for your website.
- Control what agents see
Edit your listing description, tags, public contact details and additional llms.txt paths. Publish your terms for automated access, attribution and pricing.
- Make your profile eligible for search
A valid, listed, unblocked, verified profile can appear in our publisher sitemap and become eligible for search-engine visibility. Search engines decide what to index and rank.
- Appear in our llms-full.txt
Eligible verified publishers are listed by name, with their file links and summaries, in the service overview agents can read.
Free. No account registration, backlink or payment required. Public discovery remains available without verification.
Let your coding agent verify it
If your coding agent is authorized to manage this website, paste these instructions into it.
Claim my listing on Agent Web Map for n2plug.com:
1. POST https://agentwebmap.com/v1/sites/n2plug.com/claims and keep claim_id and claim_secret private.
2. Publish the verification line "AgentWebMap verification: <token>" (token from step 1) in https://n2plug.com/llms.txt, or use the DNS, meta-tag or well-known method the response describes. This only verifies the listing; your website and domain remain yours.
3. POST https://agentwebmap.com/v1/sites/n2plug.com/verify with {"claim_id": "...", "claim_secret": "..."}.
4. Save the api_key from the answer; it manages the listing (PATCH https://agentwebmap.com/v1/sites/n2plug.com).
MCP equivalent: tools begin_ownership_claim, then verify_domain, at https://agentwebmap.com/mcp. Docs: https://agentwebmap.com/docs#verifyCorrections or removal requests: contact the directory.