{
  "openapi": "3.1.0",
  "info": {
    "title": "DartLab public read API",
    "version": "1.0.0",
    "description": "한국 DART와 미국 EDGAR 공시를 회사별로 정리한 읽기 전용 API. 재무제표 열은 분기 단독 값이고 금액 단위는 한국 원, 미국 달러다. 값이 null 이면 그 기간 공시에 없는 항목이다. panel 은 반드시 section 과 periods 를 함께 준다."
  },
  "servers": [
    {
      "url": "https://eddmpython-dartlab.hf.space"
    }
  ],
  "paths": {
    "/api/search": {
      "get": {
        "operationId": "searchCompany",
        "summary": "회사 이름이나 종목코드로 회사를 찾는다",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "회사 이름(삼성전자, Apple) 또는 종목코드",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "results[].stockCode 를 다음 호출의 code 로 쓴다",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    },
    "/api/company/{code}/show/{topic}": {
      "get": {
        "operationId": "getFinancialTable",
        "summary": "재무제표나 재무비율 표를 받는다",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "description": "한국 6자리 종목코드(005930) 또는 미국 티커(AAPL)",
            "schema": { "type": "string" }
          },
          {
            "name": "topic",
            "in": "path",
            "required": true,
            "description": "IS 손익계산서, BS 재무상태표, CF 현금흐름표, ratios 재무비율",
            "schema": { "type": "string", "enum": ["IS", "BS", "CF", "ratios"] }
          }
        ],
        "responses": {
          "200": {
            "description": "payload.columns 와 payload.rows. 열은 snakeId, 항목, 그리고 최신 분기부터 2026Q3 같은 분기 단독 값. 연간 손익은 같은 해 Q1~Q4 를 더한다",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    },
    "/api/company/{code}/panel/toc": {
      "get": {
        "operationId": "getReportToc",
        "summary": "사업보고서 목차와 기간 목록을 받는다",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "chapters[].sections[].sectionKey 를 getReportSection 의 section 으로 쓴다",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    },
    "/api/company/{code}/panel": {
      "get": {
        "operationId": "getReportSection",
        "summary": "사업보고서 본문 한 절을 받는다",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "section",
            "in": "query",
            "required": true,
            "description": "목차의 sectionKey 그대로(예: II. 사업의 내용␟1. 사업의 개요)",
            "schema": { "type": "string" }
          },
          {
            "name": "periods",
            "in": "query",
            "required": true,
            "description": "목차 periods 가운데 하나 이상(예: 2025Q4). 여러 개는 쉼표로 잇는다",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "rows[].cells[기간] 이 사업보고서 XML 글이다. dartUrlByPeriod 는 DART 원문 링크",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    },
    "/api/company/{code}/insights": {
      "get": {
        "operationId": "getInsights",
        "summary": "공시 숫자로 계산한 영역별 등급과 이상 신호를 받는다",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "grades, areas, anomalies, summary. 참고 값이며 매수나 매도 권유가 아니다",
            "content": { "application/json": { "schema": { "type": "object" } } }
          }
        }
      }
    }
  }
}
