> ## Documentation Index
> Fetch the complete documentation index at: https://kliio.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate PDF

> Generates a PDF document (invoice or quote) from structured data. Returns a downloadable PDF file.

### Headers

<ParamField header="Authorization" type="string" required>
  `Bearer YOUR_API_KEY`
</ParamField>

<ParamField header="Content-Type" type="string" required>
  `application/json`
</ParamField>

### Body

<ParamField body="title" type="string" required>
  Document type. Either `Invoice` or `Quote`.
</ParamField>

<ParamField body="number" type="string" required>
  Document number/ID (e.g., `INV-0001` or `QTE-0001`).
</ParamField>

<ParamField body="date" type="string" required>
  Issue date in `YYYY-MM-DD` format.
</ParamField>

<ParamField body="clientName" type="string" required>
  Client's full name.
</ParamField>

<ParamField body="clientEmail" type="string" required>
  Client's email address.
</ParamField>

<ParamField body="partnerName" type="string" required>
  Your (partner's) full name or business name.
</ParamField>

<ParamField body="partnerEmail" type="string" required>
  Your email address.
</ParamField>

<ParamField body="amount" type="number" required>
  Total amount to display on the document.
</ParamField>

<ParamField body="lineItems" type="array" required>
  Array of line items to display in the document.

  <Expandable title="Line item object">
    <ParamField body="id" type="string">Unique identifier</ParamField>
    <ParamField body="description" type="string">Line item description</ParamField>
    <ParamField body="qty" type="string | number">Quantity</ParamField>
    <ParamField body="rate" type="string | number">Unit price/rate</ParamField>
  </Expandable>
</ParamField>

<ParamField body="dueDate" type="string">
  Due date in `YYYY-MM-DD` format. Used for invoices.
</ParamField>

<ParamField body="expiryDate" type="string">
  Expiry date in `YYYY-MM-DD` format. Used for quotes/proposals.
</ParamField>

<ParamField body="clientCompany" type="string">
  Client's company name (optional).
</ParamField>

<ParamField body="partnerCompany" type="string">
  Your company name (optional).
</ParamField>

<ParamField body="logoUrl" type="string">
  URL or base64 data URI of your logo image.
</ParamField>

<ParamField body="subtotal" type="number">
  Subtotal amount. If omitted, it's calculated from line items.
</ParamField>

<ParamField body="taxRate" type="number">
  Tax rate as percentage (0–100). Defaults to `20`.
</ParamField>

<ParamField body="currencySymbol" type="string">
  Currency symbol (e.g., `$`, `£`, `€`). Defaults to `$`.
</ParamField>

<ParamField body="notes" type="string">
  Additional notes to display on the document.
</ParamField>

<ParamField body="terms" type="string">
  Terms and conditions text.
</ParamField>

<ParamField body="poNumber" type="string">
  Purchase Order number to display on the invoice.
</ParamField>

<ParamField body="discountAmount" type="number">
  Discount amount to subtract from subtotal.
</ParamField>

<ParamField body="shippingAmount" type="number">
  Shipping/delivery cost to add to the total.
</ParamField>

<ParamField body="fontStyle" type="string">
  Font style preset: `elegant` (default), `modern`, or `classic`.
</ParamField>

<ParamField body="textScale" type="number">
  Text size scale (0.8 to 1.2). Defaults to `1`.
</ParamField>

<ParamField body="showBanner" type="boolean">
  Whether to show the hero banner image. Defaults to `true`.
</ParamField>

<ParamField body="layoutType" type="string">
  Layout style: `standard` (default) or `overlay`.
</ParamField>

<ParamField body="bannerUrl" type="string">
  URL of the hero banner image.
</ParamField>

<ParamField body="brandColor" type="string">
  Hex color code for accent color (e.g., `#1D4D4F`).
</ParamField>

<ParamField body="isQuote" type="boolean">
  Whether this is a quote (changes labels like "Valid until" vs "Due date").
</ParamField>

<ParamField body="quoteIntro" type="string">
  Introduction text for quotes.
</ParamField>

<ParamField body="bodyMarkdown" type="string">
  Markdown content for the document body (e.g., scope of work).
</ParamField>

<ParamField body="requiresSignature" type="boolean">
  Whether the document requires a signature block.
</ParamField>

<ParamField body="paymentDueDays" type="number">
  Number of days until payment is due after signing (for quotes).
</ParamField>

### Response

Returns a binary PDF file with `Content-Type: application/pdf`.

### Request Example

````bash cURL theme={null}
curl -X POST https://kliio.app/api/tools/generate-pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Invoice",
    "number": "INV-0001",
    "date": "2025-03-20",
    "dueDate": "2025-04-20",
    "clientName": "Alice Johnson",
    "clientEmail": "alice@example.com",
    "clientCompany": "Acme Corp",
    "partnerName": "Your Agency",
    "partnerEmail": "hello@agency.com",
    "partnerCompany": "Your Agency Ltd",
    "amount": 1500,
    "taxRate": 20,
    "currencySymbol": "$",
    "lineItems": [
      { "id": "1", "description": "Web Design", "qty": "1", "rate": "1200" },
      { "id": "2", "description": "Hosting (annual)", "qty": "1", "rate": "300" }
    ],
    "notes": "Payment within 7 days please.",
    "fontStyle": "elegant",
    "layoutType": "standard"
  }' -o invoice.pdf
```bash cURL (Quote)
curl -X POST https://kliio.app/api/tools/generate-pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Quote",
    "number": "QTE-0042",
    "date": "2025-03-20",
    "isQuote": true,
    "clientName": "Bob Smith",
    "clientEmail": "bob@example.com",
    "partnerName": "Creative Studio",
    "partnerEmail": "hello@studio.com",
    "amount": 2500,
    "lineItems": [
      { "id": "1", "description": "Brand Strategy", "qty": "1", "rate": "2500" }
    ],
    "bodyMarkdown": "### Scope of Work\n* Logo Design\n* Brand Guidelines",
    "requiresSignature": true,
    "paymentDueDays": 7
  }' -o quote.pdf
````

```js JavaScript theme={null}
const res = await fetch('https://kliio.app/api/tools/generate-pdf', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'Invoice',
    number: 'INV-0001',
    date: '2025-03-20',
    dueDate: '2025-04-20',
    clientName: 'Alice Johnson',
    clientEmail: 'alice@example.com',
    clientCompany: 'Acme Corp',
    partnerName: 'Your Agency',
    partnerEmail: 'hello@agency.com',
    amount: 1500,
    taxRate: 20,
    currencySymbol: '$',
    lineItems: [
      { id: '1', description: 'Web Design', qty: '1', rate: '1200' },
      { id: '2', description: 'Hosting', qty: '1', rate: '300' }
    ]
  })
})

// Save the PDF
const blob = await res.blob()
const url = URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = 'invoice.pdf'
a.click()
```
