Anaf v1 / Declarații D
Render PDF
The return as a PDF, the way a person reads it — for the file, for the client or for signing. The response is the document itself, not JSON.
POST
https://oneapi.ro/api/anaf/v1/declaratii/{form}/render
Path parameters
NameTypeDescriptionExample
formrequired
string
Form code (
D100, D112, D300, D394…). The full list is at /anaf/v1/declaratii/forms.
Request body
The request body is the whole document, sent raw (Content-Type: application/xml) — not an object with fields.
D394
D100
D390
D311
Query parameters
This route accepts no query parameters.
How it behaves
- The document can also be sent as a file:
multipart/form-datawith thefisierfield (curl -F fisier=@document.xml), instead of the raw body. The file content becomes the request body, so the result is identical; options stay in the query string, and any other form field next tofisierreturns422 camp_necunoscut. - Takes the XML of a "D" declaration and returns a readable PDF. Local (dompdf), in-memory.
- Zero retention: the XML received is not written and not logged.
What it is for
- A printable copy of the declaration, for the file.
Response structure
FieldTypeDescription
Response examples
body: @d394.xml
POSThttps://oneapi.ro/api/anaf/v1/declaratii/D394/render
The response is a binary document, not JSON: application/pdf, 26,6 KB in this example.
body: @d100.xml
POSThttps://oneapi.ro/api/anaf/v1/declaratii/D100/render
The response is a binary document, not JSON: application/pdf, 22,8 KB in this example.
body: @d390.xml
POSThttps://oneapi.ro/api/anaf/v1/declaratii/D390/render
The response is a binary document, not JSON: application/pdf, 23,8 KB in this example.
body: @d311.xml
POSThttps://oneapi.ro/api/anaf/v1/declaratii/D311/render
The response is a binary document, not JSON: application/pdf, 22,8 KB in this example.
Error codes
| Code | Slug | When it occurs |
|---|---|---|
| 401 | neautentificat | Token missing, invalid, expired or revoked. |
| 403 | feature_indisponibil | The current plan does not include the feature the route depends on. |
| 404 | negasit | Unsupported form. |
| 422 | xml_invalid | Invalid XML — it cannot be rendered. |
| 429 | cota_depasita | The plan's monthly quota has been exceeded (see Retry-After). |
Errors in the Anaf module use the same envelope as the rest of the platform, with two extra fields: {eroare: {cod, mesaj, camp, request_id}}. eroare.cod is stable and is what you branch on; on validation (422) the code is case-specific: xml_invalid, xml_nu_e_factura, unitate_necunoscuta, luna_invalida and so on. camp points at the offending field when one can be identified.
{
"eroare": {
"cod": "xml_invalid",
"mesaj": "Invalid XML — it cannot be rendered.",
"camp": "form",
"request_id": "0199c1f0-6e1a-7c3d-9b2f-4a8e5d1c7b04"
}
}