API ドキュメント

v1.0

政治資金データベース API

政治資金収支報告書のデータにアクセスするためのRESTful APIです。 政治団体、収支報告書、収入・支出明細、エンティティ情報を取得できます。

ベースURL
https://api.political-funds.example.com
認証
不要

現在は認証不要でアクセス可能

レート制限
1000 req/hour

IPアドレス単位

データ形式
JSON

UTF-8エンコーディング

エンドポイント一覧

GET
政治団体一覧
/api/organizations
政治団体の一覧を取得します。ページネーション、検索、フィルタリングに対応。

パラメータ

page
number
ページ番号(デフォルト: 1)
limit
number
1ページあたりの件数(デフォルト: 20)
search
string
団体名での検索
is_dissolved
boolean
解散状況でのフィルタ

レスポンス例

{
  "data": [
    {
      "id": "org_123",
      "name": "○○政治団体",
      "representative_name": "代表者名",
      "address": "東京都...",
      "is_dissolved": false,
      "total_reports": 5,
      "total_income": 10000000,
      "total_expenditure": 8000000
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "pages": 8
  }
}
GET
政治団体詳細
/api/organizations/{id}
指定された政治団体の詳細情報を取得します。

パラメータ

id
string
必須
政治団体ID

レスポンス例

{
  "id": "org_123",
  "name": "○○政治団体",
  "name_kana": "マルマルセイジダンタイ",
  "representative_name": "代表者名",
  "accountant_name": "会計責任者名",
  "address": "東京都千代田区...",
  "phone_number": "03-1234-5678",
  "email": "contact@example.org",
  "is_dissolved": false,
  "reports": [
    {
      "id": "report_456",
      "year": 2023,
      "total_income_amount": 5000000,
      "total_expenditure_amount": 4000000
    }
  ]
}
GET
収支報告書一覧
/api/reports
収支報告書の一覧を取得します。年度、団体、金額範囲でのフィルタリングが可能。

パラメータ

page
number
ページ番号
limit
number
1ページあたりの件数
year
number
報告年度
organization_id
string
政治団体ID
min_income
number
最小収入額
max_income
number
最大収入額

レスポンス例

{
  "data": [
    {
      "id": "report_456",
      "organization": {
        "id": "org_123",
        "name": "○○政治団体"
      },
      "year": 2023,
      "total_income_amount": 5000000,
      "total_expenditure_amount": 4000000,
      "submission_date": "2024-03-31",
      "document_url": "https://..."
    }
  ],
  "pagination": {...}
}
GET
収入明細一覧
/api/income
収入明細の一覧を取得します。カテゴリ、金額、日付でのフィルタリングが可能。

パラメータ

page
number
ページ番号
limit
number
1ページあたりの件数
report_id
string
収支報告書ID
category
string
収入カテゴリ
min_amount
number
最小金額
max_amount
number
最大金額
start_date
string
開始日(YYYY-MM-DD)
end_date
string
終了日(YYYY-MM-DD)

レスポンス例

{
  "data": [
    {
      "id": "income_789",
      "amount": 100000,
      "item_date": "2023-06-15",
      "income_category": "個人からの寄附",
      "source_name_raw": "寄付者名",
      "source_address_raw": "寄付者住所",
      "entity": {
        "id": "entity_101",
        "name": "寄付者名(正規化済み)"
      },
      "report": {
        "id": "report_456",
        "organization": {
          "name": "○○政治団体"
        }
      }
    }
  ],
  "pagination": {...}
}
GET
支出明細一覧
/api/expenditure
支出明細の一覧を取得します。カテゴリ、用途、金額でのフィルタリングが可能。

パラメータ

page
number
ページ番号
limit
number
1ページあたりの件数
report_id
string
収支報告書ID
major_category
string
大分類
minor_category
string
小分類
purpose
string
支出の目的
min_amount
number
最小金額
max_amount
number
最大金額

レスポンス例

{
  "data": [
    {
      "id": "expenditure_890",
      "amount": 50000,
      "item_date": "2023-07-20",
      "major_category": "政治活動費",
      "minor_category": "広報費",
      "purpose": "チラシ印刷代",
      "recipient_name_raw": "印刷会社名",
      "entity": {
        "id": "entity_102",
        "name": "印刷会社名(正規化済み)"
      }
    }
  ],
  "pagination": {...}
}
GET
エンティティ一覧
/api/entities
寄付者・受領者エンティティの一覧を取得します。

パラメータ

page
number
ページ番号
limit
number
1ページあたりの件数
search
string
エンティティ名での検索
entity_type
string
エンティティタイプ

レスポンス例

{
  "data": [
    {
      "id": "entity_101",
      "name": "エンティティ名",
      "entity_type": "individual",
      "address": "住所",
      "occupation": "職業",
      "income_count": 5,
      "expenditure_count": 2,
      "total_income_amount": 500000,
      "total_expenditure_amount": 100000
    }
  ],
  "pagination": {...}
}
GET
統合検索
/api/search
収入・支出明細を横断的に検索します。全文検索とフィルタリングに対応。

パラメータ

q
string
必須
検索クエリ
type
string
検索対象(income, expenditure, both)
year
number
対象年度
min_amount
number
最小金額
max_amount
number
最大金額
page
number
ページ番号
limit
number
1ページあたりの件数

レスポンス例

{
  "query": "広告",
  "results": {
    "income_items": [...],
    "expenditure_items": [...],
    "total_count": 25,
    "income_count": 5,
    "expenditure_count": 20
  },
  "pagination": {...}
}
GET
相関関係分析
/api/correlations
複数の政治団体と関係のあるエンティティの相関関係を分析します。

パラメータ

min_amount
number
最小取引金額
min_connections
number
最小接続数
limit
number
結果件数

レスポンス例

{
  "correlations": [
    {
      "entity_id": "entity_101",
      "entity_name": "エンティティ名",
      "organizations": [
        {
          "id": "org_123",
          "name": "政治団体A",
          "total_amount": 1000000,
          "transaction_count": 3,
          "transaction_type": "income"
        }
      ],
      "total_amount": 2000000,
      "connection_count": 2
    }
  ],
  "network_data": {
    "nodes": [...],
    "edges": [...]
  }
}
GET
統計情報
/api/stats
データベース全体の統計情報を取得します。

レスポンス例

{
  "total_organizations": 1500,
  "active_organizations": 1200,
  "total_reports": 7500,
  "total_income_amount": 50000000000,
  "total_expenditure_amount": 48000000000,
  "total_income_items": 150000,
  "total_expenditure_items": 200000,
  "total_entities": 50000,
  "latest_year": 2023,
  "year_range": {
    "min": 2019,
    "max": 2023
  }
}
エラーレスポンス
APIエラー時に返されるレスポンス形式

HTTPステータスコード

200
成功
400
不正なリクエスト
404
リソースが見つからない
429
レート制限超過
500
サーバーエラー

エラーレスポンス形式

{
  "error": {
    "code": "INVALID_PARAMETER",
    "message": "指定されたパラメータが無効です",
    "details": {
      "parameter": "year",
      "value": "invalid_year",
      "expected": "number"
    }
  }
}
利用例
APIを使用したデータ取得の具体例

JavaScript (fetch)

// 政治団体一覧を取得
const response = await fetch('https://api.political-funds.example.com/api/organizations?page=1&limit=10');
const data = await response.json();

// 特定団体の収支報告書を取得
const orgId = 'org_123';
const reportsResponse = await fetch(`https://api.political-funds.example.com/api/reports?organization_id=${orgId}`);
const reports = await reportsResponse.json();

// 検索実行
const searchResponse = await fetch('https://api.political-funds.example.com/api/search?q=広告&type=expenditure');
const searchResults = await searchResponse.json();

cURL

# 政治団体一覧を取得
curl "https://api.political-funds.example.com/api/organizations?page=1&limit=10"

# 収入明細を検索
curl "https://api.political-funds.example.com/api/income?min_amount=100000&category=個人からの寄附"

# 統計情報を取得
curl "https://api.political-funds.example.com/api/stats"
注意事項・制限

このAPIは政治資金収支報告書の公開データに基づいています。

データの正確性については元の報告書を参照してください。

大量のデータ取得を行う場合は、適切な間隔を空けてリクエストしてください。

商用利用の場合は事前にお問い合わせください。