Invoice Generator API

repository·master·Indexed 19 days ago

https://github.com/invoice-generator/invoice-generator-api

An API for generating professional invoice PDFs and UBL e-invoices. It supports VAT compliance, localization for multiple languages, and custom fields. The API provides endpoints for standard PDF generation and UBL XML format, requiring Bearer Token authentication.

Tokens
2.1K
Snippets
8
Records
9
Agent score
17%

What's inside invoice-generator-api

  1. Configure invoice localization

    master

    You can change the language of the invoice template by providing an Accept-Language header. The default is en-US.

    Supported Languages:

    • English
    • French
    • German
    • Spanish
    • Thai
    curl https://invoice-generator.com \
      -H "Authorization: Bearer myApiKey" \
      -H "Accept-Language: fr-FR" \
      -d from="Nikolaus Ltd" \
      -d to="Acme Corp." \
      -d number=1 \
      -d currency=eur \
      -d "items[0][name]"="Starter plan monthly" \
      -d "items[0][quantity]"=1 \
      -d "items[0][unit_cost]"=99 \
    > invoice.pdf
  2. Create an invoice PDF

    master

    The primary endpoint returns a PDF invoice based on the provided details. You can send data via form-encoded parameters or as a JSON body with Content-Type: application/json.

    Endpoint: POST https://invoice-generator.com
    Authentication: Bearer Token via Authorization header.

    curl https://invoice-generator.com \
      -H "Authorization: Bearer myApiKey" \
      -d from="Nikolaus Ltd" \
      -d to="Acme, Corp." \
      -d number=1 \
      -d "items[0][name]"="Starter plan monthly" \
      -d "items[0][quantity]"=1 \
      -d "items[0][unit_cost]"=99 \
    > invoice.pdf
  3. Create a UBL E-invoice

    master

    The API can generate e-invoices in UBL (Universal Business Language) XML format. This format includes the invoice PDF embedded within the XML. It uses the same parameters as the standard PDF endpoint.

    Endpoint: POST https://invoice-generator.com/ubl

    curl https://invoice-generator.com/ubl \
      -H "Authorization: Bearer myApiKey" \
      -d from="Nikolaus Ltd" \
      -d to="Foster Moen" \
      -d "items[0][name]"="Starter Plan Monthly" \
      -d "items[0][quantity]"=1 \
      -d "items[0][unit_cost]"=99 \
    > invoice.xml
  4. Reference: Invoice Parameters

    master

    Parameters for the POST https://invoice-generator.com endpoint. When a value is null or zero, the field is omitted from the invoice, except for required fields: from, to, date, and items.

    | Parameter | Description | Default Value |
    |:---|:---|:---|
    | `logo` | URL of your logo | *null* |
    | `from` | Your organization billing address and contact info | *null* |
    | `to` | Entity being billed - multiple lines ok | *null* |
    | `ship_to` | Shipping address - multiple lines ok | *null* |
    | `number` | Invoice number | *null* |
    | `currency` | ISO 4217 3-digit currency code | USD |
    | `custom_fields` | Array of objects | *[]* |
    | `date` | Invoice date | current date |
    | `payment_terms` | Payment terms summary (i.e. NET 30) | *null* |
    | `due_date` | Invoice due date | *null* |
    | `items` | Array of objects (see Line Item Parameters) | `[]` |
    | `fields` | Object for subtotal line toggles | `{"tax":"%","discounts":false,"shipping":false}` |
    | `discounts` | Subtotal discounts - numbers only | 0 |
    | `tax` | Tax - numbers only | 0 |
    | `shipping` | Shipping - numbers only | 0 |
    | `amount_paid` | Amount paid - numbers only | 0 |
    | `notes` | Notes - any extra information not included elsewhere | *null* |
    | `terms` | Terms and conditions - all the details | *null* |
  5. Reference: Subtotal Line Parameters

    master

    The fields object toggles the visibility of discounts, tax, and shipping subtotal lines. Each setting can be % (for percentage-based tax), true, or false. Use the corresponding tax, discounts, or shipping keys to provide the numeric values.

    {
      "fields": {
        "tax": "%",
        "discounts": false,
        "shipping": true
      },
      "tax": 7,
      "shipping": 15
    }
  6. Reference: Invoice Template Parameters

    master

    These parameters control the labels/titles used in the invoice template. Providing a value overrides the localized default.

    | Parameter | Default Value |
    |:---|:---|
    | `header` | INVOICE |
    | `to_title` | Bill To |
    | `ship_to_title` | Ship To |
    | `invoice_number_title` | # |
    | `date_title` | Date |
    | `payment_terms_title` | Payment Terms |
    | `due_date_title` | Due Date |
    | `purchase_order_title` | Purchase Order |
    | `quantity_header` | Quantity |
    | `item_header` | Item |
    | `unit_cost_header` | Rate |
    | `amount_header` | Amount |
    | `subtotal_title` | Subtotal |
    | `discounts_title` | Discounts |
    | `tax_title` | Tax |
    | `shipping_title` | Shipping |
    | `total_title` | Total |
    | `amount_paid_title` | Amount Paid |
    | `balance_title` | Balance |
    | `terms_title` | Terms |
    | `notes_title` | Notes |