RO Intrastat Service
Access info
Endpoint | https://ro-intrastat-api.socrate.io/graphql |
Required access keys | Tenant-level service access key |
Pricing | Please contact us for details at contact@bitsoftware.ro |
Notes | To call the service, the access key must be provided in the x-api-key header of the HTTP request. If you are using the GraphQL console, you can view the service’s documentation and schema only after entering an access key. Make sure that the scope of the key allows access to the queries and mutations that you require. For example, to grant the key access to all queries and mutations, the keys’s scope must be set to ro-intrastat-api:query:* ro-intrastat-api:mutation:* . |
Usage
The RO Intrastat service enables calling applications to generate Intrastat declarations in XML format required for reporting to Romanian National Institute of Statistics. Intrastat is a system for collecting statistical data on trade in goods between member states of the European Union. Intrastat reporting is mandatory for economic operators that export or import goods (not services) between Romania and other EU member states, if the volume exceeds a certain threshold established yearly by Romanian authorities. For more information about Intrastat reporting, visit http://www.intrastat.ro.
Requirements
- The organization(s) for which reporting is done must exist in the SBS system. You can add new organizations through the Organizations Service.
- Depending on the declaration type you are creating (Imports or Exports), your application must generate from the ERP system the following CSV files to be used as input:
Input CSV files
When generating the CSV files to be used as input to the Intrastat Declarations service, keep in mind the following:
- Each CSV file is comma-separated;
- The first row in the CSV file should provide the column names (that is, the CSV file must include the header).
Imports.csv
Column | Validation | Description |
---|---|---|
Cn8Code | Mandatory | Specifies The 8-digit commodity code of the imported good. The value must contain 8 digits and must be in the Combined Nomenclature for the respective year (for example, http://www.intrastat.ro/doc/CN_2023.xml). |
CountryOfOrigin | Mandatory | The country code of the country where the good was produced. The code’s maximum length is 2 characters. Also, the country code must be in the Countries Nomenclature (http://www.intrastat.ro/doc/nomenclatoare.xls). |
CountryOfConsignment | Mandatory | The country code of the country from which goods are imported. The country code’s maximum length is 2 characters. Also, the country code must be in the “EU Countries_2022.xml” (which can be found in the Program Files folder after installing the offline INTRASTAT application on Windows). |
InvoiceValue | Mandatory | The value of the commodity indicated on the invoice, which might contain transport and insurance costs according to the delivery terms but not taxes or levies. The value should be given in RON, without decimals. Only positive values are accepted. |
StatisticalValue | Optional | The value of a product at the time of border crossing. The value should be given in RON, without decimals. |
NetMass | Mandatory | The weight in kilograms without packaging of any kind. The value should be given in kilograms, without decimals. Note that product items weighing less than 0.5 kg must be entered with 0. For further information, see the “Handbook for Intrastat Data Providers, Part I”, chapter 7.3.3. |
SupplUnitCode | Conditional | For certain products, the quantity in supplementary units must be declared. For example, if CN8 commodity code is 01012100, then the supplementary unit code is p/st. The list of valid supplementary unit codes is given in the “Handbook for Intrastat Data Providers, Part I”, appendix 6. |
QtyInSupplUnits | Conditional | The quantity of products expressed in supplementary units (other than kilograms) as declared in the “Supplementary unit code” field, see above. Must be a positive integer value. |
NatureOfTransactionACode | Mandatory | A code that provides information about the nature of transaction. The transaction code must be in the “Natura Tranzactiei” Nomenclature, column A (http://www.intrastat.ro/doc/nomenclatoare.xls). |
NatureOfTransactionBCode | Mandatory | A code that provides information about the nature of transaction. The transaction code must be in the “Natura Tranzactiei” Nomenclature, column B (http://www.intrastat.ro/doc/nomenclatoare.xls). |
DeliveryTermsCode | Mandatory | A code that provides information about the terms of delivery. The code must be in the “Natura Termeni Livrare” Nomenclature (http://www.intrastat.ro/doc/nomenclatoare.xls). |
ModeOfTransportCode | Mandatory | A code that provides information about the mode of transport. The code must be in the “Nomenclator Transport” Nomenclature (http://www.intrastat.ro/doc/nomenclatoare.xls). |
Exports.csv
Column | Validation | Description |
---|---|---|
Cn8Code | Mandatory | The 8-digit commodity code of the exported good. The value must contain 8 digits and must be in the Combined Nomenclature for the respective year (for example, http://www.intrastat.ro/doc/CN_2023.xml). |
CountryOfOrigin | Mandatory | The country code of the country where the good was produced. The maximum length is 2 characters. The country code must be in the Countries Nomenclature (http://www.intrastat.ro/doc/nomenclatoare.xls). |
CountryOfDestination | Mandatory | The country code of the country to which goods are exported. The maximum length is 2 characters. The country code must be in the “EU Countries_2022.xml” (which can be found in the Program Files folder after installing the offline INTRASTAT application on Windows). |
PartnerCountryCode | Mandatory | The country of VAT registration of the partner to which goods are exported. The maximum length is 2 characters. The country code must be in the ““EU Countries_2022.xml”” (which can be found in the Program Files folder after installing the offline INTRASTAT application on Windows). |
PartnerVatNr | Mandatory | The VAT registration number of the partner to which goods are exported. This value must be a valid VAT number in the country declared in “Partner country”. If the partner country is “QV” (Unknown), then value 999999999999 is acceptable. |
InvoiceValue | Mandatory | The value of the commodity indicated on the invoice, which might contain transport and insurance costs according to the delivery terms but not taxes or levies. Must be given in RON, without decimals. Only positive values are accepted. |
StatisticalValue | Optional | The value of the product at the time of border crossing. Must be given in RON, without decimals. |
NetMass | Mandatory | The weight in kilograms without packaging of any kind. Must be given in kilograms, without decimals. Product items weighing less than 0.5 kg must be entered with 0. For further information, see the “Handbook for Intrastat Data Providers, Part I”, chapter 7.3.3. |
SupplUnitCode | Conditional | For certain products, the quantity in supplementary units must be declared. For example, if CN8 commodity code is 01012100, then the supplementary unit code is p/st. The list of valid supplementary unit codes is given in the “Handbook for Intrastat Data Providers, Part I”, appendix 6. |
QtyInSupplUnits | Conditional | The quantity of products expressed in supplementary units (other than kilograms) as declared in the “Supplementary unit code” field, see above. Must be a positive integer value. |
NatureOfTransactionACode | Mandatory | A code that provides information about the nature of transaction. The transaction code must be in the “Natura Tranzactiei” Nomenclature, column A (http://www.intrastat.ro/doc/nomenclatoare.xls). |
NatureOfTransactionBCode | Mandatory | A code that provides information about the nature of transaction. The transaction code must be in the “Natura Tranzactiei” Nomenclature, column B (http://www.intrastat.ro/doc/nomenclatoare.xls). |
DeliveryTermsCode | Mandatory | A code that provides information about the terms of delivery. The code must be in the “Natura Termeni Livrare” Nomenclature (http://www.intrastat.ro/doc/nomenclatoare.xls). |
ModeOfTransportCode | Mandatory | A code that provides information about the mode of transport. The code must be in the “Nomenclator Transport” Nomenclature (http://www.intrastat.ro/doc/nomenclatoare.xls). |
How it works
The process of generating a valid XML declaration file consists of the following steps:
-
Create the Intrastat reporting organization through the Organization Service. Note that the organization must have a valid fiscal identification code (in Romanian, CUI - cod unic de identificare). If the organization already exists, find out its unique ID within the Organizations Service, which is required for the next step.
-
Run the
initiateDeclaration
mutation. You will need to supply the following mandatory input parameters:- Declaration type - this can be a NEW, REVISED, or NILL declaration. NEW indicates that the declaration is transmitted for the first time. REVISED means that a previously submitted declarations is being updated. NILL merely indicates that no import or export operations took place within the reported period.
- File type - this specifies the flow of reported Intra-EU transactions, and can be either Import (for arrivals) or Export (for dispatches).
- Month and year - these values indicate the reporting period of the declaration.
- Organization ID - this is the ID of the organization which is responsible for the Intrastat declaration. You can obtain the ID after creating the organization through the Organization Service.
- Representative - provides details about the contact person submitting the declaration.
After running the mutation, you obtain a
Declaration
object which has a unique identifier. So far, the declaration object does not have any files or processes associated with it, so itsfiles
andprocesses
attributes are null. -
Generate Imports.csv (or Exports.csv, as applicable) from your ERP system.
-
Run the
prepareFile
mutation (this step and the next one are not required for NILL declarations). As a result, you obtain a file upload URL. If your source data comes from multiple CSV files (perhaps generated from different sources), make sure to run theprepareFile
mutation for each CSV file. Importantly, all the CSV files must be of the same type (either imports or exports). -
Upload the CSV file(s) to the URL(s) generated in the previous step. This step consists of sending an HTTP PUT request to the upload URL with the CSV file in the request body. Once the upload is complete, the
files
attribute of theDeclaration
object is populated with a new item that reflects the uploaded file information. -
Run the
generateDeclaration
mutation. As a result, a new declaration computation process is triggered. The process details (ID, status) are returned in the response of thegenerateDeclaration
mutation. You can subsequently query the process status through thedeclarations
query. Note that, if you rungenerateDeclaration
multiple times, a new process (with a different process ID) is triggered for each run. -
To view the status of the declaration’s computation process, run the
declarations
query and pay attention to theprocesses
attribute (more specifically, to the ID of the process generated previously).- If the process is reported as INPROCESS, this means it is running. If necessary, you can kill long running processes through the
killProcess
mutation. - If the process encountered errors, the status is ERROR. The actual errors are reported in the
errorMessages
attribute of theProcess
object. - If the process completed successfully, the status is DONE and the
result
attribute of the process provides the download URL of the generated XML declaration.
- If the process is reported as INPROCESS, this means it is running. If necessary, you can kill long running processes through the
The duration of a process depends on the size of the input CSV files.
Validation
At the time of writing this documentation (August 2023), the Romanian National Institute of Statistics (INS) does not provide a public API for validating Intrastat declarations. You can validate Intrastat declarations only locally, after installing the “Intrastat Offline” application provided by INS (available on Windows only). For details, see the “User Guide for Intrastat Offline application”.
Queries
declarations
Lists the declarations defined for the given tenant. The results of their computation processes can be found in the corresponding declaration process list.
Arguments
Argument | Type | Description |
---|---|---|
filter | DeclarationsFilter! |
Mandatory. Provides filtering options, as a DeclarationsFilter input. |
DeclarationsFilter
input
Attribute | Type | Description |
---|---|---|
organizationId | ID |
Conditional. If provided, the result will include only declarations for this organization. |
id | ID |
Conditional. If provided, only the declaration identified by this ID will be returned. |
Result
The result is an array of Declaration
objects.
Declaration
type
Attribute | Type | Description |
---|---|---|
id | ID |
The declaration’s unique identifier generated by SBS. |
organization | Organization |
The organization’s details, as Organization type. |
representative | Representative |
The representative’s details, as Representative type. |
declarationType | DeclarationType |
The type of declaration. Valid values: NEW, REVISED, NILL. |
fileType | CsvFileType |
The type of declaration file. Valid values: Import, Export. |
month | Int |
The month component of the reporting period. |
year | Int |
The year component of the reporting period. |
files | [File] |
The list of files associated with the current declaration. See the File type. |
processes | [Process] |
The list of processes associated with the current declaration. You can optionally filter processes by supplying a ProcessesFilterInput object as input argument. For the structure of a process, see the Process type. |
createdAt | DateTime |
The date and time when the declaration was created. |
Organization
type
Attribute | Type | Description |
---|---|---|
id | ID |
The declaration’s unique identifier generated by SBS. |
name | String |
The organization’s name. |
tin | String |
Specifies the organization’s tax identification number (TIN) (in Romanian, CIF - cod de identificare fiscală) issued by ANAF (National Agency for Fiscal Administration) (in Romanian, ANAF - Agenția Națională de Administrare Fiscală). |
regNo | String |
Specifies the organization’s registration number issued by the National Trade Registration Office (in Romanian, ONRC - Oficiul National al Registrului Comerțului). |
Representative
type
Attribute | Type | Description |
---|---|---|
firstName | String |
The first name of the representative. |
lastName | String |
The last name of the representative. |
phone | String |
The phone number of the representative. |
EmailAddress |
The representative’s email address. |
File
type
Attribute | Type | Description |
---|---|---|
id | ID |
The unique identifier of the file. You an use this ID to refer to the file also through the File Management Service. |
declarationId | ID |
The unique identifier of the Intrastat declaration. |
fileType | CsvFileType |
The type of data reported by the file. Valid values: Import, Export. |
name | String |
The file name. |
uploadUrl(expiresIn) | Uri |
Generates an upload URL for the file in case existing content needs to be replaced. Note that the upload URL expires after the number of seconds supplied in the expiresIn parameter (default is 30 seconds). The file size limit for upload is 5 GB. |
createdAt | DateTime |
The date and time when the file was created. |
ProcessesFilter
input
Attribute | Type | Description |
---|---|---|
id | ID |
The ID of the process that you would like to filter by. |
Process
type
Attribute | Type | Description |
---|---|---|
id | ID |
The unique identifier of the file. |
status | DeclarationStatus |
The status of the declaration. Valid values: INPROCESS - computation has not started yet, INPROCESS - computation is in progress, DONE - computation has completed without errors, ERROR - computation has completed with errors. |
errorMessages | [String] |
The list of error messages, if applicable. |
result | [ResultFile] |
The list of files created by the process, as ResultFile type. |
createdAt | DateTime |
The date and time when the process was created. |
ResultFile
type
Attribute | Type | Description |
---|---|---|
id | ID |
The ID of the file. |
name | String |
The file name. |
createdAt | DateTime |
The date and time when the file was created. |
downloadUrl(expiresIn ) |
Uri |
The URL at which the file can be downloaded. Note that the download URL expires after the number of seconds supplied in the expiresIn parameter. |
organizations
Returns a list of active organizations defined in the Organizations Service. This is a convenience query used to obtain the list of organizations without having to query the Organizations Service separately.
Result
The result is an array of Organization
. Note this is a simplified type compared to the Organization
type from the Organizations Service, and contains only the fields relevant for the RO Intrastat Service.
Organization
type
Attribute | Type | Description |
---|---|---|
id | ID! |
Specifies the organization’s unique identifier. |
name | String |
Specifies the organization’s name. |
tin | String |
Specifies the organization’s tax identification number (TIN) (in Romanian, CIF - cod de identificare fiscală) issued by ANAF (in Romanian, ANAF - Agenția Națională de Administrare Fiscală). |
regNo | String |
Specifies the organization’s registration number issued by the National Trade Registration Office (in Romanian, ONRC - Oficiul National al Registrului Comerțului). |
country | CountryCode |
Enum value that identifies the ISO 3166-2 two-letter country code. |
createdAt | DateTime |
The date and time when the organization record was created in SBS. |
version
Returns the API version.
Mutations
deleteDeclaration
Deletes a declaration, including all its input files and related processes.
Arguments
Attribute | Type | Description |
---|---|---|
id | ID! |
Mandatory. The identifier of the declaration to be deleted. |
Result
See the Declaration
type.
deleteFile
Deletes a previously uploaded CSV file.
Arguments
Attribute | Type | Description |
---|---|---|
input | DeleteFileInput |
Mandatory. Supplies the input to the mutation, as DeleteFileInput object. |
DeleteFileInput
input
Attribute | Type | Description |
---|---|---|
declarationId | ID! |
Mandatory. The identifier of the declaration. |
id | ID! |
Mandatory. The identifier of the CSV file to be deleted. |
Result
See the File
type.
deleteProcess
Deletes a declaration computation process and the result XML files.
Arguments
Attribute | Type | Description |
---|---|---|
declarationId | ID! |
Mandatory. The identifier of the declaration. |
processId | ID! |
Mandatory. The identifier of the process to be deleted. |
Result
See the Process
type.
generateDeclaration
Starts a declaration computation process.
Arguments
Attribute | Type | Description |
---|---|---|
declarationId | ID! |
The ID of the declaration created previously through the initiateDeclaration mutation. |
Result
See the Process
type.
initiateDeclaration
Creates a new declaration, without triggering any computation processes. After this mutation, run prepareFile
for each CSV file that must be supplied as input to the declaration and obtain the file’s upload URL. After uploading the CSV files, run generateDeclaration
mutation to trigger the computation process.
Arguments
Attribute | Type | Description |
---|---|---|
input | InitiateDeclarationInput |
Provides the input to the mutation, as InitiateDeclarationInput object. |
InitiateDeclarationInput
input
Attribute | Type | Description |
---|---|---|
declarationType | DeclarationType! |
Mandatory. Identifies the type of declaration that is to be computed. Valid values: NEW, REVISED, NILL. |
fileType | CsvFileType! |
Mandatory. This is an enumeration that identifies the type of the CSV file. Valid values: Import, Export. |
month | Int! |
Mandatory. The month of the reporting period covered by the declaration. |
year | Int! |
Mandatory. The year of the reporting period covered by the declaration. |
organizationId | ID! |
Mandatory. The identifier of the organization defined through the Organizations service. |
representative | RepresentativeInput! |
Mandatory. Specifies details about the person submitting this declaration (representative), as a RepresentativeInput input. |
RepresentativeInput
input
Attribute | Type | Description |
---|---|---|
firstName | String! |
Mandatory. The first name of the representative. |
lastName | String! |
Mandatory. The last name of the representative. |
phone | String! |
Mandatory. The phone number of the representative. |
EmailAddress |
Optional. The representative’s email address. |
Result
See the Declaration
type.
killProcess
Stops a declaration computation process if it is running.
Arguments
Attribute | Type | Description |
---|---|---|
declarationId | ID! |
Mandatory. The identifier of the declaration. |
processId | ID! |
Mandatory. The identifier of the process to be stopped. |
Result
See the Process
type.
prepareFile
Generates a URL at which you can upload a CSV file to be used as input to the Intrastat declaration. Run this mutation for each CSV file that is to be supplied as input for a declaration.
Arguments
Attribute | Type | Description |
---|---|---|
input | PrepareFileInput |
Mandatory. Supplies the input to the mutation, as PrepareFileInput object. |
PrepareFileInput
input
Attribute | Type | Description |
---|---|---|
declarationId | ID! |
Mandatory. The identifier of the declaration. |
name | String |
Optional. Supplies the name of the CSV file. |
Result
See the File
type.
updateDeclaration
Update certain declaration parameters.
Arguments
Attribute | Type | Description |
---|---|---|
id | ID! |
Mandatory. The identifier of the declaration to be updated. |
input | UpdateDeclarationInput |
Provides the input to the mutation, as UpdateDeclarationInput object. |
UpdateDeclarationInput
input
Attribute | Type | Description |
---|---|---|
month | Int! |
Optional. The month of the reporting period covered by the declaration. |
year | Int! |
Optional. The year of the reporting period covered by the declaration. |
representative | RepresentativeInput |
Optional. Provides the representative’s details to be updated, as RepresentativeInput input. |
Result
See the Declaration
type.