ドキュメント

REST API

HTTPによるHWP/HWPX文書変換

エンドポイント

POST https://hwpx.io/api/v1/convert

認証

X-API-KeyヘッダーにAPIキーを含めてください。

X-API-Key: YOUR_API_KEY

パラメータ

ParameterTypeDescription
fileFile変換する.hwpまたは.hwpxファイル
formatString出力形式: "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リクエスト。

エラーコード

CodeDescription
400無効なファイル形式またはフォーマット
401APIキーの欠落または無効
429日次レート制限超過
500サーバー内部エラー