Validations
The checks that run on an invoice before it is sent, and the catalogue of their rules.
On this page
Get the checks of an invoice
GET /efactura/v1/invoices/{invoiceId}/checks
Runs the checks on the invoice as it is now and returns each one with its rule, its place in the document, its severity and its result. canSend is true when no blocking check fails.
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
invoiceId | path | string (uuid) | Yesrequired | The invoice. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | The checks of the invoice. | Checks |
401 | The token is missing, has expired or is not ours. | Error |
403 | The token does not give access to this company or operation. | Error |
404 | The invoice does not exist in your account. | Error |
429 | There were too many requests. Nothing was processed. The header Retry-After gives the seconds to wait. | Error |
503 | The gateway cannot answer now. | Error |
Request
curl
curl "$RDC_BASE_URL/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d/checks" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d/checks`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d/checks',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d/checks');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d/checks");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Response 200
{
"invoiceId": "ab7f7203-2bf2-4131-8b1b-34041c1afe3d",
"revision": 1,
"canSend": false,
"blocking": 2,
"checks": [
{
"rule": "BR-CO-10",
"place": "cac:LegalMonetaryTotal/cbc:LineExtensionAmount (BT-106)",
"severity": "blocking",
"passed": true,
"message": "Line net amounts add up to the net total."
},
{
"rule": "BR-S-09",
"place": "cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount (BT-117)",
"severity": "blocking",
"passed": true,
"message": "The VAT of each rate is its base times the rate."
},
{
"rule": "BR-CO-14",
"place": "cac:TaxTotal/cbc:TaxAmount (BT-110)",
"severity": "blocking",
"passed": true,
"message": "The VAT total is the sum of the VAT of each rate."
},
{
"rule": "BR-CO-15",
"place": "cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount (BT-112)",
"severity": "blocking",
"passed": true,
"message": "The total with VAT is the net total plus VAT."
},
{
"rule": "BR-CO-09",
"place": "cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID (BT-48)",
"severity": "blocking",
"passed": false,
"message": "The buyer’s VAT identifier 39172851 has no country prefix. Start it with RO."
},
{
"rule": "GW-01",
"place": "cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent (BT-152)",
"severity": "blocking",
"passed": false,
"message": "A line carries VAT rate 19%, which is not in force. Use 21 / 11."
},
{
"rule": "GW-02",
"place": "cbc:BuyerReference (BT-10)",
"severity": "warning",
"passed": false,
"message": "The buyer reference is empty. Buyers use it to match the invoice."
}
]
} List the validation rules
GET /efactura/v1/validation-rules
Returns the catalogue of rules the gateway checks before it sends an invoice.
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
limit | query | integer | Nooptional | Records per page, from 1 to 500. Default 100 Range 1 – 500 |
cursor | query | string | Nooptional | The nextCursor of the previous page. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | A page of rules. | RulePage |
401 | The token is missing, has expired or is not ours. | Error |
403 | The token does not give access to this company or operation. | Error |
429 | There were too many requests. Nothing was processed. The header Retry-After gives the seconds to wait. | Error |
503 | The gateway cannot answer now. | Error |
Request
curl
curl "$RDC_BASE_URL/efactura/v1/validation-rules?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/efactura/v1/validation-rules?limit=20`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/efactura/v1/validation-rules?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/efactura/v1/validation-rules?limit=20');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/efactura/v1/validation-rules?limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Response 200
{
"items": [
{
"rule": "BR-CO-10",
"place": "cac:LegalMonetaryTotal/cbc:LineExtensionAmount (BT-106)",
"severity": "blocking",
"description": "Line net amounts add up to the net total."
},
{
"rule": "BR-S-09",
"place": "cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount (BT-117)",
"severity": "blocking",
"description": "The VAT of each rate is its base times the rate."
},
{
"rule": "BR-CO-14",
"place": "cac:TaxTotal/cbc:TaxAmount (BT-110)",
"severity": "blocking",
"description": "The VAT total is the sum of the VAT of each rate."
},
{
"rule": "BR-CO-15",
"place": "cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount (BT-112)",
"severity": "blocking",
"description": "The total with VAT is the net total plus VAT."
},
{
"rule": "BR-CO-09",
"place": "cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID (BT-48)",
"severity": "blocking",
"description": "The buyer’s VAT identifier starts with a country prefix."
},
{
"rule": "GW-01",
"place": "cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:Percent (BT-152)",
"severity": "blocking",
"description": "Every line carries a VAT rate in force."
},
{
"rule": "GW-02",
"place": "cbc:BuyerReference (BT-10)",
"severity": "warning",
"description": "The invoice carries a buyer reference."
}
],
"nextCursor": null
}