Estimates
Convert estimate to invoice
Creates a new customer invoice based on the estimate. The original estimate is preserved and links back to the new invoice via the conversion. Draft estimates cannot be converted.
POST
/
v1
/
estimates
/
{estimateId}
/
convert-to-invoice
Convert estimate to invoice
curl --request POST \
--url https://api.infinity.swiss/v1/estimates/{estimateId}/convert-to-invoice \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"openingDate": "2023-12-25",
"isDraft": true
}
'import requests
url = "https://api.infinity.swiss/v1/estimates/{estimateId}/convert-to-invoice"
payload = {
"openingDate": "2023-12-25",
"isDraft": True
}
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({openingDate: '2023-12-25', isDraft: true})
};
fetch('https://api.infinity.swiss/v1/estimates/{estimateId}/convert-to-invoice', 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/estimates/{estimateId}/convert-to-invoice",
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([
'openingDate' => '2023-12-25',
'isDraft' => true
]),
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/estimates/{estimateId}/convert-to-invoice"
payload := strings.NewReader("{\n \"openingDate\": \"2023-12-25\",\n \"isDraft\": true\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/estimates/{estimateId}/convert-to-invoice")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"openingDate\": \"2023-12-25\",\n \"isDraft\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infinity.swiss/v1/estimates/{estimateId}/convert-to-invoice")
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 \"openingDate\": \"2023-12-25\",\n \"isDraft\": true\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>",
"amountMode": "gross",
"language": "de",
"originalCurrency": "<string>",
"exchangeRate": 123,
"columns": [
"quantity"
],
"emailDeliveries": [
{
"recipientEmail": "jsmith@example.com",
"status": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
],
"publicPdfUrl": "<string>"
}
}{
"code": "<string>",
"invalidFields": [
"<string>"
]
}{
"code": "general/unauthorised"
}{
"code": "customer-invoice/not-found"
}Converting an estimate
Creates a new customer invoice that mirrors the estimate’s template, recipient, and positions. The original estimate is preserved and links back to the new invoice via itsinvoicesFromQuote field, so a single estimate can be converted multiple times if needed.
The request body is optional:
openingDate— the opening date for the new invoice. Defaults to the current date.isDraft— whether to create the new invoice as a draft. Defaults totrue.
Draft estimates cannot be converted. Issue (or accept) the estimate first.
Authorizations
API token for authentication. Obtain from your Infinity account settings.
Path Parameters
The id of the estimate to convert.
Body
application/json
Optional conversion overrides.
Response
The estimate was converted to an invoice.
The full representation of a customer invoice.
Show child attributes
Show child attributes
⌘I
Convert estimate to invoice
curl --request POST \
--url https://api.infinity.swiss/v1/estimates/{estimateId}/convert-to-invoice \
--header 'Content-Type: application/json' \
--header 'x-api-token: <api-key>' \
--data '
{
"openingDate": "2023-12-25",
"isDraft": true
}
'import requests
url = "https://api.infinity.swiss/v1/estimates/{estimateId}/convert-to-invoice"
payload = {
"openingDate": "2023-12-25",
"isDraft": True
}
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({openingDate: '2023-12-25', isDraft: true})
};
fetch('https://api.infinity.swiss/v1/estimates/{estimateId}/convert-to-invoice', 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/estimates/{estimateId}/convert-to-invoice",
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([
'openingDate' => '2023-12-25',
'isDraft' => true
]),
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/estimates/{estimateId}/convert-to-invoice"
payload := strings.NewReader("{\n \"openingDate\": \"2023-12-25\",\n \"isDraft\": true\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/estimates/{estimateId}/convert-to-invoice")
.header("x-api-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"openingDate\": \"2023-12-25\",\n \"isDraft\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infinity.swiss/v1/estimates/{estimateId}/convert-to-invoice")
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 \"openingDate\": \"2023-12-25\",\n \"isDraft\": true\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>",
"amountMode": "gross",
"language": "de",
"originalCurrency": "<string>",
"exchangeRate": 123,
"columns": [
"quantity"
],
"emailDeliveries": [
{
"recipientEmail": "jsmith@example.com",
"status": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
],
"publicPdfUrl": "<string>"
}
}{
"code": "<string>",
"invalidFields": [
"<string>"
]
}{
"code": "general/unauthorised"
}{
"code": "customer-invoice/not-found"
}