Create new invoice
curl --request POST \
--url https://api.example.com/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "draft",
"party_type": "receiver",
"due_date": "2024-04-01T00:00:00Z",
"currency": "CHF",
"iban": "CH93 0076 2011 6238 5295 7",
"customer_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Monthly services",
"name_from": "Sender Company AG",
"address_from": "Bahnhofstrasse 1",
"zip_from": "8001",
"city_from": "Zürich",
"country_from": "Switzerland",
"name_to": "Receiver GmbH",
"address_to": "Hauptstrasse 10",
"zip_to": "3000",
"city_to": "Bern",
"country_to": "Switzerland",
"shipping": 10,
"discount": 5,
"vat": 7.7,
"items": [
{
"title": "<string>",
"quantity": 123,
"unit_price": 123,
"description": "<string>"
}
],
"active": true,
"metadata": {
"department": "IT",
"project_code": "P123"
}
}
'import requests
url = "https://api.example.com/v1/invoices"
payload = {
"status": "draft",
"party_type": "receiver",
"due_date": "2024-04-01T00:00:00Z",
"currency": "CHF",
"iban": "CH93 0076 2011 6238 5295 7",
"customer_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Monthly services",
"name_from": "Sender Company AG",
"address_from": "Bahnhofstrasse 1",
"zip_from": "8001",
"city_from": "Zürich",
"country_from": "Switzerland",
"name_to": "Receiver GmbH",
"address_to": "Hauptstrasse 10",
"zip_to": "3000",
"city_to": "Bern",
"country_to": "Switzerland",
"shipping": 10,
"discount": 5,
"vat": 7.7,
"items": [
{
"title": "<string>",
"quantity": 123,
"unit_price": 123,
"description": "<string>"
}
],
"active": True,
"metadata": {
"department": "IT",
"project_code": "P123"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
status: 'draft',
party_type: 'receiver',
due_date: '2024-04-01T00:00:00Z',
currency: 'CHF',
iban: 'CH93 0076 2011 6238 5295 7',
customer_id: '550e8400-e29b-41d4-a716-446655440000',
description: 'Monthly services',
name_from: 'Sender Company AG',
address_from: 'Bahnhofstrasse 1',
zip_from: '8001',
city_from: 'Zürich',
country_from: 'Switzerland',
name_to: 'Receiver GmbH',
address_to: 'Hauptstrasse 10',
zip_to: '3000',
city_to: 'Bern',
country_to: 'Switzerland',
shipping: 10,
discount: 5,
vat: 7.7,
items: [{title: '<string>', quantity: 123, unit_price: 123, description: '<string>'}],
active: true,
metadata: {department: 'IT', project_code: 'P123'}
})
};
fetch('https://api.example.com/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.example.com/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([
'status' => 'draft',
'party_type' => 'receiver',
'due_date' => '2024-04-01T00:00:00Z',
'currency' => 'CHF',
'iban' => 'CH93 0076 2011 6238 5295 7',
'customer_id' => '550e8400-e29b-41d4-a716-446655440000',
'description' => 'Monthly services',
'name_from' => 'Sender Company AG',
'address_from' => 'Bahnhofstrasse 1',
'zip_from' => '8001',
'city_from' => 'Zürich',
'country_from' => 'Switzerland',
'name_to' => 'Receiver GmbH',
'address_to' => 'Hauptstrasse 10',
'zip_to' => '3000',
'city_to' => 'Bern',
'country_to' => 'Switzerland',
'shipping' => 10,
'discount' => 5,
'vat' => 7.7,
'items' => [
[
'title' => '<string>',
'quantity' => 123,
'unit_price' => 123,
'description' => '<string>'
]
],
'active' => true,
'metadata' => [
'department' => 'IT',
'project_code' => 'P123'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/v1/invoices"
payload := strings.NewReader("{\n \"status\": \"draft\",\n \"party_type\": \"receiver\",\n \"due_date\": \"2024-04-01T00:00:00Z\",\n \"currency\": \"CHF\",\n \"iban\": \"CH93 0076 2011 6238 5295 7\",\n \"customer_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"description\": \"Monthly services\",\n \"name_from\": \"Sender Company AG\",\n \"address_from\": \"Bahnhofstrasse 1\",\n \"zip_from\": \"8001\",\n \"city_from\": \"Zürich\",\n \"country_from\": \"Switzerland\",\n \"name_to\": \"Receiver GmbH\",\n \"address_to\": \"Hauptstrasse 10\",\n \"zip_to\": \"3000\",\n \"city_to\": \"Bern\",\n \"country_to\": \"Switzerland\",\n \"shipping\": 10,\n \"discount\": 5,\n \"vat\": 7.7,\n \"items\": [\n {\n \"title\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"description\": \"<string>\"\n }\n ],\n \"active\": true,\n \"metadata\": {\n \"department\": \"IT\",\n \"project_code\": \"P123\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/v1/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"draft\",\n \"party_type\": \"receiver\",\n \"due_date\": \"2024-04-01T00:00:00Z\",\n \"currency\": \"CHF\",\n \"iban\": \"CH93 0076 2011 6238 5295 7\",\n \"customer_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"description\": \"Monthly services\",\n \"name_from\": \"Sender Company AG\",\n \"address_from\": \"Bahnhofstrasse 1\",\n \"zip_from\": \"8001\",\n \"city_from\": \"Zürich\",\n \"country_from\": \"Switzerland\",\n \"name_to\": \"Receiver GmbH\",\n \"address_to\": \"Hauptstrasse 10\",\n \"zip_to\": \"3000\",\n \"city_to\": \"Bern\",\n \"country_to\": \"Switzerland\",\n \"shipping\": 10,\n \"discount\": 5,\n \"vat\": 7.7,\n \"items\": [\n {\n \"title\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"description\": \"<string>\"\n }\n ],\n \"active\": true,\n \"metadata\": {\n \"department\": \"IT\",\n \"project_code\": \"P123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"draft\",\n \"party_type\": \"receiver\",\n \"due_date\": \"2024-04-01T00:00:00Z\",\n \"currency\": \"CHF\",\n \"iban\": \"CH93 0076 2011 6238 5295 7\",\n \"customer_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"description\": \"Monthly services\",\n \"name_from\": \"Sender Company AG\",\n \"address_from\": \"Bahnhofstrasse 1\",\n \"zip_from\": \"8001\",\n \"city_from\": \"Zürich\",\n \"country_from\": \"Switzerland\",\n \"name_to\": \"Receiver GmbH\",\n \"address_to\": \"Hauptstrasse 10\",\n \"zip_to\": \"3000\",\n \"city_to\": \"Bern\",\n \"country_to\": \"Switzerland\",\n \"shipping\": 10,\n \"discount\": 5,\n \"vat\": 7.7,\n \"items\": [\n {\n \"title\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"description\": \"<string>\"\n }\n ],\n \"active\": true,\n \"metadata\": {\n \"department\": \"IT\",\n \"project_code\": \"P123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"invoice": "<unknown>",
"items": [
"<unknown>"
]
}{
"code": "invalid_input",
"message": "Invalid input data",
"details": {}
}{
"code": "invalid_input",
"message": "Invalid input data",
"details": {}
}{
"code": "invalid_input",
"message": "Invalid input data",
"details": {}
}{
"code": "invalid_input",
"message": "Invalid input data",
"details": {}
}Management
Create new invoice
Create a new invoice with automatic numbering and PDF generation
POST
/
v1
/
invoices
Create new invoice
curl --request POST \
--url https://api.example.com/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "draft",
"party_type": "receiver",
"due_date": "2024-04-01T00:00:00Z",
"currency": "CHF",
"iban": "CH93 0076 2011 6238 5295 7",
"customer_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Monthly services",
"name_from": "Sender Company AG",
"address_from": "Bahnhofstrasse 1",
"zip_from": "8001",
"city_from": "Zürich",
"country_from": "Switzerland",
"name_to": "Receiver GmbH",
"address_to": "Hauptstrasse 10",
"zip_to": "3000",
"city_to": "Bern",
"country_to": "Switzerland",
"shipping": 10,
"discount": 5,
"vat": 7.7,
"items": [
{
"title": "<string>",
"quantity": 123,
"unit_price": 123,
"description": "<string>"
}
],
"active": true,
"metadata": {
"department": "IT",
"project_code": "P123"
}
}
'import requests
url = "https://api.example.com/v1/invoices"
payload = {
"status": "draft",
"party_type": "receiver",
"due_date": "2024-04-01T00:00:00Z",
"currency": "CHF",
"iban": "CH93 0076 2011 6238 5295 7",
"customer_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Monthly services",
"name_from": "Sender Company AG",
"address_from": "Bahnhofstrasse 1",
"zip_from": "8001",
"city_from": "Zürich",
"country_from": "Switzerland",
"name_to": "Receiver GmbH",
"address_to": "Hauptstrasse 10",
"zip_to": "3000",
"city_to": "Bern",
"country_to": "Switzerland",
"shipping": 10,
"discount": 5,
"vat": 7.7,
"items": [
{
"title": "<string>",
"quantity": 123,
"unit_price": 123,
"description": "<string>"
}
],
"active": True,
"metadata": {
"department": "IT",
"project_code": "P123"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
status: 'draft',
party_type: 'receiver',
due_date: '2024-04-01T00:00:00Z',
currency: 'CHF',
iban: 'CH93 0076 2011 6238 5295 7',
customer_id: '550e8400-e29b-41d4-a716-446655440000',
description: 'Monthly services',
name_from: 'Sender Company AG',
address_from: 'Bahnhofstrasse 1',
zip_from: '8001',
city_from: 'Zürich',
country_from: 'Switzerland',
name_to: 'Receiver GmbH',
address_to: 'Hauptstrasse 10',
zip_to: '3000',
city_to: 'Bern',
country_to: 'Switzerland',
shipping: 10,
discount: 5,
vat: 7.7,
items: [{title: '<string>', quantity: 123, unit_price: 123, description: '<string>'}],
active: true,
metadata: {department: 'IT', project_code: 'P123'}
})
};
fetch('https://api.example.com/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.example.com/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([
'status' => 'draft',
'party_type' => 'receiver',
'due_date' => '2024-04-01T00:00:00Z',
'currency' => 'CHF',
'iban' => 'CH93 0076 2011 6238 5295 7',
'customer_id' => '550e8400-e29b-41d4-a716-446655440000',
'description' => 'Monthly services',
'name_from' => 'Sender Company AG',
'address_from' => 'Bahnhofstrasse 1',
'zip_from' => '8001',
'city_from' => 'Zürich',
'country_from' => 'Switzerland',
'name_to' => 'Receiver GmbH',
'address_to' => 'Hauptstrasse 10',
'zip_to' => '3000',
'city_to' => 'Bern',
'country_to' => 'Switzerland',
'shipping' => 10,
'discount' => 5,
'vat' => 7.7,
'items' => [
[
'title' => '<string>',
'quantity' => 123,
'unit_price' => 123,
'description' => '<string>'
]
],
'active' => true,
'metadata' => [
'department' => 'IT',
'project_code' => 'P123'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.example.com/v1/invoices"
payload := strings.NewReader("{\n \"status\": \"draft\",\n \"party_type\": \"receiver\",\n \"due_date\": \"2024-04-01T00:00:00Z\",\n \"currency\": \"CHF\",\n \"iban\": \"CH93 0076 2011 6238 5295 7\",\n \"customer_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"description\": \"Monthly services\",\n \"name_from\": \"Sender Company AG\",\n \"address_from\": \"Bahnhofstrasse 1\",\n \"zip_from\": \"8001\",\n \"city_from\": \"Zürich\",\n \"country_from\": \"Switzerland\",\n \"name_to\": \"Receiver GmbH\",\n \"address_to\": \"Hauptstrasse 10\",\n \"zip_to\": \"3000\",\n \"city_to\": \"Bern\",\n \"country_to\": \"Switzerland\",\n \"shipping\": 10,\n \"discount\": 5,\n \"vat\": 7.7,\n \"items\": [\n {\n \"title\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"description\": \"<string>\"\n }\n ],\n \"active\": true,\n \"metadata\": {\n \"department\": \"IT\",\n \"project_code\": \"P123\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/v1/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"draft\",\n \"party_type\": \"receiver\",\n \"due_date\": \"2024-04-01T00:00:00Z\",\n \"currency\": \"CHF\",\n \"iban\": \"CH93 0076 2011 6238 5295 7\",\n \"customer_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"description\": \"Monthly services\",\n \"name_from\": \"Sender Company AG\",\n \"address_from\": \"Bahnhofstrasse 1\",\n \"zip_from\": \"8001\",\n \"city_from\": \"Zürich\",\n \"country_from\": \"Switzerland\",\n \"name_to\": \"Receiver GmbH\",\n \"address_to\": \"Hauptstrasse 10\",\n \"zip_to\": \"3000\",\n \"city_to\": \"Bern\",\n \"country_to\": \"Switzerland\",\n \"shipping\": 10,\n \"discount\": 5,\n \"vat\": 7.7,\n \"items\": [\n {\n \"title\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"description\": \"<string>\"\n }\n ],\n \"active\": true,\n \"metadata\": {\n \"department\": \"IT\",\n \"project_code\": \"P123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"draft\",\n \"party_type\": \"receiver\",\n \"due_date\": \"2024-04-01T00:00:00Z\",\n \"currency\": \"CHF\",\n \"iban\": \"CH93 0076 2011 6238 5295 7\",\n \"customer_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"description\": \"Monthly services\",\n \"name_from\": \"Sender Company AG\",\n \"address_from\": \"Bahnhofstrasse 1\",\n \"zip_from\": \"8001\",\n \"city_from\": \"Zürich\",\n \"country_from\": \"Switzerland\",\n \"name_to\": \"Receiver GmbH\",\n \"address_to\": \"Hauptstrasse 10\",\n \"zip_to\": \"3000\",\n \"city_to\": \"Bern\",\n \"country_to\": \"Switzerland\",\n \"shipping\": 10,\n \"discount\": 5,\n \"vat\": 7.7,\n \"items\": [\n {\n \"title\": \"<string>\",\n \"quantity\": 123,\n \"unit_price\": 123,\n \"description\": \"<string>\"\n }\n ],\n \"active\": true,\n \"metadata\": {\n \"department\": \"IT\",\n \"project_code\": \"P123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"invoice": "<unknown>",
"items": [
"<unknown>"
]
}{
"code": "invalid_input",
"message": "Invalid input data",
"details": {}
}{
"code": "invalid_input",
"message": "Invalid input data",
"details": {}
}{
"code": "invalid_input",
"message": "Invalid input data",
"details": {}
}{
"code": "invalid_input",
"message": "Invalid input data",
"details": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Available options:
draft, pending, paid, sent, overdue Example:
"draft"
Available options:
receiver, sender Example:
"receiver"
Example:
"2024-04-01T00:00:00Z"
Required string length:
3Example:
"CHF"
Example:
"CH93 0076 2011 6238 5295 7"
Example:
"550e8400-e29b-41d4-a716-446655440000"
Example:
"Monthly services"
Example:
"Sender Company AG"
Example:
"Bahnhofstrasse 1"
Example:
"8001"
Example:
"Zürich"
Example:
"Switzerland"
Example:
"Receiver GmbH"
Example:
"Hauptstrasse 10"
Example:
"3000"
Example:
"Bern"
Example:
"Switzerland"
Example:
10
Required range:
0 <= x <= 100Example:
5
Required range:
0 <= x <= 100Example:
7.7
Show child attributes
Show child attributes
Example:
{
"department": "IT",
"project_code": "P123"
}
⌘I