Delete a sales invoice
curl --request POST \
--url https://api.altera.co/sales/delete \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"invoiceId": 12345,
"reason": "Removing a QA test draft"
}
'import requests
url = "https://api.altera.co/sales/delete"
payload = {
"invoiceId": 12345,
"reason": "Removing a QA test draft"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({invoiceId: 12345, reason: 'Removing a QA test draft'})
};
fetch('https://api.altera.co/sales/delete', 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.altera.co/sales/delete",
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([
'invoiceId' => 12345,
'reason' => 'Removing a QA test draft'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.altera.co/sales/delete"
payload := strings.NewReader("{\n \"invoiceId\": 12345,\n \"reason\": \"Removing a QA test draft\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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.altera.co/sales/delete")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"invoiceId\": 12345,\n \"reason\": \"Removing a QA test draft\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.altera.co/sales/delete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invoiceId\": 12345,\n \"reason\": \"Removing a QA test draft\"\n}"
response = http.request(request)
puts response.read_body{
"result": "OK",
"data": {
"fullDelete": 1,
"softDelete": 0,
"counterRollbackResult": "NOK"
}
}{
"result": "Error",
"errorMessage": "This tag cannot be deleted, it has been used in at least one invoice. You can disable it so it won't appear on the suggestion lists.",
"errorMessagePL": "Ta kategoria nie może zostać usunięta ponieważ została użyta w przynajmniej jednej fakturze. Możesz ją zablokować aby nie pojawiała się na liście sugerowanych."
}{
"result": "Error",
"errorCode": "KEY_EXPIRED",
"errorMessage": "API key has expired"
}{
"result": "Error",
"errorMessage": "This tag cannot be deleted, it has been used in at least one invoice. You can disable it so it won't appear on the suggestion lists.",
"errorMessagePL": "Ta kategoria nie może zostać usunięta ponieważ została użyta w przynajmniej jednej fakturze. Możesz ją zablokować aby nie pojawiała się na liście sugerowanych."
}Sales
Delete a sales invoice
Existing removal endpoint, including test drafts. DRAFT is deleted permanently; an eligible issued invoice is soft-deleted. Related documents, read-only or accounting-approved documents, and invoices submitted to or accepted by KSeF cannot be deleted. fullDelete and softDelete count removed invoice records. This endpoint uses POST, not DELETE.
POST
/
sales
/
delete
Delete a sales invoice
curl --request POST \
--url https://api.altera.co/sales/delete \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"invoiceId": 12345,
"reason": "Removing a QA test draft"
}
'import requests
url = "https://api.altera.co/sales/delete"
payload = {
"invoiceId": 12345,
"reason": "Removing a QA test draft"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({invoiceId: 12345, reason: 'Removing a QA test draft'})
};
fetch('https://api.altera.co/sales/delete', 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.altera.co/sales/delete",
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([
'invoiceId' => 12345,
'reason' => 'Removing a QA test draft'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.altera.co/sales/delete"
payload := strings.NewReader("{\n \"invoiceId\": 12345,\n \"reason\": \"Removing a QA test draft\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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.altera.co/sales/delete")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"invoiceId\": 12345,\n \"reason\": \"Removing a QA test draft\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.altera.co/sales/delete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"invoiceId\": 12345,\n \"reason\": \"Removing a QA test draft\"\n}"
response = http.request(request)
puts response.read_body{
"result": "OK",
"data": {
"fullDelete": 1,
"softDelete": 0,
"counterRollbackResult": "NOK"
}
}{
"result": "Error",
"errorMessage": "This tag cannot be deleted, it has been used in at least one invoice. You can disable it so it won't appear on the suggestion lists.",
"errorMessagePL": "Ta kategoria nie może zostać usunięta ponieważ została użyta w przynajmniej jednej fakturze. Możesz ją zablokować aby nie pojawiała się na liście sugerowanych."
}{
"result": "Error",
"errorCode": "KEY_EXPIRED",
"errorMessage": "API key has expired"
}{
"result": "Error",
"errorMessage": "This tag cannot be deleted, it has been used in at least one invoice. You can disable it so it won't appear on the suggestion lists.",
"errorMessagePL": "Ta kategoria nie może zostać usunięta ponieważ została użyta w przynajmniej jednej fakturze. Możesz ją zablokować aby nie pojawiała się na liście sugerowanych."
}Authorizations
OpenApi Key created within Altera.app for a certain company
Body
application/json
Was this page helpful?

