---
title: "Pregătește dosarul de explicații | Documentație | e-TVA Check by R&D Copilot"
description: "Citește explicațiile unei perioade, cere unei a doua persoane să aprobe dosarul, retrage aprobarea dacă ceva se schimbă, marchează dosarul ca depus și exportă-l."
canonical: "https://etva.rdcopilot.com/ro/docs/guides/prepare-the-explanation-file/"
language: ro
updated: 2026-11-22
---

# Pregătește dosarul de explicații

Citește explicațiile unei perioade, cere unei a doua persoane să aprobe dosarul, retrage aprobarea dacă ceva se schimbă, marchează dosarul ca depus și exportă-l.

Fiecare perioadă are un singur dosar de explicații. El conține explicația fiecărei diferențe: motivul, nota, cine a dat-o și când. Dosarul trece prin trei stări: `draft`, `approved` și `filed`. Persoana care l-a pregătit nu îl poate aproba, iar dosarul nu poate fi aprobat cât timp un rând este `to_review`.

1.  Citește explicațiile
    
    `listExplanations` returnează ce a fost explicat până acum.
    
2.  Verifică dosarul
    
    `getExplanationFile` arată `toReview` și `canApprove`. Continuă când `toReview` este `0`.
    
3.  Aprobă
    
    O a doua persoană trimite `approveFile`. Dosarul devine `approved`.
    
4.  Marchează-l ca depus
    
    `markFiled` consemnează că dosarul aprobat este depus. Această stare este finală.
    
5.  Sau retrage
    
    `withdrawApproval` readuce dosarul aprobat la `draft`, iar perioada primește din nou modificări.
    
6.  Exportă-l
    
    `getExport` cu tipul `explanation-file` returnează dosarul ca CSV.
    

## Citește explicațiile

Fiecare intrare numește diferența (`differenceId`, `kind`, `rowIds`, `vat`), `reason`, `note`, `explainedBy` și `explainedAt`, precum și documentul sau înregistrarea la care se referă. O diferență fără explicație nu apare aici; găsește-o cu `listDifferences` și `state=open`.

curl

```bash
curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?limit=20" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?limit=20`, {
  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"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?limit=20',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?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#

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

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanations?limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 200

```json
{
  "items": [
    {
      "differenceId": "e59c4466-b33f-4875-9be1-0fdd35eb90f1",
      "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "kind": "missing-at-authority",
      "rowIds": [
        "sales-standard"
      ],
      "vat": "417.04",
      "reason": "missing_in_efactura",
      "note": "The upload was answered nok. The corrected invoice BRD-2026-00402 went out on 3 October and belongs to the October return.",
      "explainedBy": "ioana-marin",
      "explainedAt": "2026-11-20T09:05:00Z",
      "documentId": null,
      "postingId": "6861594d-27de-4565-a1fe-72c97fa04d2d"
    },
    {
      "differenceId": "50ad54ee-d206-4a82-a336-193ccffdc407",
      "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "kind": "rate",
      "rowIds": [
        "purchases-standard",
        "purchases-reduced"
      ],
      "vat": "3198.40",
      "reason": "different_rate",
      "note": "The supplier invoiced the reduced rate. The posting used the standard rate and was corrected on 5 October.",
      "explainedBy": "ioana-marin",
      "explainedAt": "2026-11-20T09:18:00Z",
      "documentId": "85cc4550-2ac5-4c3b-9bd4-ba2d9a49615b",
      "postingId": "6ff78d02-0631-4bec-9aba-31bfda7f8707"
    },
    {
      "differenceId": "766d779d-1961-487c-bed6-c5b78c5012df",
      "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
      "kind": "other-period",
      "rowIds": [
        "purchases-reduced"
      ],
      "vat": "-1164.61",
      "reason": "different_period",
      "note": "Dated 30 September, received on 2 October and posted in October. It is claimed in the October return.",
      "explainedBy": "ioana-marin",
      "explainedAt": "2026-11-20T09:31:00Z",
      "documentId": "b2655523-f9ca-43d4-86de-0de02dbafab3",
      "postingId": "9de91d7a-54a0-488b-b74f-6dc378caa04c"
    }
  ],
  "nextCursor": null
}
```

## Citește starea dosarului

curl

```bash
curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file`, {
  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"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file');
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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 200

```json
{
  "periodId": "79509f60-565a-40eb-a4c3-709e5d49e517",
  "state": "draft",
  "preparedBy": "ioana-marin",
  "approvedBy": null,
  "approvedAt": null,
  "filedAt": null,
  "explained": 3,
  "toReview": 2,
  "canApprove": false,
  "revision": 1
}
```

`explained` numără diferențele cu explicație, iar `toReview` rândurile încă de revizuit. `canApprove` este `true` numai când dosarul este ciornă și `toReview` este `0`. Aici `toReview` este `2`: `sales-standard` și `purchases-standard` așteaptă explicația duplicatului `BRD-2026-00372` și a facturii lipsă `AC-004563`. După ce ambele sunt explicate, dosarul arată `explained` `5`, `toReview` `0` și `canApprove` `true`.

## Aprobă cu a doua persoană

Dosarul perioadei septembrie este la revizia 1, iar două rânduri sunt `to_review`. Aprobarea este refuzată până când cele două diferențe deschise sunt explicate. Trimisă acum, cu `expectedRevision` `1`, ea primește `409` `rows_to_review`:

Aprobare la revizia 1

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "eb5bab15-e4a9-42bc-a0f0-96ac94f47333",
  "expectedRevision": 1,
  "approvedBy": "ana-rusu"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "eb5bab15-e4a9-42bc-a0f0-96ac94f47333",
    "expectedRevision": 1,
    "approvedBy": "ana-rusu"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'eb5bab15-e4a9-42bc-a0f0-96ac94f47333',
        'expectedRevision': 1,
        'approvedBy': 'ana-rusu',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "eb5bab15-e4a9-42bc-a0f0-96ac94f47333",
  "expectedRevision": 1,
  "approvedBy": "ana-rusu"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve');
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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "eb5bab15-e4a9-42bc-a0f0-96ac94f47333",
  "expectedRevision": 1,
  "approvedBy": "ana-rusu"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 409

```json
{
  "code": "rows_to_review",
  "message": "A row is still `to_review`. The file cannot be approved while a row has a difference nobody explained."
}
```

Nu s-a aplicat nimic, deci revizia rămâne `1`. Explică factura lipsă `AC-004563` (revizia 1 la 2, vezi [Rezolvă o factură lipsă](https://etva.rdcopilot.com/ro/docs/guides/resolve-a-missing-invoice/)) și duplicatul `BRD-2026-00372` (revizia 2 la 3, vezi [Rezolvă un duplicat](https://etva.rdcopilot.com/ro/docs/guides/resolve-a-duplicate/)). Perioada este atunci la revizia 3, iar `toReview` este `0`.

`approvedBy` trebuie să fie altă persoană decât `preparedBy`. Dosarul a fost pregătit de `ioana-marin`. Când îl aprobă ea, la revizia 3, răspunsul este `409` `same_person`:

Aprobare de către cel care a pregătit dosarul, la revizia 3

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "51860553-0805-406c-bdd5-129bfa51a338",
  "expectedRevision": 3,
  "approvedBy": "ioana-marin"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "51860553-0805-406c-bdd5-129bfa51a338",
    "expectedRevision": 3,
    "approvedBy": "ioana-marin"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '51860553-0805-406c-bdd5-129bfa51a338',
        'expectedRevision': 3,
        'approvedBy': 'ioana-marin',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "51860553-0805-406c-bdd5-129bfa51a338",
  "expectedRevision": 3,
  "approvedBy": "ioana-marin"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve');
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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "51860553-0805-406c-bdd5-129bfa51a338",
  "expectedRevision": 3,
  "approvedBy": "ioana-marin"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 409

```json
{
  "code": "same_person",
  "message": "The file was prepared by the person who is approving it."
}
```

Apoi `ana-rusu` îl aprobă, tot la revizia 3. Perioada trece la revizia 4.

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
  "expectedRevision": 3,
  "approvedBy": "ana-rusu"
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
    "expectedRevision": 3,
    "approvedBy": "ana-rusu"
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '384bfa16-2916-43da-a678-c6dcb3d17365',
        'expectedRevision': 3,
        'approvedBy': 'ana-rusu',
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
  "expectedRevision": 3,
  "approvedBy": "ana-rusu"
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve');
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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/approve");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
  "expectedRevision": 3,
  "approvedBy": "ana-rusu"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 202

```json
{
  "operationId": "384bfa16-2916-43da-a678-c6dcb3d17365",
  "status": "accepted",
  "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
  "aggregateRevision": 4
}
```

Dosarul este acum `approved`, cu `approvedBy` și `approvedAt`, iar evenimentul `file.approved` este trimis. O aprobare este refuzată în patru cazuri:

| Refuzată cu | Cod | De ce |
| --- | --- | --- |
| `409` | `rows_to_review` | Un rând este `to_review`. Explică mai întâi diferențele lui deschise. |
| `409` | `same_person` | `approvedBy` este persoana care a pregătit dosarul. |
| `409` | `wrong_file_state` | Dosarul nu este ciornă. |
| `409` | `revision_conflict` | Perioada s-a schimbat după ce ai citit-o. |

## Cât timp dosarul nu este ciornă

Un dosar aprobat sau depus blochează perioada. Orice modificare sub ea este refuzată cu `409` `file_locked`: explicarea, redeschiderea, legarea, dezlegarea, stabilirea limitelor și ambele feluri de import. Citirea nu este afectată. Retrage aprobarea ca să modifici perioada.

## Marchează dosarul ca depus

Când dosarul aprobat este depus în evidențele tale, consemnează acest lucru, la revizia 4. `filed` este stare finală: nimic din perioadă nu se mai schimbă după aceea, iar aprobarea nu mai poate fi retrasă. Perioada trece la revizia 5, iar evenimentul `file.filed` este trimis.

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/file" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
  "expectedRevision": 4
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/file`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
    "expectedRevision": 4
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/file',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': '04f88665-ccc8-4585-8692-f17d17aecc5a',
        'expectedRevision': 4,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
  "expectedRevision": 4
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/file');
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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/file");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
  "expectedRevision": 4
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 202

```json
{
  "operationId": "04f88665-ccc8-4585-8692-f17d17aecc5a",
  "status": "accepted",
  "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
  "aggregateRevision": 5
}
```

## Retrage aprobarea în loc să depui

Din dosarul aprobat, la revizia 4, există o a doua cale: retragi aprobarea în loc să depui. Și atunci perioada trece la revizia 5, iar o aprobare nouă citește revizia 5.

curl

```bash
curl -X POST "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/withdraw" \
  -H "Authorization: Bearer $RDC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
  "expectedRevision": 4
}'
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/withdraw`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.RDC_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
    "expectedRevision": 4
  }),
});
const result = await response.json();
```

Python

```python
import os
import requests

response = requests.request(
    'POST',
    f'{os.environ["RDC_BASE_URL"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/withdraw',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
    json={
        'operationId': 'e3c563ae-a533-4679-930f-f456d01e8362',
        'expectedRevision': 4,
    },
)
result = response.json()
```

PHP

```php
<?php

$body = <<<'JSON'
{
  "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
  "expectedRevision": 4
}
JSON;

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/withdraw');
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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/explanation-file/withdraw");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
  "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
  "expectedRevision": 4
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 202

```json
{
  "operationId": "e3c563ae-a533-4679-930f-f456d01e8362",
  "status": "accepted",
  "aggregateId": "79509f60-565a-40eb-a4c3-709e5d49e517",
  "aggregateRevision": 5
}
```

Dosarul revine la `draft`, iar `approvedBy` este șters. Retragerea merge numai pe un dosar `approved`; pe unul `draft` sau `filed` răspunsul este `409` `wrong_file_state`. După o modificare, dosarul are nevoie de o aprobare nouă.

## Exportă dosarul

Exportul este un fișier CSV, cu o linie pe diferență explicată: `kind`, `rows`, `vat`, `reason`, `note`, `explained_by` și `explained_at`. Este făcut din perioada așa cum este acum, în orice stare a dosarului.

Exportul dosarului de explicații

curl

```bash
curl "$RDC_BASE_URL/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/exports/explanation-file" \
  -H "Authorization: Bearer $RDC_TOKEN"
```

JavaScript

```javascript
const response = await fetch(`${process.env.RDC_BASE_URL}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/exports/explanation-file`, {
  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"]}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/exports/explanation-file',
    headers={
        'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
    },
)
result = response.json()
```

PHP

```php
<?php

$curl = curl_init(getenv('RDC_BASE_URL') . '/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/exports/explanation-file');
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")}/etva/v1/periods/79509f60-565a-40eb-a4c3-709e5d49e517/exports/explanation-file");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
```

Răspuns 200

```json
{
  "kind": "explanation-file",
  "name": "brumar-2026-09-explanation-file.csv",
  "contentType": "text/csv",
  "content": "kind,rows,vat,reason,note,explained_by,explained_at\nmissing-at-authority,sales-standard,417.04,missing_in_efactura,The upload was answered nok. The corrected invoice BRD-2026-00402 went out on 3 October and belongs to the October return.,ioana-marin,2026-11-20T09:05:00Z\nrate,purchases-standard purchases-reduced,3198.40,different_rate,The supplier invoiced the reduced rate. The posting used the standard rate and was corrected on 5 October.,ioana-marin,2026-11-20T09:18:00Z\nother-period,purchases-reduced,-1164.61,different_period,\"Dated 30 September, received on 2 October and posted in October. It is claimed in the October return.\",ioana-marin,2026-11-20T09:31:00Z\n"
}
```

Evenimentele sunt în [catalogul de evenimente](https://etva.rdcopilot.com/ro/docs/events/event-catalogue/). Câmpurile operațiilor pentru explicații sunt în [referința pentru explicații](https://etva.rdcopilot.com/ro/docs/api-reference/explanations/).
