Use when integrating Toss Securities Open API for market data, holdings, order workflows, and approval-gated execution.
Resources
9Install
npx skillscat add kuil09/hermes-skill-tossinvest-openapi Install via the SkillsCat registry.
TossInvest OpenAPI Integration
Overview
This skill packages agent-agnostic Toss Securities Open API guidance for Hermes. The same operational rules also work for other AI agents and automation systems. It covers authentication, account header requirements, read-only data access, approval-gated order flows, rate limits, and operational pitfalls such as IP allowlisting.
When to use
Use this skill when working on any Toss Securities Open API task, including:
- Reading or summarizing Toss Open API docs
- Building auth/token helpers
- Fetching market data, stock info, exchange rates, or market calendars
- Querying accounts, holdings, commissions, buying power, or sellable quantity
- Creating, modifying, canceling, or reviewing orders
- Designing an investment agent that uses Toss account data or execution
Core rules
- Treat the canonical OpenAPI spec as the source of truth:
https://openapi.tossinvest.com/openapi-docs/latest/openapi.json
- Human-readable overview:
https://openapi.tossinvest.com/openapi-docs/overview.md
- Browser docs:
https://developers.tossinvest.com/docs
- Base API server:
https://openapi.tossinvest.com
- Use OAuth 2.0 Client Credentials Grant for every API flow.
- For account, asset, and order APIs, send both:
Authorization: Bearer {access_token}X-Tossinvest-Account: {accountSeq}
- For any account-specific trade execution workflow, preserve a human approval gate before live order placement unless the user explicitly changes that policy.
Workflow
Preferred local interface: tossinvest CLI
Recommended companion CLI commands:
tossinvest— raw/programmatic API wrappertossinvest-snapshot— holdings + buying power + FX snapshot helpertossinvest-order-approval— Korean approval-packet generator for proposed live orders
Use it as the default programmable interface before hand-writing curl unless a task specifically requires raw HTTP.
Safe starter commands:
tossinvest env-check
tossinvest doctor
tossinvest token
tossinvest accounts
tossinvest holdings
tossinvest market prices --symbols 005930,AAPL
tossinvest market stocks --symbols 005930,AAPL
tossinvest market exchange-rate --base-currency KRW --quote-currency USD
tossinvest order-info buying-power --currency KRW
tossinvest-snapshot
tossinvest-order-approval --symbol 005930 --side BUY --order-type LIMIT --quantity 1 --price 350000Order mutations are preview-only by default. The CLI only sends live create/modify/cancel requests when both flags are present:
tossinvest orders create ... --execute --confirm-live
tossinvest orders modify ... --execute --confirm-live
tossinvest orders cancel ... --execute --confirm-liveIt supports:
- token caching under
~/.cache/tossinvest-openapi/token.json - account auto-resolution when only one brokerage account exists
- reading credentials from environment variables or
~/.zshrc - raw endpoint access via
tossinvest raw ... - diagnostic checks via
tossinvest doctor - public-IP visibility so allowlist failures can be diagnosed quickly
1) Establish credentials and storage
Preferred env var names if you are wiring local scripts:
TOSSINVEST_API_KEYTOSSINVEST_SECRET_KEY
Map them to the API's required token request fields:
client_id = TOSSINVEST_API_KEYclient_secret = TOSSINVEST_SECRET_KEY
If the user asks to store credentials in shell config, remember that protected credential files may reject direct file-edit tools. If so, use a safe file-writing path that still verifies the final file content.
If you build local wrappers around this API, prefer environment-variable injection over hardcoded secrets. Shell-config fallbacks are a convenience for local development, not a requirement for portable automation.
2) Get an access token
Request:
curl -s -X POST 'https://openapi.tossinvest.com/oauth2/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=client_credentials' \
-d "client_id=$TOSSINVEST_API_KEY" \
-d "client_secret=$TOSSINVEST_SECRET_KEY"Response fields to expect:
access_tokentoken_type=Bearerexpires_in
3) Resolve accountSeq before account-scoped calls
Call:
curl -s 'https://openapi.tossinvest.com/api/v1/accounts' \
-H "Authorization: Bearer $ACCESS_TOKEN"Use accountSeq from the response as the value for X-Tossinvest-Account.
4) Separate public-data vs account-scoped APIs
Token only
- Market Data
- Stock Info
- Market Info
Token + X-Tossinvest-Account
- Account
- Asset
- Order
- Order History
- Order Info
5) Be precise about order models
Quantity-based orders
Supports KR and US flows.
Fields commonly used:
clientOrderId(idempotency key)symbolside=BUYorSELLorderType=LIMITorMARKETtimeInForce= commonlyDAYorCLSquantitypricefor limit ordersconfirmHighValueOrderwhen required
Amount-based orders
Only for US market buy flows and MARKET orders.
Common fields:
clientOrderIdsymbolsideorderType=MARKETorderAmountconfirmHighValueOrder
6) Respect rate limits
Use the response headers to throttle dynamically:
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-ResetRetry-Afteron 429
Important documented limits include:
AUTH: 5 TPSACCOUNT: 1 TPSASSET: 5 TPSSTOCK: 5 TPSMARKET_INFO: 3 TPSMARKET_DATA: 10 TPSMARKET_DATA_CHART: 5 TPSORDER: 6 TPS, but 09:00~09:10 KST is 3 TPSORDER_HISTORY: 5 TPSORDER_INFO: 6 TPS, but 09:00~09:10 KST is 3 TPS
Apply backoff and jitter on 429.
6.5) Diagnose allowlist and network-access issues early
When auth fails, do not stop at "403". Inspect the error body and surface the operational next step.
Important case:
403 access_deniedwitherror_description = IP address not allowed
In that case:
- Fetch and display the current public egress IP.
- Tell the user to whitelist that IP in Toss Securities WTS > Open API settings.
- Re-run a small diagnostic (
tossinvest doctoror equivalent token probe) after the allowlist change. - Warn that home-network public IPs are often dynamic, so allowlist breakage can recur later even after a successful setup.
For recurring automated investment workflows, prefer a stable egress IP (fixed-IP line, VPS, or other fixed outbound address) over a consumer dynamic-IP path.
7) Handle errors by code, not only HTTP status
Common important codes:
invalid-tokenexpired-tokenaccount-header-requiredaccount-not-foundinsufficient-buying-powerorder-hours-closedrequest-in-progressalready-filledalready-canceledalready-processingrate-limit-exceeded
Preserve requestId for support/debugging.
Common Pitfalls
- Toss may reject valid credentials with
403 access_deniedandIP address not allowed. In that case, whitelist the current public IP in Toss Securities WTS > Open API settings before retrying. - Do not assume token-only access works for holdings or orders; account header is required.
- Do not assume order modification/cancel returns the original
orderId; the API can return a newly issued order identifier. - Do not assume amount-based orders work for KR stocks; the documented amount-based model is US MARKET only.
- Do not treat
status=OPEN|CLOSEDquery values as the same enum asorders[].status; the list filter is a grouped lifecycle label. - Do not hardcode rate limits without checking headers; the docs explicitly allow operational adjustments.
- If the browser docs say they are JS-rendered, switch to
llms.txt, overview markdown, or the canonical OpenAPI JSON instead of scraping rendered HTML.
Deliverables to prefer
For implementation tasks, prefer producing:
- a tiny token helper
- a verified account discovery call
- a holdings fetcher
- a market-data fetcher
- a dry-run or approval-gated order path
Verification Checklist
- Canonical OpenAPI spec consulted for any implementation change
- Credentials injected via environment variables, not committed files
-
X-Tossinvest-Accountpresent for account-scoped endpoints - Live order flows remain approval-gated unless explicitly changed
- Rate-limit and allowlist failure handling documented
References
references/tossinvest-openapi-summary.md— concise endpoint/auth/rate-limit notes captured from the official docs.references/local-cli-cookbook.md— local CLI usage examples, including snapshot and approval helper commands.