Invoices
List invoice PDF attachments
List invoice PDF attachments through the public API.
GET
/
v1
/
invoices
/
{invoiceId}
/
pdf-attachments
List invoice PDF attachments
curl --request GET \
--url https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments \
--header 'x-api-token: <api-key>'import requests
url = "https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments"
headers = {"x-api-token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-token': '<api-key>'}};
fetch('https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments', 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}/pdf-attachments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments")
.header("x-api-token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"attachments": [
{
"id": "<string>",
"url": "<string>",
"name": "<string>",
"type": "application/pdf",
"size": 123
}
]
}{
"code": "general/unauthorised"
}{
"code": "rest-api/insufficient-scope"
}{
"code": "customer-invoices/not-found"
}Attachments are returned in upload order, including files added through the invoice editor. Each attachment includes its id, URL, original filename, content type, and size in bytes.
Their pages appear after the invoice and before the QR payment slip in the generated PDF.
⌘I
List invoice PDF attachments
curl --request GET \
--url https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments \
--header 'x-api-token: <api-key>'import requests
url = "https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments"
headers = {"x-api-token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-token': '<api-key>'}};
fetch('https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments', 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}/pdf-attachments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments")
.header("x-api-token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infinity.swiss/v1/invoices/{invoiceId}/pdf-attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-token"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"attachments": [
{
"id": "<string>",
"url": "<string>",
"name": "<string>",
"type": "application/pdf",
"size": 123
}
]
}{
"code": "general/unauthorised"
}{
"code": "rest-api/insufficient-scope"
}{
"code": "customer-invoices/not-found"
}