curl --request POST \
--url https://api.heffl.com/api/v1/invoices \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"clientId": "<string>",
"date": "2023-11-07T05:31:56Z",
"dueDate": "2023-11-07T05:31:56Z",
"lineItems": [
{
"name": "<string>",
"productId": "<string>",
"quantity": 0,
"price": 0,
"description": "<string>",
"taxRateId": "<string>",
"discount": 0,
"discountType": "fixed",
"buyPrice": 0
}
],
"isInclusiveTax": false,
"status": "DRAFT",
"contactId": "<string>",
"subject": "<string>",
"notes": "<string>",
"salesPersonId": "<string>",
"templateId": "<string>",
"tags": []
}
'import requests
url = "https://api.heffl.com/api/v1/invoices"
payload = {
"clientId": "<string>",
"date": "2023-11-07T05:31:56Z",
"dueDate": "2023-11-07T05:31:56Z",
"lineItems": [
{
"name": "<string>",
"productId": "<string>",
"quantity": 0,
"price": 0,
"description": "<string>",
"taxRateId": "<string>",
"discount": 0,
"discountType": "fixed",
"buyPrice": 0
}
],
"isInclusiveTax": False,
"status": "DRAFT",
"contactId": "<string>",
"subject": "<string>",
"notes": "<string>",
"salesPersonId": "<string>",
"templateId": "<string>",
"tags": []
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
clientId: '<string>',
date: '2023-11-07T05:31:56Z',
dueDate: '2023-11-07T05:31:56Z',
lineItems: [
{
name: '<string>',
productId: '<string>',
quantity: 0,
price: 0,
description: '<string>',
taxRateId: '<string>',
discount: 0,
discountType: 'fixed',
buyPrice: 0
}
],
isInclusiveTax: false,
status: 'DRAFT',
contactId: '<string>',
subject: '<string>',
notes: '<string>',
salesPersonId: '<string>',
templateId: '<string>',
tags: []
})
};
fetch('https://api.heffl.com/api/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.heffl.com/api/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'clientId' => '<string>',
'date' => '2023-11-07T05:31:56Z',
'dueDate' => '2023-11-07T05:31:56Z',
'lineItems' => [
[
'name' => '<string>',
'productId' => '<string>',
'quantity' => 0,
'price' => 0,
'description' => '<string>',
'taxRateId' => '<string>',
'discount' => 0,
'discountType' => 'fixed',
'buyPrice' => 0
]
],
'isInclusiveTax' => false,
'status' => 'DRAFT',
'contactId' => '<string>',
'subject' => '<string>',
'notes' => '<string>',
'salesPersonId' => '<string>',
'templateId' => '<string>',
'tags' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.heffl.com/api/v1/invoices"
payload := strings.NewReader("{\n \"clientId\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"lineItems\": [\n {\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 0,\n \"price\": 0,\n \"description\": \"<string>\",\n \"taxRateId\": \"<string>\",\n \"discount\": 0,\n \"discountType\": \"fixed\",\n \"buyPrice\": 0\n }\n ],\n \"isInclusiveTax\": false,\n \"status\": \"DRAFT\",\n \"contactId\": \"<string>\",\n \"subject\": \"<string>\",\n \"notes\": \"<string>\",\n \"salesPersonId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"tags\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.heffl.com/api/v1/invoices")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"clientId\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"lineItems\": [\n {\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 0,\n \"price\": 0,\n \"description\": \"<string>\",\n \"taxRateId\": \"<string>\",\n \"discount\": 0,\n \"discountType\": \"fixed\",\n \"buyPrice\": 0\n }\n ],\n \"isInclusiveTax\": false,\n \"status\": \"DRAFT\",\n \"contactId\": \"<string>\",\n \"subject\": \"<string>\",\n \"notes\": \"<string>\",\n \"salesPersonId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"tags\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heffl.com/api/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"clientId\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"lineItems\": [\n {\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 0,\n \"price\": 0,\n \"description\": \"<string>\",\n \"taxRateId\": \"<string>\",\n \"discount\": 0,\n \"discountType\": \"fixed\",\n \"buyPrice\": 0\n }\n ],\n \"isInclusiveTax\": false,\n \"status\": \"DRAFT\",\n \"contactId\": \"<string>\",\n \"subject\": \"<string>\",\n \"notes\": \"<string>\",\n \"salesPersonId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"tags\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"number": "<string>",
"date": "2023-11-07T05:31:56Z",
"dueDate": "2023-11-07T05:31:56Z",
"status": "<string>",
"currency": "<string>",
"isInclusiveTax": true,
"subTotal": 123,
"taxTotal": 123,
"discountTotal": 123,
"total": 123,
"pendingTotal": 123,
"paidTotal": 123,
"lineItems": [
{
"name": "<string>",
"quantity": 123,
"price": 123,
"tax": 123,
"discount": 123,
"buyPrice": 123,
"amount": 123,
"taxAmount": 123,
"discountAmount": 123,
"description": "<string>",
"productId": 123
}
],
"createdAt": "2023-11-07T05:31:56Z",
"clientId": "<string>",
"contactId": "<string>",
"subject": "<string>",
"notes": "<string>",
"salesPersonId": 123,
"customFields": {}
}Create a new invoice
Creates a new invoice with line items. Returns the invoice with calculated totals.
curl --request POST \
--url https://api.heffl.com/api/v1/invoices \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"clientId": "<string>",
"date": "2023-11-07T05:31:56Z",
"dueDate": "2023-11-07T05:31:56Z",
"lineItems": [
{
"name": "<string>",
"productId": "<string>",
"quantity": 0,
"price": 0,
"description": "<string>",
"taxRateId": "<string>",
"discount": 0,
"discountType": "fixed",
"buyPrice": 0
}
],
"isInclusiveTax": false,
"status": "DRAFT",
"contactId": "<string>",
"subject": "<string>",
"notes": "<string>",
"salesPersonId": "<string>",
"templateId": "<string>",
"tags": []
}
'import requests
url = "https://api.heffl.com/api/v1/invoices"
payload = {
"clientId": "<string>",
"date": "2023-11-07T05:31:56Z",
"dueDate": "2023-11-07T05:31:56Z",
"lineItems": [
{
"name": "<string>",
"productId": "<string>",
"quantity": 0,
"price": 0,
"description": "<string>",
"taxRateId": "<string>",
"discount": 0,
"discountType": "fixed",
"buyPrice": 0
}
],
"isInclusiveTax": False,
"status": "DRAFT",
"contactId": "<string>",
"subject": "<string>",
"notes": "<string>",
"salesPersonId": "<string>",
"templateId": "<string>",
"tags": []
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
clientId: '<string>',
date: '2023-11-07T05:31:56Z',
dueDate: '2023-11-07T05:31:56Z',
lineItems: [
{
name: '<string>',
productId: '<string>',
quantity: 0,
price: 0,
description: '<string>',
taxRateId: '<string>',
discount: 0,
discountType: 'fixed',
buyPrice: 0
}
],
isInclusiveTax: false,
status: 'DRAFT',
contactId: '<string>',
subject: '<string>',
notes: '<string>',
salesPersonId: '<string>',
templateId: '<string>',
tags: []
})
};
fetch('https://api.heffl.com/api/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.heffl.com/api/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'clientId' => '<string>',
'date' => '2023-11-07T05:31:56Z',
'dueDate' => '2023-11-07T05:31:56Z',
'lineItems' => [
[
'name' => '<string>',
'productId' => '<string>',
'quantity' => 0,
'price' => 0,
'description' => '<string>',
'taxRateId' => '<string>',
'discount' => 0,
'discountType' => 'fixed',
'buyPrice' => 0
]
],
'isInclusiveTax' => false,
'status' => 'DRAFT',
'contactId' => '<string>',
'subject' => '<string>',
'notes' => '<string>',
'salesPersonId' => '<string>',
'templateId' => '<string>',
'tags' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.heffl.com/api/v1/invoices"
payload := strings.NewReader("{\n \"clientId\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"lineItems\": [\n {\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 0,\n \"price\": 0,\n \"description\": \"<string>\",\n \"taxRateId\": \"<string>\",\n \"discount\": 0,\n \"discountType\": \"fixed\",\n \"buyPrice\": 0\n }\n ],\n \"isInclusiveTax\": false,\n \"status\": \"DRAFT\",\n \"contactId\": \"<string>\",\n \"subject\": \"<string>\",\n \"notes\": \"<string>\",\n \"salesPersonId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"tags\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.heffl.com/api/v1/invoices")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"clientId\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"lineItems\": [\n {\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 0,\n \"price\": 0,\n \"description\": \"<string>\",\n \"taxRateId\": \"<string>\",\n \"discount\": 0,\n \"discountType\": \"fixed\",\n \"buyPrice\": 0\n }\n ],\n \"isInclusiveTax\": false,\n \"status\": \"DRAFT\",\n \"contactId\": \"<string>\",\n \"subject\": \"<string>\",\n \"notes\": \"<string>\",\n \"salesPersonId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"tags\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.heffl.com/api/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"clientId\": \"<string>\",\n \"date\": \"2023-11-07T05:31:56Z\",\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"lineItems\": [\n {\n \"name\": \"<string>\",\n \"productId\": \"<string>\",\n \"quantity\": 0,\n \"price\": 0,\n \"description\": \"<string>\",\n \"taxRateId\": \"<string>\",\n \"discount\": 0,\n \"discountType\": \"fixed\",\n \"buyPrice\": 0\n }\n ],\n \"isInclusiveTax\": false,\n \"status\": \"DRAFT\",\n \"contactId\": \"<string>\",\n \"subject\": \"<string>\",\n \"notes\": \"<string>\",\n \"salesPersonId\": \"<string>\",\n \"templateId\": \"<string>\",\n \"tags\": []\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"number": "<string>",
"date": "2023-11-07T05:31:56Z",
"dueDate": "2023-11-07T05:31:56Z",
"status": "<string>",
"currency": "<string>",
"isInclusiveTax": true,
"subTotal": 123,
"taxTotal": 123,
"discountTotal": 123,
"total": 123,
"pendingTotal": 123,
"paidTotal": 123,
"lineItems": [
{
"name": "<string>",
"quantity": 123,
"price": 123,
"tax": 123,
"discount": 123,
"buyPrice": 123,
"amount": 123,
"taxAmount": 123,
"discountAmount": 123,
"description": "<string>",
"productId": 123
}
],
"createdAt": "2023-11-07T05:31:56Z",
"clientId": "<string>",
"contactId": "<string>",
"subject": "<string>",
"notes": "<string>",
"salesPersonId": 123,
"customFields": {}
}Authorizations
API key for authentication. Get yours at app.heffl.com/settings/developers
Body
Client public ID (required)
Invoice date
Due date
Invoice line items
1Show child attributes
Show child attributes
Whether prices include tax
Invoice status (DRAFT or SENT)
DRAFT, SENT Contact public ID
Invoice subject
Invoice notes
Sales person user public ID
Document template public ID. If not provided, uses the team's default invoice template.
Tag IDs to associate with the invoice
Response
OK
Invoice public ID
Auto-generated invoice number
Invoice date
Invoice due date
Invoice status
Currency code
Whether prices include tax
Subtotal before tax
Total tax amount
Total discount amount
Grand total
Amount pending
Total amount paid
Invoice line items
Show child attributes
Show child attributes
When the invoice was created
Client public ID
Contact public ID
Invoice subject
Invoice notes
Sales person user ID
Custom field values
Show child attributes
Show child attributes