Invoices
Annul invoice
Annuls a posted invoice as of the given date, reversing its transactions.
POST
/
v1
/
invoices
/
{invoiceId}
/
annulment
Annul invoice
curl --request POST \
--url https://api.infinity.swiss/v1/invoices/{invoiceId}/annulment \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"atDate": "2023-12-25"
}
'import requests
url = "https://api.infinity.swiss/v1/invoices/{invoiceId}/annulment"
payload = { "atDate": "2023-12-25" }
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({atDate: '2023-12-25'})
};
fetch('https://api.infinity.swiss/v1/invoices/{invoiceId}/annulment', 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.infinity.swiss/v1/invoices/{invoiceId}/annulment",
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([
'atDate' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <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.infinity.swiss/v1/invoices/{invoiceId}/annulment"
payload := strings.NewReader("{\n \"atDate\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<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.infinity.swiss/v1/invoices/{invoiceId}/annulment")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"atDate\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infinity.swiss/v1/invoices/{invoiceId}/annulment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"atDate\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"invoice": {
"id": "<string>",
"isDraft": true,
"number": "<string>",
"organisation": "<string>",
"template": "<string>",
"openingDate": "2023-12-25",
"dueDate": "2023-12-25",
"positions": [
{
"type": "product",
"name": "<string>",
"singleAmount": 12000,
"quantity": 2,
"contraAccount": 5499,
"id": "<string>",
"unit": "<string>",
"taxCode": "",
"articleNumber": "<string>",
"description": "<string>",
"date": "<string>",
"discountRate": 50,
"customTextColumns": {
"customTextColumn1": "<string>",
"customTextColumn2": "<string>",
"customTextColumn3": "<string>"
},
"totalAmount": 123,
"vatDebt": 123,
"originalCurrency": "<string>",
"exchangeRate": 123
}
],
"totalAmount": 123,
"totalNetAmount": 123,
"totalVatDebt": 123,
"isQrInvoice": true,
"totalAmountPaid": 123,
"totalRestAmount": 123,
"isPaid": true,
"isOverpaid": true,
"isAnnulled": true,
"recipient": "<string>",
"customRecipientText": "<string>",
"title": "<string>",
"payableInDays": 123,
"introductoryText": "<string>",
"closingText": "<string>",
"originalCurrency": "<string>",
"exchangeRate": 123,
"columns": [],
"emailDeliveries": [
{
"recipientEmail": "jsmith@example.com",
"status": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
],
"publicPdfUrl": "<string>"
}
}{
"code": "<string>",
"invalidFields": [
"<string>"
]
}{
"code": "general/unauthorised"
}{
"code": "<string>"
}{
"code": "customer-invoice/not-found"
}Annulling an invoice
Annulment reverses a posted invoice without deleting it. The reversing transactions are dated onatDate, which must fall within an editable fiscal year and VAT period.
Use annulment (rather than deletion) when the invoice has already been issued to the customer or when its fiscal year is closed.Authorizations
API token for authentication. Obtain from your Infinity account settings.
Path Parameters
The id of the invoice.
Body
application/json
The date of the annulment.
Request body for annulling an invoice.
The effective annulment date in YYYY-MM-DD format. Used to date the reversing transactions.
Response
The invoice was annulled successfully.
The full representation of a customer invoice.
Show child attributes
Show child attributes
Previous
Undo annulmentReverses a previous annulment and restores the invoice to its prior state.
Next
⌘I
Annul invoice
curl --request POST \
--url https://api.infinity.swiss/v1/invoices/{invoiceId}/annulment \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"atDate": "2023-12-25"
}
'import requests
url = "https://api.infinity.swiss/v1/invoices/{invoiceId}/annulment"
payload = { "atDate": "2023-12-25" }
headers = {
"x-api-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({atDate: '2023-12-25'})
};
fetch('https://api.infinity.swiss/v1/invoices/{invoiceId}/annulment', 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.infinity.swiss/v1/invoices/{invoiceId}/annulment",
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([
'atDate' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-token: <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.infinity.swiss/v1/invoices/{invoiceId}/annulment"
payload := strings.NewReader("{\n \"atDate\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-token", "<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.infinity.swiss/v1/invoices/{invoiceId}/annulment")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"atDate\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infinity.swiss/v1/invoices/{invoiceId}/annulment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"atDate\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"invoice": {
"id": "<string>",
"isDraft": true,
"number": "<string>",
"organisation": "<string>",
"template": "<string>",
"openingDate": "2023-12-25",
"dueDate": "2023-12-25",
"positions": [
{
"type": "product",
"name": "<string>",
"singleAmount": 12000,
"quantity": 2,
"contraAccount": 5499,
"id": "<string>",
"unit": "<string>",
"taxCode": "",
"articleNumber": "<string>",
"description": "<string>",
"date": "<string>",
"discountRate": 50,
"customTextColumns": {
"customTextColumn1": "<string>",
"customTextColumn2": "<string>",
"customTextColumn3": "<string>"
},
"totalAmount": 123,
"vatDebt": 123,
"originalCurrency": "<string>",
"exchangeRate": 123
}
],
"totalAmount": 123,
"totalNetAmount": 123,
"totalVatDebt": 123,
"isQrInvoice": true,
"totalAmountPaid": 123,
"totalRestAmount": 123,
"isPaid": true,
"isOverpaid": true,
"isAnnulled": true,
"recipient": "<string>",
"customRecipientText": "<string>",
"title": "<string>",
"payableInDays": 123,
"introductoryText": "<string>",
"closingText": "<string>",
"originalCurrency": "<string>",
"exchangeRate": 123,
"columns": [],
"emailDeliveries": [
{
"recipientEmail": "jsmith@example.com",
"status": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
],
"publicPdfUrl": "<string>"
}
}{
"code": "<string>",
"invalidFields": [
"<string>"
]
}{
"code": "general/unauthorised"
}{
"code": "<string>"
}{
"code": "customer-invoice/not-found"
}