Invoice Create

Turn structured invoice data into a polished, ready-to-send PDF with a single API call.

Overview

The Invoice Create endpoint builds a complete invoice PDF from structured data. Choose a template, send your company, client and line item details, and Give Me PDF returns a link to the finished PDF — no HTML or CSS required.

If you need full control over the layout, design your own HTML and send it to PDF Render.

Creating an invoice

Send a POST request to the following endpoint to generate an invoice:

POST https://www.givemepdf.com/api/v1/invoice/create

Credits are only deducted after your PDF has been created successfully. Validation errors and failed renders are free.

Credits required: 3 / request

Authentication

Every API call must include an API-KEY header.

You can find your API key in your dashboard.

Templates

Pick a design with the template parameter. Every template displays all of the fields below, and blocks you leave empty are hidden automatically.

Classic

classic

Elegant serif ledger layout with a thin brand accent and double-ruled total.

Default

Modern

modern

Bold brand-coloured header band, clean sans-serif type and a highlighted total box.

You can preview both templates with your own data in our free invoice generator.

Request body

Send the request body as JSON with a Content-Type: application/json header (recommended). Form-data also works, using keys such as line_items[0][description] for line items.

All text is treated as plain text. HTML tags are stripped and special characters are escaped.

Template & PDF options

Parameter Accepted value Required
template classic (default) or modern No
document_name String, 2–60 characters. Defaults to "Invoice {invoice_number}" No
orientation portrait (default) or landscape No
scale Number between 0.1 and 2.0 (default: 0.75) No
format Letter, Legal, Tabloid, Ledger, A0–A6 (default: A4). Other formats are available to Pro users. No

Branding

Parameter Accepted value Required
brand_color Hex colour, e.g. #1F4D3A. Each template has its own default. No
background_color Hex colour, e.g. #FAF9F4 No
company_logo_url Absolute http(s) URL to your logo, up to 500 characters No
company_website Absolute http(s) URL, up to 200 characters No

Your company

Parameter Accepted value Required
company_name String, 2–80 characters Yes
street_address String, up to 50 characters No
city_state_zip String, up to 60 characters No
your_country String, up to 50 characters No
your_email Valid email address No
your_phone String, up to 30 characters No

Invoice details

Parameter Accepted value Required
invoice_number String, up to 20 characters Yes
currency Currency symbol or code shown before amounts, e.g. $ or USD, up to 20 characters Yes
issue_date String, up to 20 characters, e.g. Aug 10, 2026 No
due_date String, up to 20 characters No
payment_terms String, up to 20 characters, e.g. Net 15 No
po_number String, up to 20 characters No

Client

Parameter Accepted value Required
client_company String, up to 50 characters Yes
client_street_address String, up to 50 characters No
client_city_state_zip String, up to 50 characters No
client_country String, up to 50 characters No

Line items

Parameter Accepted value Required
line_items Array of 1–100 line item objects Yes
line_items[].description String, up to 200 characters Yes
line_items[].quantity Number, 0 or more Yes
line_items[].rate Number (unit price) Yes
line_items[].amount Number. Calculated as quantity × rate when omitted No

Example line_items value. The first item has an explicit amount; the second is calculated as quantity × rate:

"line_items": [
    {
        "description": "Brand strategy workshop",
        "quantity": 1,
        "rate": 1275,
        "amount": 1275
    },
    {
        "description": "Logo design",
        "quantity": 2,
        "rate": 375
    }
]

The same line items sent as form-data:

line_items[0][description]=Brand strategy workshop
line_items[0][quantity]=1
line_items[0][rate]=1275
line_items[0][amount]=1275
line_items[1][description]=Logo design
line_items[1][quantity]=2
line_items[1][rate]=375

Totals

Parameter Accepted value Required
subtotal Number. Sum of line item amounts when omitted No
discount_amount Number, 0 or more. Hidden when 0 or omitted No
tax_percent Number between 0 and 100. Hidden when 0 or omitted No
total_due Number. Calculated as (subtotal − discount) × (1 + tax ÷ 100) when omitted No

Payment & notes

Parameter Accepted value Required
payment_details String, up to 200 characters. Line breaks are kept No
notes String, up to 200 characters. Line breaks are kept No
misc_footer_info String, up to 50 characters No

Example request

curl -X POST https://www.givemepdf.com/api/v1/invoice/create \
  -H "API-KEY: your-api-key" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "template": "modern",
    "brand_color": "#4F46E5",
    "company_logo_url": "https://example.com/logo.png",
    "company_name": "Northwind Studio",
    "street_address": "221 Market Street",
    "city_state_zip": "San Francisco, CA 94105",
    "your_country": "United States",
    "your_email": "billing@northwind.test",
    "your_phone": "+1 415 555 0134",
    "invoice_number": "INV-2026-0042",
    "issue_date": "Oct 13, 2026",
    "due_date": "Oct 28, 2026",
    "payment_terms": "Net 15",
    "po_number": "PO-7781",
    "currency": "$",
    "client_company": "Acme Corporation",
    "client_street_address": "1 Infinite Loop",
    "client_city_state_zip": "Cupertino, CA 95014",
    "client_country": "United States",
    "line_items": [
      { "description": "Brand strategy workshop", "quantity": 1, "rate": 1275 },
      { "description": "Logo design", "quantity": 2, "rate": 375 }
    ],
    "discount_amount": 100,
    "tax_percent": 10,
    "payment_details": "Bank: First National\nAccount: 0123456789",
    "notes": "Thank you for your business!",
    "company_website": "https://northwind.test",
    "misc_footer_info": "Tax ID 12-3456789"
  }'

In this example the subtotal ($2,025.00) and total due ($2,117.50) are calculated for you.

Response

When the invoice is created, you will receive a JSON response with status code 200 and a link to download your PDF. Here is a sample response:

{
    "message": "OK",
    "data": {
        "location": "https://givemepdf.com/storage/8b6293cb05ee815c/ossrPslsisxeRLp0.pdf",
        "template": "modern",
        "file_ttl_days": 1,
        "warning": "This file is available for limited time. Please download as soon as possible."
    },
    "meta": {
        "remaining_free_credit": 3467,
        "remaining_paid_credit": 10000
    }
}

Validation errors return status 422 with an errors object keyed by field name:

{
    "message": "The invoice number field is required. (and 1 more error)",
    "errors": {
        "invoice_number": ["The invoice number field is required."],
        "line_items.0.rate": ["The line_items.0.rate field must be a number."]
    }
}

Possible errors

Status Message How to fix it
401 Unauthorized API-KEY missing Make sure your request includes the API-KEY header with a value.
401 Unauthorized Invalid API Key Your API key is incorrect. Sign in to your dashboard to copy a valid key or generate a new one.
401 Unauthorized API Key access is revoked This key was revoked. Generate a new key in your dashboard.
401 Unauthorized API key validity expired This key has passed its expiry date. Generate a new key in your dashboard.
429 Too Many Requests You have hit your account per minute request limit Each plan allows a limited number of requests per minute. Wait for retry_after_second seconds and try again.
429 Too Many Requests You have hit your account monthly credit usage limit of x Free accounts include a fixed number of credits each month, and you have reached it. Your quota resets next month — Pro users do not have monthly limits.
429 Too Many Requests Credit limit exceeded. You have no credits left. Upgrade or top up your plan to keep generating invoices.
422 Unprocessable Entity The invoice number field is required. company_name, invoice_number, currency, client_company and line_items are required. The errors object lists every missing or invalid field.
422 Unprocessable Entity At least one line item is required. Send line_items as an array with at least one object containing description, quantity and rate.
422 Unprocessable Entity Each line item may only contain description, quantity, rate and amount. Remove any extra keys from your line item objects.
422 Unprocessable Entity The brand color field must be a valid hexadecimal color. Colours must be hex values such as #1F4D3A or #FFF.
422 Unprocessable Entity Template must be one of: classic, modern. Use one of the template names listed in the Templates section, or omit the field to use classic.
500 Internal Server Error Invoice creation error. Something went wrong while rendering your invoice. You are not charged for failed requests. Check the troubleshooting tips below. If the problem persists, contact us. Contact us

Troubleshooting

  • Your logo must be an absolute, publicly reachable URL, for example https://example.com/logo.png. Images behind a login or on localhost cannot be loaded.
  • Colours must be hex values such as #1F4D3A or #FFF. Named colours like red are rejected.
  • Send amounts as plain numbers (1275.5, not "$1,275.50"). The currency symbol is added from the currency field and numbers are formatted with two decimals.
  • Use \n inside payment_details or notes to start a new line.
  • Add an Accept: application/json header so errors are always returned as JSON.