SuperAPI AI Directory

opendart-api

Data & analytics

View repository

Updated 10-15 20:31

About this skill

OpenDART API

Retrieving corporate disclosures and financial data using the OpenDART (Financial Supervisory Service Electronic Disclosure System) REST API.

Overview

OpenDART API enables retrieval of:

  • Corporate disclosures (earnings, dividends, capital changes)
  • Financial statements (quarterly, annual)
  • Major shareholder reports (5%+ ownership)
  • Executive stock transactions

Installation

npx dlabs install trading-tools

Environment Setup

Configuring the .env file

In the project root, .env if the file does not exist, copy this skill's .env.exampleto create it:

# 프로젝트 루트로 이동
cd /path/to/your-project

# .env 파일이 없으면 스킬의 .env.example 복사
if [ ! -f .env ]; then
    cp .claude/skills/opendart-api/.env.example .env
    echo "✅ .env 파일 생성됨. DART_API_KEY를 입력하세요."
fi

# .env 파일 편집
nano .env  # 또는 vim, code 등

Required environment variables:

# OpenDART API 키 (https://opendart.fss.or.kr/ 에서 발급)
DART_API_KEY=your_dart_api_key_here

Loading in Python

import os
from dotenv import load_dotenv

# 프로젝트 루트의 .env 로드
load_dotenv()

dart_api_key = os.getenv("DART_API_KEY")

Quick Start

corp_code vs stock_code

OpenDART uses corp_code (DART unique ID), not stock_code (exchange ticker).

Type Description Example
stock_code Exchange ticker 035420
corp_code DART unique ID 00266961

To convert stock_code to corp_code, use scripts/get_corp_code.py:

python3 scripts/get_corp_code.py 035420
# Output: 00266961

Common corp_codes

Frequently used mappings (see references/corp_codes.md for full list):

Stock Name corp_code
005930 Samsung Electronics 00126380
035420 NAVER 00266961
000660 SK Hynix 00164779
035720 Kakao 00401731

Disclosure Search

Retrieve recent disclosures for a company.

# .env 로드 후 사용
source .env

curl -s "https://opendart.fss.or.kr/api/list.json?\
crtfc_key=$DART_API_KEY&\
corp_code=00266961&\
page_count=10"

Parameters:

  • corp_code: DART unique ID
  • bgn_de: Start date (YYYYMMDD)
  • end_de: End date (YYYYMMDD)
  • pblntf_ty: Disclosure type (A=정기, B=주요사항, K=수시공시)
  • page_count: Results per page (max 100)

Important disclosure types to filter:

Disclosure Importance Description
Earnings (Preliminary) Results ⭐⭐⭐ Earnings report
Decision on Cash and In-kind Dividends ⭐⭐⭐ Dividend decision
Decision on Paid-in Capital Increase ⭐⭐⭐ Capital increase
Decision on Acquisition of Treasury Shares ⭐⭐ Stock buyback

Financial Statements

Retrieve quarterly or annual financial data.

source .env

curl -s "https://opendart.fss.or.kr/api/fnlttSinglAcntAll.json?\
crtfc_key=$DART_API_KEY&\
corp_code=00266961&\
bsns_year=2025&\
reprt_code=11014&\
fs_div=CFS"

Parameters:

  • bsns_year: Fiscal year (YYYY)
  • reprt_code: Report type
    • 11011: Q1
    • 11012: Half-year
    • 11013: Q3
    • 11014: Annual
  • fs_div: Statement type (OFS=Individual, CFS=Consolidated)

Dividend Information

source .env

curl -s "https://opendart.fss.or.kr/api/alotMatter.json?\
crtfc_key=$DART_API_KEY&\
corp_code=00266961&\
bsns_year=2025&\
reprt_code=11014"

Major Shareholders

5%+ ownership reports:

source .env

curl -s "https://opendart.fss.or.kr/api/majorstock.json?\
crtfc_key=$DART_API_KEY&\
corp_code=00266961"

Error Handling

Code Message Cause
000 Normal Success
010 Unregistered authentication key Invalid API key
013 No data found No results
020 Request limit exceeded Daily limit exceeded (10,000/day)

Resources

scripts/

  • get_corp_code.py - Convert stock_code to corp_code
  • get_disclosures.py - Fetch recent disclosures for a company

references/

  • api_reference.md - Complete API endpoint documentation
  • corp_codes.md - Stock code to corp_code mapping table