ドキュメント
REST API
HTTPによるHWP/HWPX文書変換
エンドポイント
POST https://hwpx.io/api/v1/convert認証
X-API-KeyヘッダーにAPIキーを含めてください。
X-API-Key: YOUR_API_KEY
パラメータ
| Parameter | Type | Description |
|---|---|---|
file | File | 変換する.hwpまたは.hwpxファイル |
format | String | 出力形式: "md"(Markdown)または "html" |
リクエスト
multipart/form-data POSTリクエストでファイルと出力形式を送信します。
curl
curl -X POST "https://hwpx.io/api/v1/convert" \ -H "X-API-Key: YOUR_API_KEY" \ -F "file=@document.hwpx" \ -F "format=md" \ -o result.zip
Python
import requests
response = requests.post(
"https://hwpx.io/api/v1/convert",
headers={"X-API-Key": "YOUR_API_KEY"},
files={"file": open("document.hwpx", "rb")},
data={"format": "md"}
)
with open("result.zip", "wb") as f:
f.write(response.content)JavaScript (Node.js)
const form = new FormData();
form.append("file", fs.createReadStream("document.hwpx"));
form.append("format", "md");
const response = await fetch("https://hwpx.io/api/v1/convert", {
method: "POST",
headers: { "X-API-Key": "YOUR_API_KEY" },
body: form,
});
const buffer = await response.arrayBuffer();
fs.writeFileSync("result.zip", Buffer.from(buffer));レスポンス
変換された文書と抽出された画像を含むZIPファイル。
レート制限
認証済みユーザーあたり1日20リクエスト。バルクリクエストはファイル数分カウントされます。
エラーコード
| Code | Description |
|---|---|
400 | 無効なファイル形式またはフォーマット |
401 | APIキーの欠落または無効 |
413 | ファイルまたは合計サイズが上限超過 |
429 | 日次レート制限超過 |
500 | サーバー内部エラー |
HWP → HWPX(バルク)
公共機関提出用のHWPX形式にHWPファイルを一度に変換します。fileフィールドを複数回添付するとバッチ処理されます。
エンドポイント
POST https://hwpx.io/api/v1/convert/hwp-to-hwpxパラメータ
| Parameter | Type | Description |
|---|---|---|
file | File (repeatable) | 変換する.hwpファイル(複数添付可、最大50件) |
1リクエストあたり最大50件、ファイル50MB、合計200MB
リクエスト
curl
curl -X POST "https://hwpx.io/api/v1/convert/hwp-to-hwpx" \ -H "X-API-Key: YOUR_API_KEY" \ -F "file=@document1.hwp" \ -F "file=@document2.hwp" \ -o result.zip
Python
import requests
files = [
("file", open("document1.hwp", "rb")),
("file", open("document2.hwp", "rb")),
]
response = requests.post(
"https://hwpx.io/api/v1/convert/hwp-to-hwpx",
headers={"X-API-Key": "YOUR_API_KEY"},
files=files,
)
with open("result.zip", "wb") as f:
f.write(response.content)レスポンス
変換された.hwpxファイル群を含むZIP。失敗があればerrors.jsonを同梱。