الانتقال إلى المحتوى الرئيسي

PDF Tools API

Invoice Generator API

Turn invoice JSON into polished PDF invoices from your billing system, admin panel, or automation workflow.

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.

cURL 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

401invalid_api_key

The x-api-key header is missing, invalid, or has been rotated.

402insufficient_credits

The account does not have enough API Credits for the request.

422pdf_tool_processing_failed

The file, options, or PDF structure could not be processed.

Limits

  • Requires invoice number, sender, recipient, and at least one line item.
  • Currency defaults to USD when omitted.
  • Use server-side API calls so your API Key is never exposed in the browser.

Example output

invoice.pdf with X-Credits-Charged and X-Credit-Balance response headers.

X-Credits-Charged: 1

X-Credit-Balance: 99

Content-Disposition: attachment; filename="invoice.pdf"

FAQ

How much does the Invoice Generator API cost?

Each successful invoice PDF request uses 1 Credit. 1,000 Credits cost $1, and every signed-in user receives 100 free API Credits each month.

What does the endpoint return?

The endpoint returns a PDF invoice file directly, plus Credits headers for usage tracking.

Should I call it from the browser?

No. Keep API Keys server-side and call the endpoint from your backend or automation job.

Start with 100 free API Credits

Create an API Key, test Invoice Generator API, and buy more Credits only when automation volume grows.