---
title: "Validate before sending | Docs | e-Factura Gateway by R&D Copilot"
description: "Read the checks the gateway runs on a draft, fix what blocks it and send only when nothing blocks."
canonical: "https://efactura.rdcopilot.com/docs/send/validate-before-sending/"
language: en
updated: 2026-11-22
---

# Validate before sending

Read the checks the gateway runs on a draft, fix what blocks it and send only when nothing blocks.

The gateway checks every draft before it lets it go to the authority, so you find the mistake while it is still yours to fix. The checks are a function of the invoice: they run when you create the draft and again after every change, and they never change the invoice. The Checks list of the open invoice shows the same result.

## Read the checks

Each check has a `rule`, the `place` of the value in the document, a `severity` and the result in `passed`. `canSend` is true when no blocking check fails, and `blocking` counts the ones that do. The example is a draft whose buyer identifier has no country prefix and whose line carries a rate that is not in force.

curl

```bash
curl "$RDC_BASE_URL/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d/checks" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```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

```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
<?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#

```csharp
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

```json
{
  "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."
    }
  ]
}
```

| Severity | Effect |
| --- | --- |
| `blocking` | Sending is refused with `blocked_by_checks` until the check passes. |
| `warning` | The invoice can be sent. Fix it when you can: a buyer uses the missing value to recognise the invoice. |

Every rule, with its place and its meaning, is in the [Validation rules catalogue](https://efactura.rdcopilot.com/docs/statuses-and-errors/validation-rules/).

## Fix the draft

Change what the checks name. On a draft you can change the buyer identifier and the VAT rate of lines, each line named by its `code`. Send the revision you read as `expectedRevision`: the change is refused with `revision_conflict` if the draft moved on, and with `invalid_status` once the invoice is no longer a draft.

curl

```bash
curl -X PATCH "$RDC_BASE_URL/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "b2204d35-a1cb-40ef-b3b2-c4578dc20574",
  "expectedRevision": 1,
  "partnerCif": "RO39172851",
  "lines": [
    {
      "code": "DT-0412",
      "vatRate": "21"
    }
  ]
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d`, {
  method: 'PATCH',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "b2204d35-a1cb-40ef-b3b2-c4578dc20574",
    "expectedRevision": 1,
    "partnerCif": "RO39172851",
    "lines": [
      {
        "code": "DT-0412",
        "vatRate": "21"
      }
    ]
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'PATCH',
    f'{os.environ["RDC_BASE_URL"]}/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'b2204d35-a1cb-40ef-b3b2-c4578dc20574',
        'expectedRevision': 1,
        'partnerCif': 'RO39172851',
        'lines': [
            {
                'code': 'DT-0412',
                'vatRate': '21',
            },
        ],
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "b2204d35-a1cb-40ef-b3b2-c4578dc20574",
  "expectedRevision": 1,
  "partnerCif": "RO39172851",
  "lines": [
    {
      "code": "DT-0412",
      "vatRate": "21"
    }
  ]
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'PATCH',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('RDC_TOKEN'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl);
```

C#

```csharp
using System.Net.Http.Headers;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Patch, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/efactura/v1/invoices/ab7f7203-2bf2-4131-8b1b-34041c1afe3d");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "b2204d35-a1cb-40ef-b3b2-c4578dc20574",
  "expectedRevision": 1,
  "partnerCif": "RO39172851",
  "lines": [
    {
      "code": "DT-0412",
      "vatRate": "21"
    }
  ]
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "b2204d35-a1cb-40ef-b3b2-c4578dc20574",
  "status": "accepted",
  "aggregateId": "ab7f7203-2bf2-4131-8b1b-34041c1afe3d",
  "aggregateRevision": 2
}
```

Read the checks again. A rate the gateway does not accept on an invoice is refused with `invalid_vat_rate`; a `code` the invoice does not have is refused with `no_such_line`.

## Send only when nothing blocks

1.  Create the draft
    
    Read `aggregateId` from the operation and read the checks.
    
2.  Show what fails
    
    Show `message` of each failing check to the person who can fix it. Do not match on the text of `message`: it can change. Match on `rule`.
    
3.  Change and check again
    
    Repeat until `canSend` is true.
    
4.  Send
    
    [Send and follow](https://efactura.rdcopilot.com/docs/send/send-and-follow/) the invoice.
    

The gateway checks what it can check before the upload. The authority runs its own checks on the file, so an invoice that passes here can still come back `rejected`. See [The authority’s answers](https://efactura.rdcopilot.com/docs/statuses-and-errors/authority-answers/).
