---
title: "Validate before approval | Docs | Tax Filing by R&D Copilot"
description: "Read the findings, understand the rules, and rebuild the form that is behind until the errors are gone."
canonical: "https://declarations.rdcopilot.com/docs/guides/validate-before-approval/"
language: en
updated: 2026-11-22
---

# Validate before approval

Read the findings, understand the rules, and rebuild the form that is behind until the errors are gone.

The checks look at one return and at the other returns of the same company and period. An `error` blocks signing, approving and filing. A `warning` is for you to read and does not block.

## The rules

| Rule | Severity | Forms | Requires |
| --- | --- | --- | --- |
| `X-01` | `error` | D300, D394 | The supplies and acquisitions of D394 must equal the rows of D300, by rate. |
| `X-02` | `error` | D300, D390 | The acquisitions of D390 must equal the acquisitions from other member states in D300. |
| `S-01` | `error` | D406 | The total debit of the ledger must equal its total credit. |
| `P-01` | `error` | D394 | Every partner row must carry a tax code. |
| `W-01` | `warning` | D300 | The return shows VAT to recover. |

The catalogue is also an operation: [listRules](https://declarations.rdcopilot.com/docs/api-reference/returns/#list-rules).

## Read the findings

The sample is the VAT return of October. It was signed from snapshot 1, when it agreed with the recapitulative statement D390. Then a purchase from another member state was posted late and D390 was rebuilt from snapshot 2; the VAT return was not. The finding names the rule `X-02`, the `row` and the two amounts that differ, so `canApprove` is false.

curl

```bash
curl "$RDC_BASE_URL/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings`, {
  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"]}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings');
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")}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/findings");
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
{
  "returnId": "3b559a77-5de4-4b9a-9e2e-ca6625d123f2",
  "revision": 4,
  "canApprove": false,
  "errors": 1,
  "warnings": 0,
  "findings": [
    {
      "rule": "X-02",
      "severity": "error",
      "row": "ic-acquisitions",
      "message": "The acquisitions of D390 must equal the acquisitions from other member states in D300. This return has 5252.00; D390 has 8534.50."
    }
  ]
}
```

## Fix the form that is behind

1.  Find the older build
    
    Read the `snapshot` of both returns. The one with the smaller number was built from the older ledger.
    
2.  Rebuild it
    
    [regenerateReturn](https://declarations.rdcopilot.com/docs/api-reference/returns/#regenerate-return) builds it from the newest snapshot and puts it back to `generated`. Its validation and its signature are replaced; the history keeps them.
    
3.  Validate it
    
    [validateReturn](https://declarations.rdcopilot.com/docs/api-reference/returns/#validate-return) records the validation. When both returns agree, the error is gone from both.
    
4.  Sign it again
    
    [signReturn](https://declarations.rdcopilot.com/docs/api-reference/evidence/#sign-return) records a new signature on the new build.
    
5.  Read the findings again
    
    `canApprove` is true. Now the return can be approved.
    

curl

```bash
curl -X POST "$RDC_BASE_URL/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
  "expectedRevision": 5
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
    "expectedRevision": 5
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '87fbb260-7b9b-436b-bfd0-8ee38a87676e',
        'expectedRevision': 5,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
  "expectedRevision": 5
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate');
curl_setopt_array($curl, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    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.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/declarations/v1/returns/3b559a77-5de4-4b9a-9e2e-ca6625d123f2/validate");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
  "expectedRevision": 5
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Response 202

```json
{
  "operationId": "87fbb260-7b9b-436b-bfd0-8ee38a87676e",
  "status": "accepted",
  "aggregateId": "3b559a77-5de4-4b9a-9e2e-ca6625d123f2",
  "aggregateRevision": 6
}
```

A validation that finds an error does not change the status of the return: it stays `generated`, and the failed run is written to its history with the number of errors.
