curl --request GET \
--url https://api.jtl-cloud.com/erp/v2/sales-invoices/totals \
--header 'Authorization: Bearer <token>' \
--header 'x-tenant-id: <x-tenant-id>'import requests
url = "https://api.jtl-cloud.com/erp/v2/sales-invoices/totals"
headers = {
"x-tenant-id": "<x-tenant-id>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-tenant-id': '<x-tenant-id>', Authorization: 'Bearer <token>'}
};
fetch('https://api.jtl-cloud.com/erp/v2/sales-invoices/totals', 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.jtl-cloud.com/erp/v2/sales-invoices/totals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"x-tenant-id: <x-tenant-id>"
],
]);
$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.jtl-cloud.com/erp/v2/sales-invoices/totals"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-tenant-id", "<x-tenant-id>")
req.Header.Add("Authorization", "Bearer <token>")
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.jtl-cloud.com/erp/v2/sales-invoices/totals")
.header("x-tenant-id", "<x-tenant-id>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.jtl-cloud.com/erp/v2/sales-invoices/totals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-tenant-id"] = '<x-tenant-id>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"currencyIso": "<string>",
"totalGrossAmount": 123,
"totalNetAmount": 123,
"totalVatAmount": 123,
"documentCount": 123
}
]{
"type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"instance": "/api/route",
"traceId": "0HMPNHL0JHL76:00000001",
"detail": "<string>",
"errors": [
{
"name": "Error or field name",
"reason": "Error reason",
"code": "<string>",
"severity": "<string>"
}
]
}{
"type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"instance": "/api/route",
"traceId": "0HMPNHL0JHL76:00000001",
"detail": "<string>",
"errors": [
{
"name": "Error or field name",
"reason": "Error reason",
"code": "<string>",
"severity": "<string>"
}
]
}{
"type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"instance": "/api/route",
"traceId": "0HMPNHL0JHL76:00000001",
"detail": "<string>",
"errors": [
{
"name": "Error or field name",
"reason": "Error reason",
"code": "<string>",
"severity": "<string>"
}
]
}{
"type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"instance": "/api/route",
"traceId": "0HMPNHL0JHL76:00000001",
"detail": "<string>",
"errors": [
{
"name": "Error or field name",
"reason": "Error reason",
"code": "<string>",
"severity": "<string>"
}
]
}Query Sales Invoice Totals
Queries per-currency totals (“TotalGrossAmount”, “TotalNetAmount”, “TotalVatAmount”) and the number of matching invoices (“DocumentCount”) for the same set of sales invoices returned by “GET /v2/sales-invoices” or “QuerySalesInvoices” (no separate exclusion of drafts, cancelled or archived invoices; “SalesInvoiceCorrectionTotalGrossAmount” is not netted), restricted to a required, inclusive date range [“From”, “To”] compared against “SalesInvoiceDate”: invoices with a “SalesInvoiceDate” at or after “From” and at or before “To” are included. “GET /v2/sales-invoices” or “QuerySalesInvoices” already exposes “salesInvoiceDateAfter”/“salesInvoiceDateBefore”, but those are optional filters on the paged list endpoint that exclude the boundary value itself. “From” and “To” here are a separate, required, always-inclusive pair, dedicated to this aggregate endpoint: an invoice with “SalesInvoiceDate” exactly equal to “From” or “To” is included, never excluded. Both bounds are compared as full timestamps, not calendar dates; a “To” at the start of a day (00:00:00) excludes invoices later that same day, so pass the end of the day to include it. The UTC offset of “From” and “To” is ignored: their wall-clock date and time are compared against “SalesInvoiceDate”, the same way “GET /v2/sales-invoices” or “QuerySalesInvoices” filters, and the check that “From” is not later than “To” also uses these wall-clock values. The “x-companyid” header does not restrict the result, the same as for “GET /v2/sales-invoices” or “QuerySalesInvoices”: invoices of every company are included. Results are grouped once per “CurrencyIso” from the same per-invoice “TotalGrossAmount”/“TotalNetAmount” fields already returned by “SalesInvoiceListItem” for “GET /v2/sales-invoices” or “QuerySalesInvoices”. The result set is small and bounded by the number of distinct currencies in use, so it is not paged, sorted, filtered, or projectable.
curl --request GET \
--url https://api.jtl-cloud.com/erp/v2/sales-invoices/totals \
--header 'Authorization: Bearer <token>' \
--header 'x-tenant-id: <x-tenant-id>'import requests
url = "https://api.jtl-cloud.com/erp/v2/sales-invoices/totals"
headers = {
"x-tenant-id": "<x-tenant-id>",
"Authorization": "Bearer <token>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-tenant-id': '<x-tenant-id>', Authorization: 'Bearer <token>'}
};
fetch('https://api.jtl-cloud.com/erp/v2/sales-invoices/totals', 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.jtl-cloud.com/erp/v2/sales-invoices/totals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"x-tenant-id: <x-tenant-id>"
],
]);
$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.jtl-cloud.com/erp/v2/sales-invoices/totals"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-tenant-id", "<x-tenant-id>")
req.Header.Add("Authorization", "Bearer <token>")
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.jtl-cloud.com/erp/v2/sales-invoices/totals")
.header("x-tenant-id", "<x-tenant-id>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.jtl-cloud.com/erp/v2/sales-invoices/totals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-tenant-id"] = '<x-tenant-id>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"currencyIso": "<string>",
"totalGrossAmount": 123,
"totalNetAmount": 123,
"totalVatAmount": 123,
"documentCount": 123
}
]{
"type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"instance": "/api/route",
"traceId": "0HMPNHL0JHL76:00000001",
"detail": "<string>",
"errors": [
{
"name": "Error or field name",
"reason": "Error reason",
"code": "<string>",
"severity": "<string>"
}
]
}{
"type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"instance": "/api/route",
"traceId": "0HMPNHL0JHL76:00000001",
"detail": "<string>",
"errors": [
{
"name": "Error or field name",
"reason": "Error reason",
"code": "<string>",
"severity": "<string>"
}
]
}{
"type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"instance": "/api/route",
"traceId": "0HMPNHL0JHL76:00000001",
"detail": "<string>",
"errors": [
{
"name": "Error or field name",
"reason": "Error reason",
"code": "<string>",
"severity": "<string>"
}
]
}{
"type": "https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"instance": "/api/route",
"traceId": "0HMPNHL0JHL76:00000001",
"detail": "<string>",
"errors": [
{
"name": "Error or field name",
"reason": "Error reason",
"code": "<string>",
"severity": "<string>"
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Headers
The tenant ID for the target ERP instance.
Query Parameters
Inclusive start of the date range that sales invoices are aggregated over: only invoices with "SalesInvoiceDate" at or after this value are included. The UTC offset is ignored; the wall-clock date and time are compared. Required; its wall-clock value must not be later than that of "To".
Inclusive end of the date range that sales invoices are aggregated over: only invoices with "SalesInvoiceDate" at or before this value are included. The UTC offset is ignored; the wall-clock date and time are compared. Required; its wall-clock value must not be earlier than that of "From".
Response
Success.
ISO code of the currency this row aggregates. Taken from "CurrencyIso" of "SalesInvoiceListItem"; one row per distinct value found among the invoices in range.
Sum of "TotalGrossAmount" (see "SalesInvoiceListItem") across every sales invoice dated within ["From", "To"] whose "CurrencyIso" matches this row. The per-invoice values are summed unrounded; no per-invoice rounding is applied before summation.
Sum of "TotalNetAmount" (see "SalesInvoiceListItem") across every sales invoice dated within ["From", "To"] whose "CurrencyIso" matches this row. Summed unrounded, the same way as "TotalGrossAmount".
"TotalGrossAmount" minus "TotalNetAmount", computed once per currency group after both sums are formed. This is not the sum of the per-invoice VAT amounts, and neither "TotalGrossAmount" nor "TotalNetAmount" is rounded per invoice before the subtraction.
Number of sales invoices dated within ["From", "To"] whose "CurrencyIso" matches this row, counted over the same invoice set whose amounts are summed into "TotalGrossAmount" and "TotalNetAmount".
Was this page helpful?