ドキュメント
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キーの欠落または無効 |
429 | 日次レート制限超過 |
500 | サーバー内部エラー |