curl --request POST \
--url https://api.altera.co/sales/invoice \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"modelType": "INVOICE",
"override": false,
"basicInformation": {
"invoiceId": 2069,
"invoiceType": "SALES",
"invoiceFormat": "%N/%M/%Y",
"saleDate": "2022-10-11",
"issueDate": "2022-10-11",
"isReceipt": false,
"relatedInvoicesIds": [],
"priceTypeId": "NET"
},
"contractor": {
"contractorRegion": "POLAND",
"country": "PL",
"contractorType": "COMPANY",
"contractorName": "Test działania",
"street": "Testowa",
"houseNumber": "10",
"flatNumber": "10",
"city": "Bydgoszcz",
"postCode": "62-156",
"defaultCurrency": "PLN",
"taxIdentificationNumber": "1589651654",
"email": "testing@attention.please",
"areaNumber": "+58",
"phoneNumber": "518 961 516"
},
"invoicePosition": [
{
"productPosition": 0,
"productName": "A",
"positionType": "PRODUCT",
"productCategory": "Health",
"quantity": 10,
"unit": "szt.",
"priceType": null,
"unitNetPrice": 150,
"unitGrossPrice": 184.5,
"vat": "23%",
"pkwiu": "",
"discount": "0",
"deductions": false,
"netPrice": "1500",
"grossPrice": "1845",
"invoiceProductId": 179
}
],
"additionalDetails": "",
"correctionReason": "",
"payments": {
"isPaid": false,
"paymentMethod": "TRANSFER",
"dueDate": "2022-10-25",
"bankAccountNumber": "10 1010 1062 5565 1561 5615 1516",
"isSplitPayment": false
},
"project": {
"tagId": 161,
"name": "Website implementation",
"enabled": true,
"color": 4286963618
}
}
'import requests
url = "https://api.altera.co/sales/invoice"
payload = {
"modelType": "INVOICE",
"override": False,
"basicInformation": {
"invoiceId": 2069,
"invoiceType": "SALES",
"invoiceFormat": "%N/%M/%Y",
"saleDate": "2022-10-11",
"issueDate": "2022-10-11",
"isReceipt": False,
"relatedInvoicesIds": [],
"priceTypeId": "NET"
},
"contractor": {
"contractorRegion": "POLAND",
"country": "PL",
"contractorType": "COMPANY",
"contractorName": "Test działania",
"street": "Testowa",
"houseNumber": "10",
"flatNumber": "10",
"city": "Bydgoszcz",
"postCode": "62-156",
"defaultCurrency": "PLN",
"taxIdentificationNumber": "1589651654",
"email": "testing@attention.please",
"areaNumber": "+58",
"phoneNumber": "518 961 516"
},
"invoicePosition": [
{
"productPosition": 0,
"productName": "A",
"positionType": "PRODUCT",
"productCategory": "Health",
"quantity": 10,
"unit": "szt.",
"priceType": None,
"unitNetPrice": 150,
"unitGrossPrice": 184.5,
"vat": "23%",
"pkwiu": "",
"discount": "0",
"deductions": False,
"netPrice": "1500",
"grossPrice": "1845",
"invoiceProductId": 179
}
],
"additionalDetails": "",
"correctionReason": "",
"payments": {
"isPaid": False,
"paymentMethod": "TRANSFER",
"dueDate": "2022-10-25",
"bankAccountNumber": "10 1010 1062 5565 1561 5615 1516",
"isSplitPayment": False
},
"project": {
"tagId": 161,
"name": "Website implementation",
"enabled": True,
"color": 4286963618
}
}
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({
modelType: 'INVOICE',
override: false,
basicInformation: {
invoiceId: 2069,
invoiceType: 'SALES',
invoiceFormat: '%N/%M/%Y',
saleDate: '2022-10-11',
issueDate: '2022-10-11',
isReceipt: false,
relatedInvoicesIds: [],
priceTypeId: 'NET'
},
contractor: {
contractorRegion: 'POLAND',
country: 'PL',
contractorType: 'COMPANY',
contractorName: 'Test działania',
street: 'Testowa',
houseNumber: '10',
flatNumber: '10',
city: 'Bydgoszcz',
postCode: '62-156',
defaultCurrency: 'PLN',
taxIdentificationNumber: '1589651654',
email: 'testing@attention.please',
areaNumber: '+58',
phoneNumber: '518 961 516'
},
invoicePosition: [
{
productPosition: 0,
productName: 'A',
positionType: 'PRODUCT',
productCategory: 'Health',
quantity: 10,
unit: 'szt.',
priceType: null,
unitNetPrice: 150,
unitGrossPrice: 184.5,
vat: '23%',
pkwiu: '',
discount: '0',
deductions: false,
netPrice: '1500',
grossPrice: '1845',
invoiceProductId: 179
}
],
additionalDetails: '',
correctionReason: '',
payments: {
isPaid: false,
paymentMethod: 'TRANSFER',
dueDate: '2022-10-25',
bankAccountNumber: '10 1010 1062 5565 1561 5615 1516',
isSplitPayment: false
},
project: {tagId: 161, name: 'Website implementation', enabled: true, color: 4286963618}
})
};
fetch('https://api.altera.co/sales/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.altera.co/sales/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([
'modelType' => 'INVOICE',
'override' => false,
'basicInformation' => [
'invoiceId' => 2069,
'invoiceType' => 'SALES',
'invoiceFormat' => '%N/%M/%Y',
'saleDate' => '2022-10-11',
'issueDate' => '2022-10-11',
'isReceipt' => false,
'relatedInvoicesIds' => [
],
'priceTypeId' => 'NET'
],
'contractor' => [
'contractorRegion' => 'POLAND',
'country' => 'PL',
'contractorType' => 'COMPANY',
'contractorName' => 'Test działania',
'street' => 'Testowa',
'houseNumber' => '10',
'flatNumber' => '10',
'city' => 'Bydgoszcz',
'postCode' => '62-156',
'defaultCurrency' => 'PLN',
'taxIdentificationNumber' => '1589651654',
'email' => 'testing@attention.please',
'areaNumber' => '+58',
'phoneNumber' => '518 961 516'
],
'invoicePosition' => [
[
'productPosition' => 0,
'productName' => 'A',
'positionType' => 'PRODUCT',
'productCategory' => 'Health',
'quantity' => 10,
'unit' => 'szt.',
'priceType' => null,
'unitNetPrice' => 150,
'unitGrossPrice' => 184.5,
'vat' => '23%',
'pkwiu' => '',
'discount' => '0',
'deductions' => false,
'netPrice' => '1500',
'grossPrice' => '1845',
'invoiceProductId' => 179
]
],
'additionalDetails' => '',
'correctionReason' => '',
'payments' => [
'isPaid' => false,
'paymentMethod' => 'TRANSFER',
'dueDate' => '2022-10-25',
'bankAccountNumber' => '10 1010 1062 5565 1561 5615 1516',
'isSplitPayment' => false
],
'project' => [
'tagId' => 161,
'name' => 'Website implementation',
'enabled' => true,
'color' => 4286963618
]
]),
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/invoice"
payload := strings.NewReader("{\n \"modelType\": \"INVOICE\",\n \"override\": false,\n \"basicInformation\": {\n \"invoiceId\": 2069,\n \"invoiceType\": \"SALES\",\n \"invoiceFormat\": \"%N/%M/%Y\",\n \"saleDate\": \"2022-10-11\",\n \"issueDate\": \"2022-10-11\",\n \"isReceipt\": false,\n \"relatedInvoicesIds\": [],\n \"priceTypeId\": \"NET\"\n },\n \"contractor\": {\n \"contractorRegion\": \"POLAND\",\n \"country\": \"PL\",\n \"contractorType\": \"COMPANY\",\n \"contractorName\": \"Test działania\",\n \"street\": \"Testowa\",\n \"houseNumber\": \"10\",\n \"flatNumber\": \"10\",\n \"city\": \"Bydgoszcz\",\n \"postCode\": \"62-156\",\n \"defaultCurrency\": \"PLN\",\n \"taxIdentificationNumber\": \"1589651654\",\n \"email\": \"testing@attention.please\",\n \"areaNumber\": \"+58\",\n \"phoneNumber\": \"518 961 516\"\n },\n \"invoicePosition\": [\n {\n \"productPosition\": 0,\n \"productName\": \"A\",\n \"positionType\": \"PRODUCT\",\n \"productCategory\": \"Health\",\n \"quantity\": 10,\n \"unit\": \"szt.\",\n \"priceType\": null,\n \"unitNetPrice\": 150,\n \"unitGrossPrice\": 184.5,\n \"vat\": \"23%\",\n \"pkwiu\": \"\",\n \"discount\": \"0\",\n \"deductions\": false,\n \"netPrice\": \"1500\",\n \"grossPrice\": \"1845\",\n \"invoiceProductId\": 179\n }\n ],\n \"additionalDetails\": \"\",\n \"correctionReason\": \"\",\n \"payments\": {\n \"isPaid\": false,\n \"paymentMethod\": \"TRANSFER\",\n \"dueDate\": \"2022-10-25\",\n \"bankAccountNumber\": \"10 1010 1062 5565 1561 5615 1516\",\n \"isSplitPayment\": false\n },\n \"project\": {\n \"tagId\": 161,\n \"name\": \"Website implementation\",\n \"enabled\": true,\n \"color\": 4286963618\n }\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/invoice")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"modelType\": \"INVOICE\",\n \"override\": false,\n \"basicInformation\": {\n \"invoiceId\": 2069,\n \"invoiceType\": \"SALES\",\n \"invoiceFormat\": \"%N/%M/%Y\",\n \"saleDate\": \"2022-10-11\",\n \"issueDate\": \"2022-10-11\",\n \"isReceipt\": false,\n \"relatedInvoicesIds\": [],\n \"priceTypeId\": \"NET\"\n },\n \"contractor\": {\n \"contractorRegion\": \"POLAND\",\n \"country\": \"PL\",\n \"contractorType\": \"COMPANY\",\n \"contractorName\": \"Test działania\",\n \"street\": \"Testowa\",\n \"houseNumber\": \"10\",\n \"flatNumber\": \"10\",\n \"city\": \"Bydgoszcz\",\n \"postCode\": \"62-156\",\n \"defaultCurrency\": \"PLN\",\n \"taxIdentificationNumber\": \"1589651654\",\n \"email\": \"testing@attention.please\",\n \"areaNumber\": \"+58\",\n \"phoneNumber\": \"518 961 516\"\n },\n \"invoicePosition\": [\n {\n \"productPosition\": 0,\n \"productName\": \"A\",\n \"positionType\": \"PRODUCT\",\n \"productCategory\": \"Health\",\n \"quantity\": 10,\n \"unit\": \"szt.\",\n \"priceType\": null,\n \"unitNetPrice\": 150,\n \"unitGrossPrice\": 184.5,\n \"vat\": \"23%\",\n \"pkwiu\": \"\",\n \"discount\": \"0\",\n \"deductions\": false,\n \"netPrice\": \"1500\",\n \"grossPrice\": \"1845\",\n \"invoiceProductId\": 179\n }\n ],\n \"additionalDetails\": \"\",\n \"correctionReason\": \"\",\n \"payments\": {\n \"isPaid\": false,\n \"paymentMethod\": \"TRANSFER\",\n \"dueDate\": \"2022-10-25\",\n \"bankAccountNumber\": \"10 1010 1062 5565 1561 5615 1516\",\n \"isSplitPayment\": false\n },\n \"project\": {\n \"tagId\": 161,\n \"name\": \"Website implementation\",\n \"enabled\": true,\n \"color\": 4286963618\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.altera.co/sales/invoice")
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 \"modelType\": \"INVOICE\",\n \"override\": false,\n \"basicInformation\": {\n \"invoiceId\": 2069,\n \"invoiceType\": \"SALES\",\n \"invoiceFormat\": \"%N/%M/%Y\",\n \"saleDate\": \"2022-10-11\",\n \"issueDate\": \"2022-10-11\",\n \"isReceipt\": false,\n \"relatedInvoicesIds\": [],\n \"priceTypeId\": \"NET\"\n },\n \"contractor\": {\n \"contractorRegion\": \"POLAND\",\n \"country\": \"PL\",\n \"contractorType\": \"COMPANY\",\n \"contractorName\": \"Test działania\",\n \"street\": \"Testowa\",\n \"houseNumber\": \"10\",\n \"flatNumber\": \"10\",\n \"city\": \"Bydgoszcz\",\n \"postCode\": \"62-156\",\n \"defaultCurrency\": \"PLN\",\n \"taxIdentificationNumber\": \"1589651654\",\n \"email\": \"testing@attention.please\",\n \"areaNumber\": \"+58\",\n \"phoneNumber\": \"518 961 516\"\n },\n \"invoicePosition\": [\n {\n \"productPosition\": 0,\n \"productName\": \"A\",\n \"positionType\": \"PRODUCT\",\n \"productCategory\": \"Health\",\n \"quantity\": 10,\n \"unit\": \"szt.\",\n \"priceType\": null,\n \"unitNetPrice\": 150,\n \"unitGrossPrice\": 184.5,\n \"vat\": \"23%\",\n \"pkwiu\": \"\",\n \"discount\": \"0\",\n \"deductions\": false,\n \"netPrice\": \"1500\",\n \"grossPrice\": \"1845\",\n \"invoiceProductId\": 179\n }\n ],\n \"additionalDetails\": \"\",\n \"correctionReason\": \"\",\n \"payments\": {\n \"isPaid\": false,\n \"paymentMethod\": \"TRANSFER\",\n \"dueDate\": \"2022-10-25\",\n \"bankAccountNumber\": \"10 1010 1062 5565 1561 5615 1516\",\n \"isSplitPayment\": false\n },\n \"project\": {\n \"tagId\": 161,\n \"name\": \"Website implementation\",\n \"enabled\": true,\n \"color\": 4286963618\n }\n}"
response = http.request(request)
puts response.read_body{
"result": "OK",
"data": {
"invoiceId": 12413
}
}{
"result": "Error",
"errorMessage": "Enter a date in YYYY-MM-DD format, without a time or time zone, for example 2026-09-14.",
"errorMessagePL": "Podaj datę w formacie RRRR-MM-DD, bez godziny i strefy czasowej, np. 2026-09-14.",
"validationErrors": [
{
"field": "basicInformation.issueDate",
"message": "DATE_REQUIRES_LOCAL_DATE",
"code": "DATE_REQUIRES_LOCAL_DATE"
}
]
}Create/update invoice
Create or update a sales invoice in Altera via the OpenAPI. Set basicInformation.statusId to ISSUED to issue, or save the document as a draft.
curl --request POST \
--url https://api.altera.co/sales/invoice \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"modelType": "INVOICE",
"override": false,
"basicInformation": {
"invoiceId": 2069,
"invoiceType": "SALES",
"invoiceFormat": "%N/%M/%Y",
"saleDate": "2022-10-11",
"issueDate": "2022-10-11",
"isReceipt": false,
"relatedInvoicesIds": [],
"priceTypeId": "NET"
},
"contractor": {
"contractorRegion": "POLAND",
"country": "PL",
"contractorType": "COMPANY",
"contractorName": "Test działania",
"street": "Testowa",
"houseNumber": "10",
"flatNumber": "10",
"city": "Bydgoszcz",
"postCode": "62-156",
"defaultCurrency": "PLN",
"taxIdentificationNumber": "1589651654",
"email": "testing@attention.please",
"areaNumber": "+58",
"phoneNumber": "518 961 516"
},
"invoicePosition": [
{
"productPosition": 0,
"productName": "A",
"positionType": "PRODUCT",
"productCategory": "Health",
"quantity": 10,
"unit": "szt.",
"priceType": null,
"unitNetPrice": 150,
"unitGrossPrice": 184.5,
"vat": "23%",
"pkwiu": "",
"discount": "0",
"deductions": false,
"netPrice": "1500",
"grossPrice": "1845",
"invoiceProductId": 179
}
],
"additionalDetails": "",
"correctionReason": "",
"payments": {
"isPaid": false,
"paymentMethod": "TRANSFER",
"dueDate": "2022-10-25",
"bankAccountNumber": "10 1010 1062 5565 1561 5615 1516",
"isSplitPayment": false
},
"project": {
"tagId": 161,
"name": "Website implementation",
"enabled": true,
"color": 4286963618
}
}
'import requests
url = "https://api.altera.co/sales/invoice"
payload = {
"modelType": "INVOICE",
"override": False,
"basicInformation": {
"invoiceId": 2069,
"invoiceType": "SALES",
"invoiceFormat": "%N/%M/%Y",
"saleDate": "2022-10-11",
"issueDate": "2022-10-11",
"isReceipt": False,
"relatedInvoicesIds": [],
"priceTypeId": "NET"
},
"contractor": {
"contractorRegion": "POLAND",
"country": "PL",
"contractorType": "COMPANY",
"contractorName": "Test działania",
"street": "Testowa",
"houseNumber": "10",
"flatNumber": "10",
"city": "Bydgoszcz",
"postCode": "62-156",
"defaultCurrency": "PLN",
"taxIdentificationNumber": "1589651654",
"email": "testing@attention.please",
"areaNumber": "+58",
"phoneNumber": "518 961 516"
},
"invoicePosition": [
{
"productPosition": 0,
"productName": "A",
"positionType": "PRODUCT",
"productCategory": "Health",
"quantity": 10,
"unit": "szt.",
"priceType": None,
"unitNetPrice": 150,
"unitGrossPrice": 184.5,
"vat": "23%",
"pkwiu": "",
"discount": "0",
"deductions": False,
"netPrice": "1500",
"grossPrice": "1845",
"invoiceProductId": 179
}
],
"additionalDetails": "",
"correctionReason": "",
"payments": {
"isPaid": False,
"paymentMethod": "TRANSFER",
"dueDate": "2022-10-25",
"bankAccountNumber": "10 1010 1062 5565 1561 5615 1516",
"isSplitPayment": False
},
"project": {
"tagId": 161,
"name": "Website implementation",
"enabled": True,
"color": 4286963618
}
}
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({
modelType: 'INVOICE',
override: false,
basicInformation: {
invoiceId: 2069,
invoiceType: 'SALES',
invoiceFormat: '%N/%M/%Y',
saleDate: '2022-10-11',
issueDate: '2022-10-11',
isReceipt: false,
relatedInvoicesIds: [],
priceTypeId: 'NET'
},
contractor: {
contractorRegion: 'POLAND',
country: 'PL',
contractorType: 'COMPANY',
contractorName: 'Test działania',
street: 'Testowa',
houseNumber: '10',
flatNumber: '10',
city: 'Bydgoszcz',
postCode: '62-156',
defaultCurrency: 'PLN',
taxIdentificationNumber: '1589651654',
email: 'testing@attention.please',
areaNumber: '+58',
phoneNumber: '518 961 516'
},
invoicePosition: [
{
productPosition: 0,
productName: 'A',
positionType: 'PRODUCT',
productCategory: 'Health',
quantity: 10,
unit: 'szt.',
priceType: null,
unitNetPrice: 150,
unitGrossPrice: 184.5,
vat: '23%',
pkwiu: '',
discount: '0',
deductions: false,
netPrice: '1500',
grossPrice: '1845',
invoiceProductId: 179
}
],
additionalDetails: '',
correctionReason: '',
payments: {
isPaid: false,
paymentMethod: 'TRANSFER',
dueDate: '2022-10-25',
bankAccountNumber: '10 1010 1062 5565 1561 5615 1516',
isSplitPayment: false
},
project: {tagId: 161, name: 'Website implementation', enabled: true, color: 4286963618}
})
};
fetch('https://api.altera.co/sales/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.altera.co/sales/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([
'modelType' => 'INVOICE',
'override' => false,
'basicInformation' => [
'invoiceId' => 2069,
'invoiceType' => 'SALES',
'invoiceFormat' => '%N/%M/%Y',
'saleDate' => '2022-10-11',
'issueDate' => '2022-10-11',
'isReceipt' => false,
'relatedInvoicesIds' => [
],
'priceTypeId' => 'NET'
],
'contractor' => [
'contractorRegion' => 'POLAND',
'country' => 'PL',
'contractorType' => 'COMPANY',
'contractorName' => 'Test działania',
'street' => 'Testowa',
'houseNumber' => '10',
'flatNumber' => '10',
'city' => 'Bydgoszcz',
'postCode' => '62-156',
'defaultCurrency' => 'PLN',
'taxIdentificationNumber' => '1589651654',
'email' => 'testing@attention.please',
'areaNumber' => '+58',
'phoneNumber' => '518 961 516'
],
'invoicePosition' => [
[
'productPosition' => 0,
'productName' => 'A',
'positionType' => 'PRODUCT',
'productCategory' => 'Health',
'quantity' => 10,
'unit' => 'szt.',
'priceType' => null,
'unitNetPrice' => 150,
'unitGrossPrice' => 184.5,
'vat' => '23%',
'pkwiu' => '',
'discount' => '0',
'deductions' => false,
'netPrice' => '1500',
'grossPrice' => '1845',
'invoiceProductId' => 179
]
],
'additionalDetails' => '',
'correctionReason' => '',
'payments' => [
'isPaid' => false,
'paymentMethod' => 'TRANSFER',
'dueDate' => '2022-10-25',
'bankAccountNumber' => '10 1010 1062 5565 1561 5615 1516',
'isSplitPayment' => false
],
'project' => [
'tagId' => 161,
'name' => 'Website implementation',
'enabled' => true,
'color' => 4286963618
]
]),
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/invoice"
payload := strings.NewReader("{\n \"modelType\": \"INVOICE\",\n \"override\": false,\n \"basicInformation\": {\n \"invoiceId\": 2069,\n \"invoiceType\": \"SALES\",\n \"invoiceFormat\": \"%N/%M/%Y\",\n \"saleDate\": \"2022-10-11\",\n \"issueDate\": \"2022-10-11\",\n \"isReceipt\": false,\n \"relatedInvoicesIds\": [],\n \"priceTypeId\": \"NET\"\n },\n \"contractor\": {\n \"contractorRegion\": \"POLAND\",\n \"country\": \"PL\",\n \"contractorType\": \"COMPANY\",\n \"contractorName\": \"Test działania\",\n \"street\": \"Testowa\",\n \"houseNumber\": \"10\",\n \"flatNumber\": \"10\",\n \"city\": \"Bydgoszcz\",\n \"postCode\": \"62-156\",\n \"defaultCurrency\": \"PLN\",\n \"taxIdentificationNumber\": \"1589651654\",\n \"email\": \"testing@attention.please\",\n \"areaNumber\": \"+58\",\n \"phoneNumber\": \"518 961 516\"\n },\n \"invoicePosition\": [\n {\n \"productPosition\": 0,\n \"productName\": \"A\",\n \"positionType\": \"PRODUCT\",\n \"productCategory\": \"Health\",\n \"quantity\": 10,\n \"unit\": \"szt.\",\n \"priceType\": null,\n \"unitNetPrice\": 150,\n \"unitGrossPrice\": 184.5,\n \"vat\": \"23%\",\n \"pkwiu\": \"\",\n \"discount\": \"0\",\n \"deductions\": false,\n \"netPrice\": \"1500\",\n \"grossPrice\": \"1845\",\n \"invoiceProductId\": 179\n }\n ],\n \"additionalDetails\": \"\",\n \"correctionReason\": \"\",\n \"payments\": {\n \"isPaid\": false,\n \"paymentMethod\": \"TRANSFER\",\n \"dueDate\": \"2022-10-25\",\n \"bankAccountNumber\": \"10 1010 1062 5565 1561 5615 1516\",\n \"isSplitPayment\": false\n },\n \"project\": {\n \"tagId\": 161,\n \"name\": \"Website implementation\",\n \"enabled\": true,\n \"color\": 4286963618\n }\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/invoice")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"modelType\": \"INVOICE\",\n \"override\": false,\n \"basicInformation\": {\n \"invoiceId\": 2069,\n \"invoiceType\": \"SALES\",\n \"invoiceFormat\": \"%N/%M/%Y\",\n \"saleDate\": \"2022-10-11\",\n \"issueDate\": \"2022-10-11\",\n \"isReceipt\": false,\n \"relatedInvoicesIds\": [],\n \"priceTypeId\": \"NET\"\n },\n \"contractor\": {\n \"contractorRegion\": \"POLAND\",\n \"country\": \"PL\",\n \"contractorType\": \"COMPANY\",\n \"contractorName\": \"Test działania\",\n \"street\": \"Testowa\",\n \"houseNumber\": \"10\",\n \"flatNumber\": \"10\",\n \"city\": \"Bydgoszcz\",\n \"postCode\": \"62-156\",\n \"defaultCurrency\": \"PLN\",\n \"taxIdentificationNumber\": \"1589651654\",\n \"email\": \"testing@attention.please\",\n \"areaNumber\": \"+58\",\n \"phoneNumber\": \"518 961 516\"\n },\n \"invoicePosition\": [\n {\n \"productPosition\": 0,\n \"productName\": \"A\",\n \"positionType\": \"PRODUCT\",\n \"productCategory\": \"Health\",\n \"quantity\": 10,\n \"unit\": \"szt.\",\n \"priceType\": null,\n \"unitNetPrice\": 150,\n \"unitGrossPrice\": 184.5,\n \"vat\": \"23%\",\n \"pkwiu\": \"\",\n \"discount\": \"0\",\n \"deductions\": false,\n \"netPrice\": \"1500\",\n \"grossPrice\": \"1845\",\n \"invoiceProductId\": 179\n }\n ],\n \"additionalDetails\": \"\",\n \"correctionReason\": \"\",\n \"payments\": {\n \"isPaid\": false,\n \"paymentMethod\": \"TRANSFER\",\n \"dueDate\": \"2022-10-25\",\n \"bankAccountNumber\": \"10 1010 1062 5565 1561 5615 1516\",\n \"isSplitPayment\": false\n },\n \"project\": {\n \"tagId\": 161,\n \"name\": \"Website implementation\",\n \"enabled\": true,\n \"color\": 4286963618\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.altera.co/sales/invoice")
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 \"modelType\": \"INVOICE\",\n \"override\": false,\n \"basicInformation\": {\n \"invoiceId\": 2069,\n \"invoiceType\": \"SALES\",\n \"invoiceFormat\": \"%N/%M/%Y\",\n \"saleDate\": \"2022-10-11\",\n \"issueDate\": \"2022-10-11\",\n \"isReceipt\": false,\n \"relatedInvoicesIds\": [],\n \"priceTypeId\": \"NET\"\n },\n \"contractor\": {\n \"contractorRegion\": \"POLAND\",\n \"country\": \"PL\",\n \"contractorType\": \"COMPANY\",\n \"contractorName\": \"Test działania\",\n \"street\": \"Testowa\",\n \"houseNumber\": \"10\",\n \"flatNumber\": \"10\",\n \"city\": \"Bydgoszcz\",\n \"postCode\": \"62-156\",\n \"defaultCurrency\": \"PLN\",\n \"taxIdentificationNumber\": \"1589651654\",\n \"email\": \"testing@attention.please\",\n \"areaNumber\": \"+58\",\n \"phoneNumber\": \"518 961 516\"\n },\n \"invoicePosition\": [\n {\n \"productPosition\": 0,\n \"productName\": \"A\",\n \"positionType\": \"PRODUCT\",\n \"productCategory\": \"Health\",\n \"quantity\": 10,\n \"unit\": \"szt.\",\n \"priceType\": null,\n \"unitNetPrice\": 150,\n \"unitGrossPrice\": 184.5,\n \"vat\": \"23%\",\n \"pkwiu\": \"\",\n \"discount\": \"0\",\n \"deductions\": false,\n \"netPrice\": \"1500\",\n \"grossPrice\": \"1845\",\n \"invoiceProductId\": 179\n }\n ],\n \"additionalDetails\": \"\",\n \"correctionReason\": \"\",\n \"payments\": {\n \"isPaid\": false,\n \"paymentMethod\": \"TRANSFER\",\n \"dueDate\": \"2022-10-25\",\n \"bankAccountNumber\": \"10 1010 1062 5565 1561 5615 1516\",\n \"isSplitPayment\": false\n },\n \"project\": {\n \"tagId\": 161,\n \"name\": \"Website implementation\",\n \"enabled\": true,\n \"color\": 4286963618\n }\n}"
response = http.request(request)
puts response.read_body{
"result": "OK",
"data": {
"invoiceId": 12413
}
}{
"result": "Error",
"errorMessage": "Enter a date in YYYY-MM-DD format, without a time or time zone, for example 2026-09-14.",
"errorMessagePL": "Podaj datę w formacie RRRR-MM-DD, bez godziny i strefy czasowej, np. 2026-09-14.",
"validationErrors": [
{
"field": "basicInformation.issueDate",
"message": "DATE_REQUIRES_LOCAL_DATE",
"code": "DATE_REQUIRES_LOCAL_DATE"
}
]
}Calendar dates
SendbasicInformation.issueDate, basicInformation.saleDate, payments.dueDate and optional payments.paymentDate as strings in YYYY-MM-DD format, for example "2026-09-14". These fields represent calendar dates without a time or time zone. Do not convert them to UTC or serialize them with toISOString().
For example, if the invoice date is September 15, send "2026-09-15", rather than "2026-09-14T22:00:00Z". Use the same date regardless of the client’s time zone. Timestamps representing an event time have different semantics and can include a time zone.
Legacy date-time inputs may still be accepted for compatibility. Non-midnight values can be converted to the calendar date in Europe/Warsaw; the save response does not include a warning about that conversion. With strict date validation enabled, non-midnight date-time values are rejected with HTTP 400 and validationErrors[].code = "DATE_REQUIRES_LOCAL_DATE". Legacy midnight values are still accepted without changing their written date. Always send YYYY-MM-DD for new integrations.
Validation errors include an English description in errorMessage, a Polish description in errorMessagePL, and the affected field in validationErrors[].field.
VAT-exempt invoices
If at least one invoice item uses the"vat": "zw" rate, provide vatExemptionReason at the top level of the request, alongside invoicePosition, additionalDetails, and payments.
The field accepts exactly one of these three values:
Zwolnienie podmiotowe z art. 113 ust. 1 i 9Zwolnienie przedmiotowe z art. 43 ust. 1Zwolnienie przedmiotowe z art. 82 ust. 3
vatExemptionReasonDetailed is optional. It accepts up to 500 characters of additional wording displayed on the invoice below the selected legal basis. It does not replace vatExemptionReason. Altera submits vatExemptionReason to KSeF as P_19A.
The following request fragment shows an invoice item using the zw rate:
{
"invoicePosition": [
{
"productName": "VAT-exempt service",
"positionType": "SERVICE",
"quantity": 1,
"unit": "szt.",
"unitNetPrice": 100,
"unitGrossPrice": 100,
"vat": "zw",
"discount": 0
}
],
"vatExemptionReason": "Zwolnienie przedmiotowe z art. 43 ust. 1",
"vatExemptionReasonDetailed": "Optional detailed wording of the legal basis"
}
basicInformation.invoiceId. If the invoice has no item using the zw rate, omit both fields.
Separate recipients and other additional parties
Keep the buyer incontractor. Add a separate recipient to the top-level additionalParties array, alongside contractor, basicInformation and payments. These are structured invoice parties (Podmiot3 in KSeF), rather than text in additionalDetails or contractor.houseNumber.
The following request fragment adds a recipient. Replace the illustrative name, address and tax identity with the actual party data:
{
"additionalParties": [
{
"semanticRole": "RECIPIENT",
"contractorName": "Example recipient",
"contractorType": "COMPANY",
"contractorRegion": "POLAND",
"country": "PL",
"taxIdentificationNumber": "5260250274",
"internalId": "00123",
"street": "Przykładowa",
"houseNumber": "28",
"city": "Warszawa",
"postCode": "00-001"
}
]
}
semanticRole accepts the following values:
| Value | Meaning |
|---|---|
FACTOR | Factor |
RECIPIENT | Recipient |
BRANCH | Branch / recipient |
ORIGINAL_ENTITY | Original entity |
ADDITIONAL_BUYER | Additional buyer |
ISSUER | Invoice issuer |
PAYEE | Party making the payment (KSeF role 6) |
JST_ISSUER | Local government unit issuer |
JST_RECIPIENT | Local government unit recipient |
VAT_GROUP_ISSUER | VAT group member issuing the invoice |
VAT_GROUP_RECIPIENT | VAT group member receiving the invoice |
EMPLOYEE | Employee |
OTHER | Other role; provide its description in roleOther |
RECIPIENT for an ordinary separate recipient. Do not automatically select JST_RECIPIENT just because the recipient is a school: choose the role that matches the actual local government arrangement, because it changes the KSeF mapping.
internalId is optional. When used, send a string containing exactly five digits, including any leading zeros. It is the suffix, not the complete KSeF identifier. For Podmiot3 export it requires a Polish 10-digit NIP and Polish country; the example produces IDWew equal to 5260250274-00123. Omit internalId when the party does not use an internal identifier.
Address fields belong to this additional party. houseNumber contains only the building number (maximum 20 characters), and postCode contains the postal code. Do not combine buyer and recipient addresses in one field.
For an update, provide basicInformation.invoiceId together with the intended invoice data and additional parties. This does not retroactively correct previously issued documents; invoices already submitted to or accepted by KSeF have content-edit restrictions and may require a correction invoice. The legacy alias additionalContractors is also accepted; use additionalParties for new integrations and avoid sending both.
Assigning a project to an invoice
Use the singular top-levelproject object in POST /sales/invoice, alongside basicInformation, contractor and payments. One project is assigned to the invoice. The following fragment must be combined with the remaining invoice data:
{
"project": {
"tagId": 161,
"name": "Website implementation",
"enabled": true,
"color": 4286963618
}
}
tagId identifies the existing project; name, enabled and color are also required by invoice validation. Sending only { "tagId": 161 } is insufficient. The name must be nonempty, enabled is a boolean, and color is the project’s numeric ARGB value (4278190080–4294967295).
Fetch existing projects using List projects (GET /company/projects, or GET /company/projects?onlyActive=1 for active projects), find the desired project by name in data, and use its complete object as project.
Saving an invoice does not create a project from its name. If necessary, first create the project using Add/modify a project (POST /company/projects), then use the returned project data including its tagId when saving the invoice.
For an existing invoice, include basicInformation.invoiceId and the intended invoice data:
- To retain the assignment, send the current
projectagain. - To change it, send the new project object.
- To remove it, omit
projectfrom the update payload. This endpoint is not a partial PATCH that preserves every omitted field.project: nullis not accepted.
projects: [], an array of projects, or a project name as a plain string. The current request validator expects project to be an object and rejects the unknown top-level field projects.
Immediate KSeF submission
Set the top-level booleansendToKSEF to true to request submission during the save flow, after the invoice has been persisted. To issue a new invoice and request immediate submission, use this fragment together with the remaining required buyer, line-item and payment data:
{
"sendToKSEF": true,
"basicInformation": {
"invoiceType": "SALES",
"invoiceFormat": "%N/%M/%Y",
"statusId": "ISSUED",
"issueDate": "2026-09-14",
"saleDate": "2026-09-14",
"priceTypeId": "NET"
}
}
- The default is
false. Omitting the flag or sendingfalsedoes not request immediate submission, but does not disable normal automatic KSeF processing. Eligible invoices can still enter the pending workflow. - The flag does not issue a draft. The invoice must be
ISSUEDorSENT; a draft is not submitted. - KSeF integration and outgoing submission must be enabled for the company. The flag does not override company settings, private-person invoice policy or KSeF validation. If the integration or outgoing submission is disabled, the save flow can skip submission without returning a KSeF warning.
sendToKSEF: trueis rejected forPRO_FORMA,ORDERandDEBIT_NOTE.- The compatibility spelling
sendToKsefis also accepted. PrefersendToKSEF; if both are sent, their values must agree.
Save success is not KSeF acceptance
A normal save returns HTTP200 with the saved invoice identifier:
{
"result": "OK",
"data": {
"invoiceId": 12413
}
}
200 and result: "OK", with optional KSeF details. For example:
{
"result": "OK",
"data": {
"invoiceId": 12413,
"ksefWarning": "Wysyłka faktur dla osób prywatnych do KSeF jest wyłączona w ustawieniach firmy.",
"ksefErrorMessage": "Wysyłka faktur dla osób prywatnych do KSeF jest wyłączona w ustawieniach firmy.",
"ksefReason": "KSEF_PRIVATE_PERSON_SEND_DISABLED"
}
}
ksefWarning, ksefErrorMessage and ksefReason even on HTTP 200. Reason codes are an open set; another possible value is KSEF_SUBMISSION_FAILED. Absence of these fields is not proof of KSeF acceptance. Retrieve the saved invoice through Get invoice data and inspect ksef.ksefStatus, ksef.ksefId and any ksef.ksefErrorMessage.
Keep the returned invoiceId. Do not create the same invoice again because KSeF submission failed. Resolve the KSeF issue and use the existing invoice’s submission/retry workflow. For request validation errors, correct the input before retrying; do not repeatedly resend the same invalid payload. This warning response describes unsuccessful submission results after save; other validation or processing failures can still return an error response.Authorizations
OpenApi Key created within Altera.app for a certain company
Body
Defines whether we wish to override split payments warning, in Machine-machine integrations should be set to true
Request immediate KSeF submission after saving an eligible ISSUED or SENT invoice. Defaults to false; false does not disable normal automatic KSeF processing. Requires KSeF and outgoing submission enabled for the company and an eligible invoice. Does not issue a DRAFT or guarantee KSeF acceptance. Inspect data.ksefWarning, data.ksefErrorMessage and data.ksefReason even on HTTP 200, then check the saved invoice KSeF status. Not allowed for PRO_FORMA, ORDER or DEBIT_NOTE. See the endpoint guide for examples and retry handling.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Describes extra information that we wish to present on the invoice
Additional information regarding the reason behing correcting your invoice
Required when at least one invoicePosition item uses the zw VAT rate. The selected value is used as the VAT exemption legal basis and is submitted to KSeF as P_19A.
Zwolnienie podmiotowe z art. 113 ust. 1 i 9, Zwolnienie przedmiotowe z art. 43 ust. 1, Zwolnienie przedmiotowe z art. 82 ust. 3 50Optional detailed wording shown on the invoice below vatExemptionReason. It does not replace the required vatExemptionReason value.
500Show child attributes
Show child attributes
Additional parties, including a separate recipient (Podmiot3). Each entry is a snapshot; contractor continues to identify the buyer.
Show child attributes
Show child attributes
Single project assigned to the invoice. Pass an existing project from the same company, including tagId, name, enabled and color. Assignment is persisted by tagId; saving an invoice does not create a project. On update, resend project to retain the assignment; omitting it removes the assignment. The header project is propagated to sales line items. Use project, not projects.
Show child attributes
Show child attributes
{ "tagId": 161, "name": "Website implementation", "enabled": true, "color": 4286963618 }
Response
Invoice saved. HTTP 200 confirms the save, not acceptance by KSeF. A failed immediate submission can be reported in optional data.ksefWarning, data.ksefErrorMessage and data.ksefReason fields.
Was this page helpful?

