GraphQL(無料API)
GraphQL(無料API)
EDINET開示データの無料APIをGraphQLで取得する方法です。1リクエストで複数リソースをまとめて取得できます。スキーマとクエリ例を掲載しています。
- リクエスト形式:
POSTで{"query": "...", "variables": {...}}を送ります。GET /graphql?query=...も利用できます。 - フィールド名はRESTと同じcamelCaseです。
company(code:)のcodeは、RESTと同様にEDINETコード / 証券コードのどちらでも指定できます。- エラー(存在しない企業など)はGraphQL標準の
errors配列で返ります。extensions.codeにRESTと同じエラーコード(NOT_FOUNDなど)が入ります。エラーもHTTP 200で返ります(GraphQLの標準仕様)。
curl "https://api.yuhodb.com/v1/edinet/graphql" \
-H "Content-Type: application/json" \
-d '{"query": "{ company(code: \"7203\") { profile { companyName } metrics(metric: [\"revenue\"], from: 2024) { series { key annual { fiscalYear value } } } } }"}'type Query {
# 企業検索・一覧(GET /companies に対応)
companies(q: String, limit: Int = 50, offset: Int = 0): CompanySearchResult
# 企業単位のデータ(GET /companies/{code}/… に対応)
company(code: String!): Company
# 指標キー一覧(GET /metrics に対応)
metricKeys: [MetricKey]
# ランキング・分布(GET /metrics/{key}/… に対応)
ranking(metric: String!, year: Int!, limit: Int = 100, industry: String): Ranking
distribution(metric: String!, year: Int!): Distribution
}
type Company {
profile: Profile
metrics(metric: [String], from: Int, to: Int): CompanyMetrics
documents(type: [String], from: Int, to: Int): DocumentList
segments: Segments
}
type Profile {
edinetCode: String
securitiesCode: String
jcn: String # 法人番号
companyName: String
companyNameEn: String
industry: String
dataRange: [DataRange] # 書類種別ごとの収録範囲
}
type DataRange {
docTypeCode: String
typeName: String
documentCount: Int
minFiscalYear: Int
maxFiscalYear: Int
}
type CompanyMetrics {
availableKeys: [String] # この企業で利用できる指標キー
series: [MetricSeries]
}
type MetricSeries {
key: String # 指標キー(revenue など)
annual: [MetricPoint] # 年度昇順
}
type MetricPoint {
fiscalYear: Int
value: Float # 開示なし・確定不能の年度は null
consolidated: String # 連結 / 非連結
accountingStandard: String
periodStart: String
periodEnd: String
periodMonths: Int
localName: String # 出典の開示項目(XBRL 要素)名
label: String # 開示項目の日本語ラベル
docId: String # 出典書類 ID
}
type DocumentList {
count: Int
documents: [Document]
}
type Document {
documentId: String
docTypeCode: String
typeName: String
submitDate: String
fiscalYear: Int
quarter: Int
periodStart: String
periodEnd: String
isCorrection: Boolean # 訂正報告書かどうか
parentDocumentId: String # 訂正報告書の場合の原本 ID
accountingStandard: String
docDescription: String
}
type Segments {
fiscalYear: Int
periodStart: String
periodEnd: String
accountingStandard: String
sourceDoc: String
segments: [Segment]
}
type Segment {
labelJa: String
labelEn: String
role: String
isAdjustment: Boolean # セグメント間の調整額かどうか
metrics: [SegmentMetric]
}
type SegmentMetric {
key: String # seg_revenue など
value: Float
unit: String # JPY = 円 / pure = 純数
consolidated: String
label: String
}
type MetricKey {
key: String
bindings: [MetricBinding] # 対応する開示項目の一覧
}
type MetricBinding {
localName: String
labelJa: String
accountingStandard: String
}
type Ranking {
metric: String
year: Int
count: Int
coverage: Coverage
rows: [RankingRow]
}
type RankingRow {
rank: Int
edinetCode: String
securitiesCode: String
companyName: String
industry: String
value: Float
consolidated: String
accountingStandard: String
periodStart: String
periodEnd: String
periodMonths: Int
sourceDoc: String
}
type Coverage {
companiesWithDocument: Int # 母集団(開示書類がある社数)
resolved: Int
missing: Int
ambiguous: Int
}
type Distribution {
metric: String
year: Int
overall: Stats
byIndustry: [IndustryStats]
}
type Stats {
n: Int
min: Float
q10: Float
q25: Float
median: Float
q75: Float
q90: Float
max: Float
}
type IndustryStats {
industry: String
n: Int
min: Float
q10: Float
q25: Float
median: Float
q75: Float
q90: Float
max: Float
}企業のプロフィールと売上推移をまとめて取得
{
company(code: "7203") {
profile { companyName industry }
metrics(metric: ["revenue"], from: 2024) {
series { key annual { fiscalYear value } }
}
}
}変数(variables)を使う
query CompanyMetrics($code: String!, $keys: [String]) {
company(code: $code) {
metrics(metric: $keys) { series { key annual { fiscalYear value } } }
}
}{ "code": "6758", "keys": ["revenue", "operating_income", "roe"] }ROE上位企業とその分布を1回で取得
{
ranking(metric: "roe", year: 2025, limit: 10) {
rows { rank companyName value }
}
distribution(metric: "roe", year: 2025) {
overall { n median q90 }
}
}- 無料でご利用いただけますが、非商用利用に限ります(商用利用不可)。利用条件はRESTと共通です。
- 出典はEDINET(金融庁)です。同システムのデータを加工して作成しています。
- データは無保証です。正確性・完全性を保証するものではありません。
- 投資判断は、必ず原典(EDINETの開示書類)をご確認のうえ、ご自身の判断で行ってください。本APIは投資勧誘を目的としたものではありません。
本サイトの運営情報・免責事項はサイトについてをご覧ください。