Create Invoice
curl -X POST "https://dev.invoicingapi.com/v1/invoice/createinvoice" \
-H "ApiKey: __YOUR_API_KEY__" \
-H "Content-Type: application/json" \
-d '{
"template": "business3",
"color": "black",
"documentType": "a4",
"fontSize": 11,
"invoiceNumber": "2024-44",
"issueDate": "2024-01-11T09:18:54.092Z",
"dueDate": "2024-05-11T09:18:54.092Z",
"recipientAddress":{
"name": "John Doe",
"email": "johndoe@gmail.com",
"addressLine1": "John Keneddy Str",
"telephone": "(034)-543-43354"
},
"lineItems":[
{
"description": "App consulting services",
"quantity": 1,
"unitPrice": 950
}
],
"currency": "usd",
"notes": "Payment Information\nIBAN Number: 43249423423489234",
"IsPaid": false
}' \
-o output.pdf
using InvoicingAPI.Nuget; // install the Nuget package by searching "InvoicingAPI"
var client = new InvoicingApiClient("__YOUR_API_KEY__");
// Replace with your actual invoice data. Check documentation below for more invoice parameters
var body = new CreateInvoiceBody
{
Template = "business3",
Color = "black",
DocumentType = "letter",
FontSize = 11,
InvoiceNumber = "3345",
IssueDate = DateTime.Now,
DueDate = DateTime.Now,
RecipientAddress = new Address
{
Name = "John Doe",
Email = "johndoe@gmail.com",
AddressLine1 = "John Keneddy Str",
Telephone = "(034)-543-43354"
},
LineItems = new List
{
new LineItem
{
Description = "App consulting services", Quantity = 1, UnitPrice = 950
}
},
Currency = "usd",
Notes = "Payment Information\nIBAN Number: 43249423423489234",
IsPaid = false
};
var result = await client.CreateInvoice(body);
if (result.InvoiceByteArray != null)
{
File.WriteAllBytes($@"__PATH__\{result.FileName}", result.InvoiceByteArray);
}
import requests
import json
api_key = "__YOUR_API_KEY__"
api_url = "https://dev.invoicingapi.com/v1/invoice/createinvoice"
# Replace with your actual invoice data. Check documentation below for more invoice parameters
invoice_data = {
"template": "business3",
"color": "black",
"documentType": "a4",
"fontSize": 11,
"invoiceNumber": "2024-44",
"issueDate": "2024-01-11T09:18:54.092Z",
"dueDate": "2024-05-11T09:18:54.092Z",
"recipientAddress":{
"name": "John Doe",
"email": "johndoe@gmail.com",
"addressLine1": "John Keneddy Str",
"telephone": "(034)-543-43354"
},
"lineItems":[
{
"description": "App consulting services",
"quantity": 1,
"unitPrice": 950
}
],
"currency": "usd",
"notes": "Payment Information\nIBAN Number: 43249423423489234",
"isPaid": false
}
# Convert the invoice data to JSON format
invoice_json = json.dumps(invoice_data)
# Define the headers with the API key
headers = {
"Content-Type": "application/json",
"ApiKey": api_key,
}
# Make a POST request to the API
response = requests.post(api_url, data=invoice_json, headers=headers)
# Check if the request was successful (status code 200)
if response.status_code == 200:
# Save it to a file
with open("invoice.pdf", "wb") as pdf_file:
pdf_file.write(response.content)
print("Invoice PDF received and saved as 'invoice.pdf'")
else:
print(f"API request failed with status code {response.status_code}")
print(response.text)
$apiKey = '__YOUR_API_KEY__';
$apiUrl = 'https://dev.invoicingapi.com/v1/invoice/createinvoice';
// Replace with your actual invoice data. Check documentation below for more invoice parameters
$invoiceData = [
"template" => "business3",
"color" => "black",
"documentType" => "a4",
"fontSize" => 11,
"invoiceNumber" => "2024-44",
"issueDate" => "2024-01-11T09:18:54.092Z",
"dueDate" => "2024-05-11T09:18:54.092Z",
"recipientAddress" => array(
"name" => "John Doe",
"email" => "johndoe@gmail.com",
"addressLine1" => "John Keneddy Str",
"telephone" => "(034)-543-43354"
),
"lineItems" => array(
array(
"description" => "App consulting services",
"quantity" => 1,
"unitPrice" => 950
)
),
"currency" => "usd",
"notes" => "Payment Information\nIBAN Number: 43249423423489234",
"isPaid" => false
];
// Convert the invoice data to JSON format
$invoiceJson = json_encode($invoiceData);
// Initialize cURL session
$ch = curl_init($apiUrl);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $invoiceJson);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'ApiKey: ' . $apiKey,
]);
// Execute cURL session and capture the response
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'cURL Error: ' . curl_error($ch);
exit;
}
// Get the HTTP status code
$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Close cURL session
curl_close($ch);
// Check if the request was successful (status code 200)
if ($httpStatus === 200) {
// Save the PDF response to a file
file_put_contents('invoice.pdf', $response);
echo 'Invoice PDF received and saved as "invoice.pdf"';
} else {
echo 'API request failed with status code ' . $httpStatus . PHP_EOL;
echo 'Response: ' . $response . PHP_EOL;
}
package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
apiKey := "__YOUR_API_KEY__"
apiUrl := "https://dev.invoicingapi.com/v1/invoice/createinvoice"
// Replace with your actual invoice data. Check documentation below for more invoice parameters
invoiceData := `{
"template": "business3",
"color": "black",
"documentType": "letter",
"fontSize": 11,
"invoiceNumber": "2024-44",
"issueDate": "2024-01-11T09:18:54.092Z",
"dueDate": "2024-05-11T09:18:54.092Z",
"recipientAddress":{
"name": "John Doe",
"email": "johndoe@gmail.com",
"addressLine1": "John Keneddy Str",
"telephone": "(034)-543-43354"
},
"lineItems":[
{
"description": "App consulting services",
"quantity": 1,
"unitPrice": 950
}
],
"currency": "usd",
"notes": "Payment Information\nIBAN Number: 43249423423489234",
"isPaid": false
}`
// Create a request body with the invoice data
requestBody := bytes.NewBuffer([]byte(invoiceData))
// Create an HTTP client
client := &http.Client{}
// Create an HTTP POST request
req, err := http.NewRequest("POST", apiUrl, requestBody)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
// Set request headers
req.Header.Set("Content-Type", "application/json")
req.Header.Set("ApiKey", apiKey)
// Send the HTTP request
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
// Check if the request was successful (status code 200)
if resp.StatusCode == http.StatusOK {
// Read the response body (PDF content)
pdfContent, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
// Save the PDF content to a file
err = ioutil.WriteFile("invoice.pdf", pdfContent, 0644)
if err != nil {
fmt.Println("Error saving PDF:", err)
return
}
fmt.Println("Invoice PDF received and saved as 'invoice.pdf'")
} else {
fmt.Printf("API request failed with status code %d\n", resp.StatusCode)
responseText, _ := ioutil.ReadAll(resp.Body)
fmt.Println("Response:", string(responseText))
}
}
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
public class InvoicingAPI {
public static void main(String[] args) {
String apiKey = "__YOUR_API_KEY__";
String apiUrl = "https://dev.invoicingapi.com/v1/invoice/createinvoice";
// Replace with your actual invoice data in JSON format. Check documentation below for more invoice parameters
String invoiceData = "{\"template\": \"business3\", " +
"\"color\": \"black\", " +
"\"documentType\": \"letter\", " +
"\"fontSize\": 11, " +
"\"invoiceNumber\": \"2024-44\", " +
"\"issueDate\": \"2024-01-11T09:18:54.092Z\", " +
"\"dueDate\": \"2024-05-11T09:18:54.092Z\", " +
"\"recipientAddress\": {\"name\": \"John Doe\", " +
"\"email\": \"johndoe@gmail.com\", " +
"\"addressLine1\": \"John Keneddy Str\", " +
"\"telephone\": \"(034)-543-43354\"}, " +
"\"lineItems\": [{\"description\": \"App consulting services\", " +
"\"quantity\": 1, " +
"\"unitPrice\": 950}], " +
"\"currency\": \"usd\", " +
"\"notes\": \"Payment Information\\nIBAN Number: 43249423423489234\", " +
"\"isPaid\": \"false\"}";
try {
// Create a URL object for the API endpoint
URL url = new URL(apiUrl);
// Open a connection to the URL
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Set the request method to POST
connection.setRequestMethod("POST");
// Set request headers
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("ApiKey", apiKey);
// Enable input and output streams
connection.setDoOutput(true);
// Write the invoice data to the output stream
try (OutputStream os = connection.getOutputStream()) {
byte[] input = invoiceData.getBytes("utf-8");
os.write(input, 0, input.length);
}
// Get the response code
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
// Read the response as an InputStream
try (InputStream is = connection.getInputStream()) {
// Save the PDF response to a file
try (FileOutputStream fos = new FileOutputStream("invoice.pdf")) {
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = is.read(buffer)) != -1) {
fos.write(buffer, 0, bytesRead);
}
}
System.out.println("Invoice PDF received and saved as 'invoice.pdf'");
}
} else {
// Handle the error
System.out.println("API request failed with status code " + responseCode);
try (InputStream errorStream = connection.getErrorStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(errorStream))) {
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
}
}
// Close the connection
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Request Headers
ApiKey
string
Your API key
Content-Type
string
The media type of the request. Required application/json
Request Body Parameters
color
string
The color to be used on the template. See which templates make use of this field here. Choose between black
, brown
, blue
, green
, and purple
.
documentType
string
Page size of the invoice. Choose between a0
, a1
, a2
, a3
, a4
, a5
, b0
, b1
, b2
, b3
, b4
, b5
, letter
, executive
, or legal
fontSize
int
(optional)
Font size to be used for standard text (non-titles) on the invoice. Default font size is 10 if not included in request.
invoiceNumber
string
Number of invoice
issueDate
string
Issue date of invoice
dueDate
string
Due date of invoice
issuerAddress
dictionary
(optional)
The default address of the issuing party of the invoice. You can set this either on your account profile page or as a request parameter. If both are set, the request parameter takes priority. This provides a mechanism for overriding the default issuer address on a per-invoice basis.
Show
"issuerAddress": {
"name": "John Doe",
"email": "johndoe@email.com",
"country": "USA",
"city": "Florida",
"addressLine1": "Street address",
"addressLine2": "Area",
"telephone": "995-8443-32323",
"website": "www.myorg.com",
"vatno": "RF45ID3"
}
recipientAddress
dictionary
The address of the receiving party of the invoice
Show
"recipientAddress": {
"name": "Jane Doe",
"email": "janedoe@email.com",
"country": "Australia",
"city": "Perth",
"addressLine1": "Street address",
"addressLine2": "Area",
"telephone": "443-5645-54353",
"website": "www.mysite.com",
"vatno": "3PFD93T"
}
taxData
dictionary
(optional)
The default tax data to be applied to the invoice. You can set this either on your account profile page or as a request parameter. If both are set, the request parameter takes priority. This provides a mechanism for overriding the default tax data on a per-invoice basis.
Show
"taxData": {
"type": "Sales Tax",
"percentage": 30,
"displayInline": true,
"unitPriceIncludesTax": false
}
- Type (required) - Acceptable values are
None
,Sales Tax
,GST
,HST
, orVAT
. Use None if you do not want to charge or show any tax information on your invoice. Let us know if you would like to add other tax types to the list. - Percentage (optional) - The percent of tax to be used on the invoice. If not provided, default will be set to 0.
- DisplayInline (optional) - Acceptable values are
true
orfalse
. If set to true, two tax fields displaying the tax type and percent will be added to the invoice table with data displayed inline. If set to false (default value), they will not be shown in the tax table. - UnitPriceIncludesTax (optional) - Acceptable values are
true
orfalse
. If set to true, this means your line item unit price already includes tax and therefore no extra calculation will be needed to determine the line item total. If set to false (default value), then a calculation will be done using the tax percent.
currency
string
Currency to be used on invoice (e.g. usd
or eur
). Use the country code in this field, and the corresponding symbol will be displayed on the invoice.
Currency | Code | Symbol | Invoice Support | Payment Link Support |
---|---|---|---|---|
Albania Lek | ALL | Lek | ||
Afghanistan Afghani | AFN | Af | ||
Argentina Peso | ARS | $ | ||
Aruba Guilder | AWG | ƒ | ||
Australia Dollar | AUD | $ | ||
Azerbaijan Manat | AZN | ₼ | ||
Bahamas Dollar | BSD | $ | ||
Barbados Dollar | BBD | $ | ||
Belarus Ruble | BYN | Br | ||
Belize Dollar | BZD | BZ$ | ||
Bermuda Dollar | BMD | $ | ||
Bolivia Bolíviano | BOB | $b | ||
Bosnia and Herzegovina Convertible Mark | BAM | KM | ||
Botswana Pula | BWP | P | ||
Bulgaria Lev | BGN | лв | ||
Brazil Real | BRL | R$ | ||
Brunei Darussalam Dollar | BND | $ | ||
Cambodia Riel | KHR | ៛ | ||
Canada Dollar | CAD | $ | ||
Cayman Islands Dollar | KYD | $ | ||
Chile Peso | CLP | $ | ||
China Yuan Renminbi | CNY | ¥ | ||
Colombia Peso | COP | $ | ||
Costa Rica Colon | CRC | ₡ | ||
Cuba Peso | CUP | ₱ | ||
Czech Republic Koruna | CZK | Kč | ||
Denmark Krone | DKK | kr | ||
Dominican Republic Peso | DOP | RD$ | ||
East Caribbean Dollar | XCD | $ | ||
Egypt Pound | EGP | £ | ||
El Salvador Colon | SVC | $ | ||
Euro Member Countries | EUR | € | ||
Falkland Islands (Malvinas) Pound | FKP | £ | ||
Fiji Dollar | FJD | $ | ||
Ghana Cedi | GHS | ¢ | ||
Gibraltar Pound | GIP | £ | ||
Guatemala Quetzal | GTQ | Q | ||
Guernsey Pound | GGP | £ | ||
Guyana Dollar | GYD | $ | ||
Honduras Lempira | HNL | L | ||
Hong Kong Dollar | HKD | $ | ||
Hungary Forint | HUF | Ft | ||
Iceland Krona | ISK | kr | ||
India Rupee | INR | ₹ | ||
Indonesia Rupiah | IDR | Rp | ||
Iran Rial | IRR | ﷼ | ||
Isle of Man Pound | IMP | £ | ||
Israel Shekel | ILS | ₪ | ||
Jamaica Dollar | JMD | J$ | ||
Japan Yen | JPY | ¥ | ||
Jersey Pound | JEP | £ | ||
Kazakhstan Tenge | KZT | лв | ||
Korea (North) Won | KPW | ₩ | ||
Korea (South) Won | KRW | ₩ | ||
Kyrgyzstan Som | KGS | лв | ||
Laos Kip | LAK | ₭ | ||
Lebanon Pound | LBP | £ | ||
Liberia Dollar | LRD | $ | ||
Macedonia Denar | MKD | ден | ||
Malaysia Ringgit | MYR | RM | ||
Mauritius Rupee | MUR | ₨ | ||
Mexico Peso | MXN | $ | ||
Mongolia Tughrik | MNT | ₮ | ||
Moroccan-dirham | MAD | د.م. | ||
Mozambique Metical | MZN | MT | ||
Namibia Dollar | NAD | $ | ||
Nepal Rupee | NPR | ₨ | ||
Netherlands Antilles Guilder | ANG | ƒ | ||
New Zealand Dollar | NZD | $ | ||
Nicaragua Cordoba | NIO | C$ | ||
Nigeria Naira | NGN | ₦ | ||
Norway Krone | NOK | kr | ||
Oman Rial | OMR | ﷼ | ||
Pakistan Rupee | PKR | ₨ | ||
Panama Balboa | PAB | B/. | ||
Paraguay Guarani | PYG | Gs | ||
Peru Sol | PEN | S/. | ||
Philippines Peso | PHP | ₱ | ||
Poland Zloty | PLN | zł | ||
Qatar Riyal | QAR | ﷼ | ||
Romania Leu | RON | lei | ||
Russia Ruble | RUB | ₽ | ||
Saint Helena Pound | SHP | £ | ||
Saudi Arabia Riyal | SAR | ﷼ | ||
Serbia Dinar | RSD | Дин. | ||
Seychelles Rupee | SCR | ₨ | ||
Singapore Dollar | SGD | $ | ||
Solomon Islands Dollar | SBD | $ | ||
Somalia Shilling | SOS | S | ||
South Korean Won | KRW | ₩ | ||
South Africa Rand | ZAR | R | ||
Sri Lanka Rupee | LKR | ₨ | ||
Sweden Krona | SEK | kr | ||
Switzerland Franc | CHF | CHF | ||
Suriname Dollar | SRD | $ | ||
Syria Pound | SYP | £ | ||
Taiwan New Dollar | TWD | NT$ | ||
Thailand Baht | THB | ฿ | ||
Trinidad and Tobago Dollar | TTD | TT$ | ||
Turkey Lira | TRY | ₺ | ||
Tuvalu Dollar | TVD | $ | ||
Ukraine Hryvnia | UAH | ₴ | ||
UAE-Dirham | AED | د.إ | ||
United Kingdom Pound | GBP | £ | ||
United States Dollar | USD | $ | ||
Uruguay Peso | UYU | $U | ||
Uzbekistan Som | UZS | лв | ||
Venezuela Bolívar | VEF | Bs | ||
Viet Nam Dong | VND | ₫ | ||
Yemen Rial | YER | ﷼ | ||
Zimbabwe Dollar | ZWD | Z$ |
lineItems
collection of dictionaries
The items to invoice. Total per line is calculated automatically.
Show
"lineItems": [
{
"description": "item1",
"quantity": 2,
"unitPrice": 2.4,
"unitTax" : 1
},
{
"description": "item2",
"quantity": 3,
"unitPrice": 3,
"unitTax": 1.5
}
]
- Description (required) - Your line item description.
- Quantity (required) - The number of units of the line item.
- UnitPrice (required) - The unit price of the line item. Can be inclusive or exclusive of tax (see taxData body parameter).
- UnitTax (optional) - The value of tax applied to the line item. This field is optional as unit tax is calculated automatically using provided tax percentage (assuming you want to show tax on your invoice). Use this value if you would like to override the calculated amount.
subtotal
double
(optional)
The total amount for the line items before tax and discount. If filled, it will override the automatic calculation.
tax
double
(optional)
The tax amount to be applied to the subtotal. If filled, it will override the automatic calculation. It's recommended to use the automatic tax calculation, but you can override if you see something's not right with it.
discount
double
(optional)
The discount amount to be applied to invoice
total
double
(optional)
The total amount to be applied to invoice. If filled, will override the automatic calculation which adds the tax (if any) to the subtotal and subtracts any discount.
notes
string
(optional)
Additional notes or comments you would like to include on the invoice (e.g. IBAN, SWIFT numbers, etc). Use \n
in this field to add a newline.
isPaid
bool
(optional)
Indicates whether the invoice is paid. Set this to false
to display a payment link on the invoice. Requires a paid plan and onboarding with the payment processor.
Response Body Parameters
If the API returns a success code (200)
The API will return a response of content-type application/pdf
that can be saved as file type PDF. See above examples for correct handling of response in your preferred language.
If the API returns a failure code (400-500)
The API will return a response of type JSON with some informative parameters.
statusCode
int
The status code. See Response Status Codes below for explanations of each code.
usage
double
The number of usage calls made for the current billing period
error
string
The error message
{
"statusCode": 429,
"usage": 10,
"error": "You have reached the monthly request limit for the Free plan. Upgrade to a paid plan to extend your monthly limit."
}
Response Status Codes
Code | Message |
---|---|
200 |
Success. |
400 |
Something is wrong with the request parameters. |
401 |
Unauthorized request. Check your API key. |
429 |
Too many requests or subscription request limit reached. |
500 |
Something went wrong on our side and we've been notified. |
Rate Limits
We enforce a rate limit of 10 API requests per minute. This can be increased on request. The free plan has a monthly limit which if reached, the API will return a status 429 code. The standard plan has no limit. You can track your usage via the Invoices page.
Client Library Downloads
Nuget
Check out our Nuget package here.