Skip to main content

PDF Tools API

請求書生成 API

バックエンド、バッチ処理、プロダクト内のワークフローに請求書PDF生成を組み込み、PDF処理基盤の自前運用を減らします。

Credits

1 Credit / call

1 Credit per successful API request. Failed processing attempts are refunded automatically.

Pricing

1,000 Credits = $1

Every signed-in user receives 100 free API Credits each month.

Endpoint

/api/external/invoice-generator/pdf

Use your API Key in the x-api-key header.

Use case

請求データや管理画面のJSONからブランド付きPDFを生成する場面で使います。手作業の確認はWebツール、安定したサーバー側処理はAPIに分ける設計です。

cURL example

curl -X POST https://itextmaster.com/api/external/invoice-generator/pdf \
  -H 'x-api-key: YOUR_API_KEY' \
  -F 'invoiceNumber=INV-001' \
  -F 'fromName=Your Company' \
  -F 'billToName=Client Name' \
  -F 'items=[{"description":"Consulting","quantity":10,"rate":150}]' \
  --output invoice.pdf

Multipart example

curl -X POST https://itextmaster.com/api/external/invoice-generator/pdf \
  -H 'x-api-key: YOUR_API_KEY' \
  -F 'invoiceNumber=INV-001' \
  -F 'fromName=Your Company' \
  -F 'billToName=Client Name' \
  -F 'items=[{"description":"Consulting","quantity":10,"rate":150}]' \
  --output invoice.pdf

JSON base64 example

curl -X POST https://itextmaster.com/api/external/invoice-generator/pdf \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{
    "invoiceNumber": "INV-001",
    "from": { "name": "Your Company", "email": "you@example.com" },
    "billTo": { "name": "Client Name", "email": "client@example.com" },
    "items": [{ "description": "Consulting", "quantity": 10, "rate": 150 }]
  }' \
  --output invoice.pdf

Node.js example

import { writeFile } from 'node:fs/promises';

const response = await fetch('https://itextmaster.com/api/external/invoice-generator/pdf', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': process.env.ITEXTMASTER_API_KEY
  },
  body: JSON.stringify({
  invoiceNumber: 'INV-001',
  from: { name: 'Your Company', email: 'you@example.com' },
  billTo: { name: 'Client Name', email: 'client@example.com' },
  items: [{ description: 'Consulting', quantity: 10, rate: 150 }]
})
});

if (!response.ok) {
  throw new Error(await response.text());
}

await writeFile('invoice.pdf', Buffer.from(await response.arrayBuffer()));

Python example

import os
import requests

response = requests.post(
    'https://itextmaster.com/api/external/invoice-generator/pdf',
    headers={
        'Content-Type': 'application/json',
        'x-api-key': os.environ['ITEXTMASTER_API_KEY'],
    },
    json={
        'invoiceNumber': 'INV-001',
        'from': {'name': 'Your Company', 'email': 'you@example.com'},
        'billTo': {'name': 'Client Name', 'email': 'client@example.com'},
        'items': [{'description': 'Consulting', 'quantity': 10, 'rate': 150}],
    },
)
response.raise_for_status()

with open('invoice.pdf', 'wb') as f:
    f.write(response.content)

Error codes

400invalid_invoice_payload

請求書JSONが不正、または必須項目が不足しています。

401invalid_api_key

x-api-keyがない、無効、またはローテーション済みです。

402insufficient_credits

アカウントのAPI Creditsが不足しています。

500invoice_pdf_generation_failed

請求書PDFの生成に失敗しました。失敗分のCreditsは自動で戻ります。

Limits

  • 正常に開けるPDFまたは有効な入力データが必要です。
  • API Keyはサーバー側に置き、ブラウザには公開しないでください。
  • 大量処理の前に代表的なファイルで出力を確認してください。

Response headers

invoice.pdf とともに、使用Creditsと残高を示すレスポンスヘッダーが返ります。

Content-Type
生成ファイルのMIMEタイプです。通常はapplication/pdfまたはapplication/zipです。
Content-Disposition
生成ファイルのダウンロード名です。
X-Credits-Charged
成功したリクエストで消費されたCreditsです。
X-Credit-Balance
リクエスト後のAPI Credits残高です。

FAQ

請求書生成 APIの料金は?

成功した請求書生成 APIリクエストはAPI Creditsを使います。処理に失敗した分は自動で返却されます。ログイン済みユーザーには毎月100 free API Creditsがあり、1,000 Credits = $1です。

WebツールでもAPI Creditsを使いますか?

ブラウザ内で処理するWebツールはAPI Creditsを使いません。API Keyを使う自動化リクエストだけが対象です。

フロントエンドから直接呼べますか?

推奨しません。API Keyはバックエンド、キュー、サーバー側ジョブに置いてください。

Start with 100 free API Credits

Create an API Key, test 請求書生成 API, and buy more Credits only when automation volume grows.