APIドキュメント
クイックスタート
1. アカウント作成してAPIキーを取得
Dashboard →2. 書類をアップロード
curl -X POST https://denshiapi.mylastwork.com/api/v1/upload \
-H "Authorization: Bearer ds_your_api_key" \
-F "file=@invoice.pdf" \
-F "transaction_date=2025-03-15" \
-F "counterparty=株式会社サンプル" \
-F "amount=550000" \
-F "document_type=invoice" 認証
全てのAPIリクエストに Authorization ヘッダーが必要です。
Authorization: Bearer ds_your_api_key /api/v1/upload 書類をアップロードして電子保存。SHA-256ハッシュとタイムスタンプを自動付与。
Request (multipart/form-data)
file (required) -- アップロードファイル (PDF/JPEG/PNG/TIFF/WebP/XML/CSV/Excel)
transaction_date -- 取引年月日 (YYYY-MM-DD)
counterparty -- 取引先名称
amount -- 取引金額(整数)
document_type -- invoice/receipt/contract/delivery/quotation/other
description -- 説明
tags -- タグ (JSON配列 or カンマ区切り)
Response
{
"success": true,
"data": {
"id": "abc123...",
"filename": "invoice.pdf",
"hash_sha256": "e3b0c44298fc...",
"timestamp_token": "a1b2c3d4...",
"timestamped_at": "2025-03-15T10:30:00Z",
"file_size": 245760,
"content_type": "application/pdf"
}
} /api/v1/search 電子帳簿保存法の3要件(取引年月日・取引先・金額)で検索
Query Parameters
transaction_date_from -- 開始日 (YYYY-MM-DD)
transaction_date_to -- 終了日 (YYYY-MM-DD)
counterparty -- 取引先(部分一致)
amount_min -- 最小金額
amount_max -- 最大金額
document_type -- 書類種別
page -- ページ番号(デフォルト1)
limit -- 件数(デフォルト20、最大100)
curl "https://denshiapi.mylastwork.com/api/v1/search?\
transaction_date_from=2025-01-01&\
transaction_date_to=2025-03-31&\
counterparty=サンプル&\
amount_min=100000&\
amount_max=1000000" \
-H "Authorization: Bearer ds_your_api_key" Response
{
"success": true,
"data": {
"documents": [{
"id": "abc123...",
"filename": "invoice.pdf",
"transaction_date": "2025-03-15",
"counterparty": "株式会社サンプル",
"amount": 550000,
"document_type": "invoice",
"hash_sha256": "e3b0c44298fc...",
"timestamped_at": "2025-03-15T10:30:00Z"
}],
"total": 1,
"page": 1,
"limit": 20,
"total_pages": 1
}
} /api/v1/documents/:id ドキュメントのメタデータを取得
/api/v1/documents/:id/download ドキュメントファイルをダウンロード
/api/v1/verify ドキュメントの改ざん検証。R2から再ダウンロードしてSHA-256を再計算、保存ハッシュと比較。
Request Body
curl -X POST https://denshiapi.mylastwork.com/api/v1/verify \
-H "Authorization: Bearer ds_your_api_key" \
-H "Content-Type: application/json" \
-d '{"document_id": "abc123..."}' Response
{
"success": true,
"data": {
"is_valid": true,
"document_id": "abc123...",
"hash_valid": true,
"stored_hash": "e3b0c44298fc...",
"computed_hash": "e3b0c44298fc...",
"timestamp_valid": true,
"timestamped_at": "2025-03-15T10:30:00Z"
}
} /api/v1/audit 監査証跡を取得。全操作(upload/view/search/download/verify)の記録。
Query Parameters
document_id -- 特定ドキュメントのログのみ
from -- 開始日時 (ISO 8601)
to -- 終了日時 (ISO 8601)
action -- アクション種別でフィルタ
limit -- 件数(デフォルト50、最大100)
offset -- オフセット
Response
{
"success": true,
"data": {
"entries": [{
"id": 1,
"document_id": "abc123...",
"action": "upload",
"details": "filename=invoice.pdf, size=245760",
"ip_address": "203.0.113.1",
"created_at": "2025-03-15T10:30:00Z"
}],
"total": 1
}
} /api/v1/validate-compliance 全ドキュメントの電子帳簿保存法準拠状況をチェック。不備のあるドキュメントと具体的な問題点を返却。
Response
{
"success": true,
"data": {
"total_documents": 150,
"compliant": 142,
"non_compliant": 8,
"issues": [{
"document_id": "def456...",
"filename": "receipt_old.jpg",
"issues": [
"取引先名称が未設定です(検索要件)",
"取引金額が未設定です(検索要件)"
]
}]
}
} エラーコード
| Status | 説明 |
|---|---|
| 400 | リクエストが不正 |
| 401 | APIキーが無効 |
| 404 | ドキュメントが見つからない |
| 429 | 月間上限に達した |
| 500 | サーバーエラー |