RO e-Factura Service
The RO e-Factura Service enables calling applications to submit e-Factura invoices to the Romanian National Agency of Fiscal Administration (ANAF). The service also provides the ability to receive e-Factura invoices from ANAF, as well as retrieve information messages as provided by ANAF in real time.
Access info
| Endpoint | https://ro-efactura-api.socrate.io/graphql |
| Required access keys | Tenant-level service access key |
| Pricing | Check the available purchase options. |
| 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-efactura-api:query:* ro-efactura-api:mutation:*. |
Usage
In Romania, e-Factura reporting is mandatory for Business to Government (B2G) transactions, Business to Business (B2B) transactions, as well as for Business to Customer (B2C) transactions. For details, see https://mfinante.gov.ro/web/efactura/acasa.
As is the case of other SBS services, the RO e-Factura Service interacts with ANAF on your behalf and provides an abstraction layer to simplify ANAF reporting. More specifically, it enables you to perform the following tasks:
- manage authentication and secure access to ANAF
- receive e-Factura invoices from ANAF (inbound invoices)
- create e-Factura invoices and upload them to ANAF (outbound invoices)
- filter inbound or outbound invoices according to various criteria
- store invoices and view invoice-related messages received from ANAF beyond their 60 days expiry period
- send notification messages to the invoice sender, after receiving an invoice.
- send and receive invoices with attachments
Prerequisites
Before using this service, note the following prerequisites:
- The organization(s) for which e-Factura reporting takes place done must exist in the SBS system. You can add new organizations programmatically through the Organizations Service, or from the SBS Portal.
- Any application that communicates with ANAF, including your application, requires authorization with ANAF. Therefore your app must be configured to handle OAuth 2.0 authorization with ANAF, as described in Configure OAuth 2.0 for ANAF.
- Once the OAuth 2.0 secrets are configured for your app (see previous bullet), you must authorize with ANAF the organization(s) for which e-Factura reporting takes place. You can perform the authorization either programmatically or from the SBS Portal. To authorize an organization programmatically, run the
generateAuthorizationRequestmutation of the RO ANAF OAuth Service. For instructions about performing the authorization process from the SBS Portal, see Managing ANAF Authorizations.
Conventions
- There are two syntaxes accepted by ANAF for XML invoices: (i) the Universal Business Language (UBL) syntax and (ii) the Cross Industry Invoice (CII) syntax. On the SBS side, both the
createInvoicemutation and thepreviewInvoicequery generate invoices according to the UBL 2.1 syntax. - The “Queries” and “Mutations” sections on this page describe the GraphQL queries and mutations applicable to the e-Factura Service, in a similar way as this is done for all other SBS services. Note that, if a column “Code” is present for any field, it correlates the field with the respective business term (BT) or business group (BG) in the SR EN 16931-1+A1 standard, on which e-Factura reporting is based. The SR EN 16931-1+A1 standard can be acquired from the Romanian National Standardization Body (https://www.asro.ro).
Creating invoices
To create an invoice, run either the createInvoice or createInvoiceFromXml mutation. If you use createInvoiceFromXml, you can obtain the XML input for the mutation by running the previewInvoice query.
When you create or preview an invoice, the input must be valid; otherwise, the response contains the list of validation errors. To construct a valid invoice, do not rely solely on whether a field is represented as optional or mandatory in this documentation. The complete ANAF validation logic is too complex to be expressed by means of GraphQL optional/mandatory fields. Since the validation rules are subject to routine modifications by ANAF, the ultimate validation tool is the public ANAF e-Factura validation service (https://www.anaf.ro/uploadxmi/).
During development, it might be helpful to use the following online tool provided by ANAF: https://www.anaf.ro/CompletareFactura/faces/factura/informatiigenerale.xhtml. You could use it, for example, to find out what inputs are expected when creating an invoice. More specifically, you will notice that the “Code” column in the CreateInvoiceInput table correlates with the BT (business term) or BG (business group) codes displayed on the online form.
The following code listing illustrates creating an invoice through the createInvoice mutation:
mutation CreateInvoice($organizationId:ID!, $input:CreateInvoiceInput!) {
createInvoice(organizationId:$organizationId, input:$input) {
id
organizationId
invoiceNumber
issueDate
invoiceTypeCode
status
requestId
downloadId
messages { id, creationDate, tin, requestId, details, type },
xmlFile { id, downloadUrl(expiresIn:3600) },
pdfFile { id, downloadUrl(expiresIn:3600) },
zipFile{ id, downloadUrl(expiresIn:3600) },
uploadedToTestEnvironment,
accountingCustomerParty { partyName partyTaxScheme {companyID}}
accountingSupplierParty { partyName partyTaxScheme {companyID}}
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
createdAt
external
}
}
For the input variables, the code listing below illustrates creating a simple invoice where the company Alpha SRL invoices the company Beta SRL for the amount of 100 RON for the provided services. Your invoice data will, of course, be different. Note the following:
- YOUR_SUPPLIER_TIN and YOUR_CUSTOMER_TIN must be real tax identifier numbers (TIN) of Romanian companies. The TIN must be prefixed by the country code, for example, “RO1234567”.
{
"organizationId": "YOUR_ORGANIZATION_ID",
"input": {
"invoiceNumber": "ABC-123456",
"issueDate": "2024-01-30",
"dueDate": "2024-02-28",
"invoiceTypeCode": "380",
"taxPointDate": "2023-09-20",
"documentCurrencyCode": "RON",
"accountingSupplierParty": {
"party": {
"partyName": "Alpha SRL",
"partyTaxScheme": {
"companyID": "YOUR_SUPPLIER_TIN",
"taxScheme": {
"id": "VAT"
}
},
"partyLegalEntity": {
"registrationName": "Alpha SRL"
},
"postalAddress": {
"streetName": "Universului, 1",
"city": "Brasov",
"region": "RO-BV",
"country": "RO"
}
}
},
"accountingCustomerParty": {
"party": {
"partyName": "Beta SRL",
"partyTaxScheme": {
"companyID": "YOUR_CUSTOMER_TIN",
"taxScheme": {
"id": "VAT"
}
},
"partyLegalEntity": {
"registrationName": "Beta SRL"
},
"postalAddress": {
"streetName": "Lacului, 20",
"city": "Brasov",
"region": "RO-BV",
"country": "RO"
}
}
},
"taxTotal": {
"taxAmount": {
"currency": "RON",
"amount": 19
},
"taxSubtotals": {
"taxableAmount": {
"currency": "RON",
"amount": 100
},
"taxAmount": {
"currency": "RON",
"amount": 19
},
"taxCategory": {
"id": "S",
"percent": 19,
"taxScheme": {
"id": "VAT"
}
}
}
},
"legalMonetaryTotal": {
"lineExtensionAmount": {
"currency": "RON",
"amount": 100
},
"taxExclusiveAmount": {
"currency": "RON",
"amount": 100
},
"taxInclusiveAmount": {
"currency": "RON",
"amount": 119
},
"payableAmount": {
"currency": "RON",
"amount": 119
}
},
"lines": [
{
"id": "1",
"invoicedQuantity": {
"unitCode": "H87",
"quantity": 1
},
"lineExtensionAmount": {
"currency": "RON",
"amount": 100
},
"item": {
"name": "Services",
"classifiedTaxCategory": {
"id": "S",
"percent": 19,
"taxScheme": {
"id": "VAT"
}
}
},
"price": {
"priceAmount": {
"currency": "RON",
"amount": 1
},
"baseQuantity": {
"unitCode": "H87",
"quantity": 1
}
}
}
]
}
}
Uploading invoices to ANAF
You can upload invoices either to the ANAF test API or to the production API. To configure which API should be used, modify your application settings from the SBS Console, as described in Configure ANAF Environment.
To upload an invoice to ANAF:
- Create the invoice using either the
createInvoiceorcreateInvoiceFromXmlmutations. In either case, the result is ofInvoicetype. Among other fields, the response contains the ID of the generated invoice, which you must remember in order to work with this invoice subsequently. The status of the invoice at this stage is CREATED. - Upload the invoice by running the
uploadInvoicemutation. The status of the invoice is now UPLOADED and it awaits resolution by ANAF.
The following code listing illustrates uploading an invoice:
mutation UploadInvoice($organizationId:ID!, $id:ID!) {
uploadInvoice(organizationId:$organizationId, id:$id) {
id
organizationId
invoiceNumber
issueDate
invoiceTypeCode
status
requestId
downloadId
messages { id, creationDate, tin, requestId, details, type },
xmlFile { id, downloadUrl(expiresIn:3600) },
pdfFile { id, downloadUrl(expiresIn:3600) },
zipFile{ id, downloadUrl(expiresIn:3600) },
uploadedToTestEnvironment,
accountingCustomerParty { partyName partyTaxScheme {companyID}}
accountingSupplierParty { partyName partyTaxScheme {companyID}}
external
createdAt
}
}
Make sure to replace the input variables as applicable. Note that YOUR_ORGANIZATION_ID must be the ID of an ANAF-authorized organization.
{
"organizationId": "YOUR_ORGANIZATION_ID",
"id": "YOUR_PREVIOUSLY_CREATED_INVOICE_ID"
}
To view the outcome of the ANAF resolution, wait at least 5 minutes from the moment the invoice has been uploaded, and then run either the invoice or invoices query. The code listing below illustrates running the invoice query.
query ListInvoice($organizationId: ID!, $id: ID!) {
invoice(organizationId: $organizationId, id: $id) {
id
organizationId
invoiceNumber
status
requestId
downloadId
messages { id creationDate tin requestId details type }
xmlFile { id downloadUrl(expiresIn: 3600) }
pdfFile { id downloadUrl(expiresIn: 3600) }
zipFile { id downloadUrl(expiresIn: 3600) }
uploadedToTestEnvironment
createdAt
}
}
You will need to supply the organization ID and the invoice ID as input parameters, for example:
{
"organizationId": "YOUR_ORGANIZATION_ID",
"id": "YOUR_INVOICE_ID"
}
At this stage, the invoice may have one of the following statuses:
- SIGNED. This signifies that the invoice has been accepted by ANAF. The signed XML of the invoice is available for you to download from the download URL in the response.
- REJECTED. This status signifies that the invoice has not been accepted by ANAF because an error has occurred. You can view the error details in the
messagesfield of the response, as well as in the ZIP file returned by ANAF. You can also view all the errors for all requests of a given organization by running themessagesquery.
Creating and uploading invoices in one call
To send an invoice to ANAF, you typically run createInvoice followed by uploadInvoice. As an alternative, you can create and upload invoices in a single API call. To do this, run the sendInvoice mutation. This mutation creates the invoice from the provided input data and also uploads it to ANAF in the same call.
If the input invoice data is an XML file, run sendInvoiceFromXml. This mutation creates the invoice from the provided XML input and also uploads it to ANAF in the same call.
Receiving invoices
If your organization has a Romanian tax identification number and is registered with ANAF, all the invoices sent by suppliers to your organization (the so-called “inbound” invoices) are by default available in ANAF’s Private Virtual Space (“Spațiul privat virtual” in Romanian).
You can view and manage all such incoming invoices (including the accompanying XML, PDF, and ZIP files) in SBS, without logging in to ANAF’s Private Virtual Space. The only requirement is that you authorize your SBS organization with ANAF once, see Prerequisites. Once authorization is complete, you can list all inbound invoices by running the inboundInvoices query.
Note that SBS fetches inbound invoices from ANAF at roughly 20 minute intervals.
Sending and receiving invoice notifications
For any incoming invoice, your organization may send an official text notification to the issuer (sender) of the invoice, tracked through the ANAF infrastructure. To perform such action, your SBS organization must go through a one-time ANAF authorization process (see Prerequisites).
Once authorization is complete, run the notifyInvoiceSender mutation to send a notification. Any sent notification is listed in the notifications field of the respective InboundInvoice.
If your organization has received any notifications from the invoice recipients (customers), such notifications appear in the notifications field of the respective outbound Invoice.
In addition, the messages query (or the messages field of an outbound or inbound invoices) provides information about incoming or outgoing notifications. The message text is generated by ANAF and is merely an information that a notification was sent or received; it does not include the text of the notification. To get the text of the notification, run the notification query.
Invoice attachments
You can create invoices with attachments in the following formats supported by ANAF: PDF, PNG, JPG, CSV, XLSX, ODS (Open Document Spreadsheet).
To create an invoice with attachments:
- Create the attachment file(s) in File Management Service, using the standard steps for creating files. Take notice of the created file ID; you will need it in a subsequent step.
During the upload, make sure to send the correct Content Type (MIME) header in the HTTP PUT request. The following MIME types are accepted by ANAF:
- application/pdf
- image/png
- image/jpeg
- text/csv
- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
- application/vnd.oasis.opendocument.spreadsheet
- Run the
createInvoicemutation to create the invoice. In the input parameters, supply anadditionalDocumentReferenceobject with the details of the attachment to be created, for example:
{
"additionalDocumentReference": [
{
"id": "AB23456",
"documentDescription": "This is an optional description of the attachment.",
"attachment": {
"embeddedDocumentBinaryObject": {
"fileId": "YOUR_FILE_ID"
}
}
}
]
}
Note the following:
idis mandatory; it is an identifier of the supporting document as supplied by the invoice issuerdocumentDescriptionis optional- Replace YOUR_FILE_ID with the file ID of the file created earlier in File Management Service.
- Since
additionalDocumentReferenceis an array, you can add multiple attachments if necessary.
For inbound invoices, you can view attachments data by running the inboundInvoice or inboundInvoices query and requesting the attachments response field, for example:
query InboundInvoice ($organizationId:ID!, $id:ID!) {
inboundInvoice (organizationId:$organizationId,id:$id) {
id
invoiceNumber
issueDate
attachments { id downloadUrl }
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"id": "YOUR_INVOICE_ID"
}
If the invoice has attachments, the attachments field in the response includes an id and a downloadUrl for each attachment, where id is the ID of the file from File Management Service.
Self-billing invoices (Autofactura)
From a general accounting perspective, a self-billing invoice is an invoice issued by an organization where it bills itself for goods or services provided to it by some other registered entity. This is typically the case when the customer (not the supplier) organization determines the final value of delivered goods or services. For example, a big online marketplace business may issue self-invoices through which it pays various smaller retailers that earn commissions through affiliation with that respective online marketplace. In this relationship, the organization that issues the invoice (that is the online marketplace) is the invoice customer, while the affiliated smaller retailers are the suppliers.
Consequently, in SBS, autofactura is an invoice with type code 389 (self-invoice) where the customer (NOT the supplier) organization is the ANAF-authorized organization that issues the invoice. Note that this is different from all other invoice types where the details of the invoice-issuing organization (such as TIN, registration and company name) appear in the supplier details.
Therefore, to create an autofactura for a given organization in SBS, make sure that:
- The invoice type is 389 (self-invoice)
- The customer details that appear on the invoice are those of the organization that issues the invoice.
- The issuing organization is ANAF-authorized, as described in Prerequisites.
Queries
archive
Fetches an archive by ID. An archive is a ZIP archive that contains all invoices and respective attachments between two calendar dates. Both dates refer to the invoice upload date. The end date is inclusive.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization for which the archive should be retrieved. |
| id | ID! |
Mandatory. The ID of the archive that should be be retrieved. |
Result
Archive type
| Attribute | Type | Description |
|---|---|---|
| id | ID |
The unique identifier of the archive. |
| status | ArchiveStatus |
The status of the archive. Possible values: NEW, INPROCESS, DONE, ERROR. |
| invoiceType | InvoiceType |
Indicates whether the archive contains inbound or outbound invoices. Possible values: INBOUND, OUTBOUND. |
| startDate | Date |
The archive contains invoices uploaded to ANAF starting with this date. |
| endDate | Date |
The archive contains invoices uploaded to ANAF up to and including with this date. |
| file | File |
The actual archived data, as a File type. |
| errorMessage | String |
The error message. Populated if the archive creation failed with error. |
| archivedInvoices | Float |
The total number of archived invoices included in this archive. |
| createdAt | DateTime |
The date and time when the archive was created. |
Example
The following query fetches an archive by its ID and the organization ID where it belongs.
query Archive($organizationId:ID!, $id:ID!) {
archive(organizationId:$organizationId, id:$id) {
id
status
invoiceType
status
startDate
endDate
file {
id, downloadUrl(expiresIn: 3600), name, contentType
contentLength
}
errorMessage
archivedInvoices
createdAt
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"id": "YOUR_ARCHIVE_ID"
}
archives
Fetches all archives that exist for the organization ID supplied as argument.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization for which archives should be retrieved. |
Result
An array of Archive objects.
Example
The following query fetches all archives available for the organization ID supplied as argument.
query Archives($organizationId:ID!) {
archives(organizationId:$organizationId) {
id
status
invoiceType
status
startDate
endDate
errorMessage
archivedInvoices
createdAt
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID"
}
inboundInvoice
Fetches an invoice received from ANAF, by invoice ID.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization for which the invoice should be retrieved. |
| id | ID! |
Mandatory. The ID of the inbound invoice that should be be retrieved. |
Result
See the InboundInvoice type.
Example
The following query fetches an invoice by its ID and the organization ID where it belongs.
query InboundInvoice ($organizationId:ID!, $id:ID!) {
inboundInvoice (organizationId:$organizationId,id:$id) {
id
organizationId
invoiceNumber
issueDate
dueDate
taxPointDate
invoiceTypeCode
documentCurrencyCode
orderReference { id, salesOrderID }
status
requestId
downloadId
details
uploadDate
xmlFile {
id
#downloadUrl
name
contentType
contentLength
}
pdfFile {
id
#downloadUrl
name
contentType
contentLength
}
zipFile {
id
#downloadUrl
name
contentType
contentLength
}
jsonFile {
id
#downloadUrl
name
contentType
contentLength
}
receivedFromTestEnvironment
accountingSupplierParty { partyName partyTaxScheme { companyID } partyLegalEntity { registrationName companyID } }
accountingCustomerParty { partyName partyTaxScheme { companyID } partyLegalEntity { registrationName companyID }}
supplierName
supplierTin
customerName
customerTin
supplierBankAccount
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
taxTotal { taxAmount { currency amount } }
createdAt
standard
selfInvoice
supplierVatSystem
notifications { message createdAt }
attachments {
id
#downloadUrl
name
contentType
contentLength
}
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"id": "YOUR_INVOICE_ID"
}
inboundInvoiceByRequestId
Fetches an invoice received from ANAF, by the invoice’s requestId attribute.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization for which the invoice should be retrieved. |
| inboundInvoiceRequestId | ID! |
Mandatory. The requestId of the inbound invoice that should be retrieved. |
Result
See the InboundInvoice type.
Example
The following query fetches an invoice by its request ID and the organization ID where it belongs.
query InboundInvoiceByRequestId ($organizationId:ID!, $inboundInvoiceRequestId:ID!) {
inboundInvoiceByRequestId (organizationId:$organizationId,inboundInvoiceRequestId:$inboundInvoiceRequestId) {
id
organizationId
invoiceNumber
issueDate
dueDate
taxPointDate
invoiceTypeCode
documentCurrencyCode
orderReference { id, salesOrderID }
status
requestId
downloadId
details
uploadDate
xmlFile {
id
#downloadUrl
name
contentType
contentLength
}
pdfFile {
id
#downloadUrl
name
contentType
contentLength
}
zipFile {
id
#downloadUrl
name
contentType
contentLength
}
jsonFile {
id
#downloadUrl
name
contentType
contentLength
}
receivedFromTestEnvironment
accountingSupplierParty { partyName partyTaxScheme { companyID } partyLegalEntity { registrationName companyID } }
accountingCustomerParty { partyName partyTaxScheme { companyID } partyLegalEntity { registrationName companyID }}
supplierName
supplierTin
customerName
customerTin
supplierBankAccount
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
taxTotal { taxAmount { currency amount } }
createdAt
standard
selfInvoice
notifications { message createdAt }
attachments {
id
#downloadUrl
name
contentType
contentLength
}
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"id": "YOUR_REQUEST_ID"
}
inboundInvoices
Lists invoices received from ANAF for the organization ID supplied as argument.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. Set this to the ID of the organization for which invoices must be retrieved. |
| filter | InboundInvoicesFilter! |
Mandatory. Provides options to filter incoming data by invoice creation date and invoice status. See InboundInvoicesFilter. |
| nextToken | String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the InboundInvoicesResult type. |
InboundInvoicesFilter input
| Attribute | Type | Description |
|---|---|---|
| status | InboundInvoiceStatus |
Optional. An enumeration with the following valid values: RECEIVED, REJECTED. NOTE: The status REJECTED is for future use. |
| createdAt | DateFilter |
Optional. Lets you filter inbound invoices created within a specific date interval. Use the GMT time zone when applying this filter. |
| uploadDate | DateFilter |
Optional. Lets you filter inbound invoices uploaded within a specific date interval. The invoice upload date is provided by ANAF; therefore, use the Romanian time zone when applying this filter. |
| issueDate | DateFilter |
Optional. Lets you filter inbound invoices issued within a specific date interval. Use the GMT time zone when applying this filter. |
| invoiceTypeCode | String |
Optional. Lets you filter invoices by type. Valid values: 380 - Invoice, 389 - Self-invoice, 384 - Corrected invoice, 381 - Credit note, 751 - Invoice information for accounting purposes. |
| supplierTin | Int |
Optional. Lets you filter invoices by the supplier’s tax identification number. |
| customerTin | Int |
Optional. Lets you filter invoices by the customer’s tax identification number. |
| invoiceNumberLike | String |
Optional. Lets you filter invoices by the full or partial number of the invoice. |
| supplierNameLike | String |
Optional. Lets you filter invoices by the full or partial supplier company name. Filtering by this criterion is case-insensitive (for example, “son” will match both “Sonar” and “Thomson”). |
| customerNameLike | String |
Optional. Lets you filter invoices by the full or partial customer company name. Filtering by this criterion is case-insensitive. |
| selfInvoice | Boolean |
Optional. If true, only self-billing invoices (also known as “autofactura”) will be returned in the result. |
DateFilter input
| Attribute | Type | Description |
|---|---|---|
| from | Date |
Provides the starting date of the date range. |
| to | Date |
Provides the end date of the date range. NOTE: If to is supplied, the result will include all invoices created up to and including the to date. Therefore, if you would like to retrieve invoices from a particular date, use the same date as from and to date. |
Result
InboundInvoicesResult type
| Attribute | Type | Description |
|---|---|---|
| items | [InboundInvoice] |
Returns the list of received invoices, as an array of InboundInvoice objects. |
| nextToken | String |
If null, then the query has reached the end of the list of messages that match the query criteria. If not null, then use this value in the nextToken input argument to obtain the next page. |
InboundInvoice type
| Attribute | Type | Description |
|---|---|---|
| id | ID |
The unique identifier of the invoice. |
| organizationId | ID |
The ID of the organization to which this invoice belongs. |
| invoiceNumber | String |
The invoice number. |
| issueDate | Date |
The invoice issue date. |
| dueDate | Date |
The invoice due date. |
| taxPointDate | Date |
The date on which VAT becomes applicable. |
| invoiceTypeCode | String |
The type of the invoice. Valid values: 380 - Invoice, 389 - Self-invoice, 384 - Corrected invoice, 381 - Credit note, 751 - Invoice information for accounting purposes. |
| documentCurrencyCode | String |
The currency in which amounts stated on the invoice are expressed. |
| orderReference | OrderReference |
The reference to an order form or sales order. |
| status | InboundInvoiceStatus |
The invoice status. |
| requestId | ID |
The identifier of the request as generated by ANAF. |
| downloadId | ID |
The identifier of the download as generated by ANAF. |
| details | String |
Stores a text description pertaining to the invoice. |
| uploadDate | String |
The date and time when the invoice was uploaded to ANAF, in YYYYMMDDHHmm format. This time value is provided by ANAF and is expressed as local time (Romanian time zone). |
| xmlFile | File |
The invoice in XML format, as a File object. |
| pdfFile | File |
The invoice in PDF format, as a File object. NOTE: The pdfFile is null in the first few seconds after the inbound invoice is created in SBS. Please allow at least 5 seconds for this attribute to be populated. This may take longer, depending on the size of the invoice. |
| zipFile | File |
The compressed (zipped) archive of the invoice, as a File object. The archive includes the original XML invoice and the same XML invoice signed by ANAF. |
| jsonFile | File |
The invoice in JSON format, as a File object. |
| receivedFromTestEnvironment | Boolean | This flag is true if the invoice was received from the test ANAF environment. See also Configure ANAF Environment. |
| accountingSupplierParty | Party |
Provides details about the supplier party that appears on the invoice. |
| accountingCustomerParty | Party |
Provides details about the customer party that appears on the invoice. |
| supplierName | String |
The name of the supplier organization. SBS populates this value from the XML invoice according to the following logic: if <AccountingSupplierParty><Party><PartyName> exists, extract the value from there; otherwise, extract the value from <AccountingSupplierParty><PartyLegalEntity><RegistrationName>. |
| supplierTin | Float |
The tax identification number of the supplier organization. SBS populates this value from the XML invoice according to the following logic: if <AccountingSupplierParty><PartyTaxScheme><CompanyID> exists, extract the value from there; otherwise, extract the value from <AccountingSupplierParty><PartyLegalEntity><CompanyID>. Finally, strip the alphabetic part and populate supplierTin with the numeric part only. |
| customerName | String |
The name of the customer organization. SBS populates this value from the XML invoice according to the following logic: if <AccountingCustomerParty><Party><PartyName> exists, extract the value from there; otherwise, extract the value from <AccountingCustomerParty><PartyLegalEntity><RegistrationName>. |
| customerTin | Float |
The tax identification number of the customer organization. SBS populates this value from the XML invoice according to the following logic: if <AccountingCustomerParty><PartyTaxScheme><CompanyID> exists, extract the value from there; otherwise, extract the value from <AccountingCustomerParty><PartyLegalEntity><CompanyID>. Finally, strip the alphabetic part and populate customerTin with the numeric part only. |
| supplierBankAccount | IBAN |
The IBAN of the supplier. To populate this value, SBS reads from the invoice’s XML file the first PaymentMeans/PayeeFinancialAccount/ID where FinancialInstitutionBranch/ID is not TREZROBU. |
| legalMonetaryTotal | LegalMonetaryTotal |
Provides information about the total monetary amount on the invoice, as a LegalMonetaryTotal object. |
| taxTotal | [TaxTotal] |
The total amount of VAT in the accounting currency. |
| createdAt | DateTime |
The date and time the invoice was created in SBS. |
| standard | InvoiceStandard |
Specifies the syntax upon which the XML invoice is based. This is an enumeration with the following valid values: UBL - Universal Business Language 2.1, CII - Cross-Industry Invoice. |
| selfInvoice | Boolean |
Specifies if the XML invoice is a self-billing invoice. This is the case of invoices received from ANAF where the current organization is the supplier entity, not the customer. |
| supplierVatSystem | VatSystem |
Specifies the VAT system of the supplier. Possible values: NO_VAT, VAT_ON_INVOICING, VAT_ON_COLLECTION. |
| notifications | [Notification] |
An array of notification messages sent by your organization to the issuer of the invoice through the notifyInvoiceSender mutation. |
| attachments | [File] |
An array of file attachments present on the inbound invoice. Each attachment is of type File and can be queried through the File Management Service. |
Example
The following query fetches inbound invoices by the organization ID where they belong. The query uses a filter to fetch invoices where creation date is January the 8th, 2026, or later. The nextToken parameter is set to null, meaning that only the first page of results will be retrieved.
query InboundInvoices($organizationId:ID!,$filter: InboundInvoicesFilter!,$nextToken:String) {
inboundInvoices(organizationId:$organizationId,filter:$filter,nextToken:$nextToken) {
items{
id
organizationId
invoiceNumber
issueDate
dueDate
invoiceTypeCode
documentCurrencyCode
orderReference { id, salesOrderID }
status
requestId
downloadId
details
uploadDate
receivedFromTestEnvironment
accountingSupplierParty { partyName partyTaxScheme { companyID } partyLegalEntity { registrationName companyID } }
accountingCustomerParty { partyName partyTaxScheme { companyID } partyLegalEntity { registrationName companyID }}
supplierName
supplierTin
customerName
customerTin
supplierBankAccount
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
taxTotal { taxAmount { currency amount } }
createdAt
standard
selfInvoice
supplierVatSystem
notifications { message createdAt }
attachments { id name contentType contentLength }
}
nextToken
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"filter": {
"createdAt": {
"from": "2026-01-08"
}
},
"nextToken": null
}
invoice
Retrieves a previously created outbound invoice, which may or may not have been uploaded to ANAF yet.
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The organization for which the invoice retrieval is requested. |
| id | ID! |
Mandatory. The ID of the invoice to be retrieved. |
Result
Invoice type
| Attribute | Type | Description |
|---|---|---|
| id | ID |
The ID of the invoice. |
| organizationId | ID |
The organization ID to which this invoice belongs. |
| invoiceNumber | String |
The invoice number. |
| issueDate | Date |
The invoice issue date. |
| dueDate | Date |
The invoice due date. |
| invoiceTypeCode | String |
The type of the invoice. Valid values: 380 - Invoice, 389 - Self-invoice, 384 - Corrected invoice, 381 - Credit note, 751 - Invoice information for accounting purposes. |
| documentCurrencyCode | String |
The currency in which amounts stated on the invoice are expressed. |
| orderReference | OrderReference |
The reference to an order form or sales order. |
| status | InvoiceStatus |
The invoice status. Valid values: CREATED - the invoice has been created but not uploaded yet, UPLOADED - the invoice has been uploaded and is pending resolution with ANAF, SIGNED - the invoice has been signed and accepted by ANAF, REJECTED - the invoice has been rejected by ANAF. |
| uploadDate | String |
If the invoice has been uploaded to ANAF, this field contains the invoice upload date, in YYYYMMDDHHmm format. This time value is provided by ANAF and is in the Romanian time zone. |
| requestId | ID |
The identifier of the request as generated by ANAF. The requestId is generated at invoice upload time and does not typically change. NOTE: The requestId may change in rare situations after a system failure occurs during API data exchange with ANAF. When such failures occur, the invoice data in SBS is technically out-of-sync with data stored by ANAF. If the ANAF API subsequently provides clear indication that the invoice already exists in ANAF with another requestId, the current requestId will be replaced with the most up-to-date one as stored by ANAF. |
| downloadId | ID |
The identifier of the download as generated by ANAF, in case of successful outcome. |
| messages | Message |
This field stores ANAF-generated messages pertaining to this invoice, if any. For example, if an invoice has been rejected by ANAF, this field contains the rejection reason provided by ANAF. Note that messages of type “FACTURA TRIMISA” are not included. |
| notifications | [Notification] |
The list of incoming notifications associated with the invoice, as a Notification type. These are notifications sent by the invoice recipient organization. |
| xmlFile | File |
The XML file generated by SBS at invoice creation time, as a File object. |
| pdfFile | File |
The PDF file generated by ANAF, as a File object. NOTE: The pdfFile is null in the first few seconds after the invoice is created in SBS. Please allow at least 5 seconds for this attribute to be populated. This may take longer, depending on the size of the invoice. |
| zipFile | File |
Provides the XML signed by ANAF, archived as a ZIP file, as a File object. The ZIP file is generated by ANAF if the invoice was accepted and signed. |
| attachments | [File] |
The invoice attachments, as an array of File objects. |
| uploadedToTestEnvironment | Boolean |
This field indicates whether the invoice has been uploaded to the ANAF test or production API, based on a flag defined in application settings. A true value means the invoice was uploaded to ANAF test API. If the invoice hasn’t been uploaded yet, uploadedToTestEnvironment is null. |
| accountingSupplierParty | Party |
Provides details about the supplier party that appears on the invoice. |
| accountingCustomerParty | Party |
Provides details about the customer party that appears on the invoice. |
| supplierName | String |
The name of the supplier organization. SBS populates this value from the XML invoice according to the following logic: if <AccountingSupplierParty><Party><PartyName> exists, extract the value from there; otherwise, extract the value from <AccountingSupplierParty><PartyLegalEntity><RegistrationName>. |
| supplierTin | Float |
The tax identification number of the supplier organization. |
| customerName | String |
The name of the customer organization. SBS populates this value from the XML invoice according to the following logic: if <AccountingCustomerParty><Party><PartyName> exists, extract the value from there; otherwise, extract the value from <AccountingCustomerParty><PartyLegalEntity><RegistrationName>. |
| customerTin | Float |
The tax identification number of the customer organization. |
| legalMonetaryTotal | LegalMonetaryTotal |
Provides information about the total monetary amount on the invoice, as a LegalMonetaryTotal object. |
| taxTotal | [TaxTotal] |
The total amount of VAT in the accounting currency. |
| external | Boolean |
If true, the invoice will be uploaded to ANAF with an indication that the customer on the invoice is located outside Romania. This happens when the customer TIN of the invoice is not a Romanian TIN and the customer’s country is other than “RO”. If both the customer and supplier have a Romanian address, then this flag is false. |
| createdAt | DateTime |
The date and time the invoice was created in SBS. |
| standard | InvoiceStandard |
Specifies the syntax upon which the XML invoice is based. This is an enumeration with the following valid values: UBL - Universal Business Language 2.1, CII - Cross-Industry Invoice. |
| customerRelationship | CustomerRelationship |
Indicates whether the invoice is part of a B2B (business to business) or B2C (business to customer) relationship. valid values: B2B, B2C. An invoice is considered to be part of a B2C relationship if the customer TIN on the XML invoice is a Romanian personal numeric code (CNP) or 13 zeros. |
OrderReference type
| Attribute | Type | Description |
|---|---|---|
| id | String! |
The identifier of the purchase order, issued by the buyer. |
| salesOrderID | String |
The identifier of the sales order, issued by the seller. |
Message type
| Attribute | Type | Description |
|---|---|---|
| id | String |
The unique identifier of the message. |
| creationDate | String |
The date when the message was created. |
| tin | String |
The tax identification number (TIN) of the organization to which this message applies. |
| requestId | String |
The identifier of the ANAF request. This field is provided by ANAF; it identifies either an invoice or an invoice notification submitted to ANAF. If message type is “FACTURA TRIMISA” or “FACTURA PRIMITA”, the requestId correlates with the requestId of the Invoice object. |
| invoiceRequestId | String |
The identifier of the outbound invoice to which this message makes reference. This field will be populated only if the message references an outbound invoice (that is, if message type is “FACTURA TRIMISA”). |
| inboundInvoiceRequestId | String |
The identifier of the inbound invoice to which this message makes reference. This field will be populated only if the message references an inbound invoice (that is, if message type is “FACTURA PRIMITA”). |
| details | String |
Any other information which may be applicable to the message. |
| type | String |
The message type, as populated by ANAF. |
File type
| Attribute | Type | Description |
|---|---|---|
| id | ID |
The ID of the file in the File Management Service. |
| downloadUrl(expiresIn) | Uri |
The file’s download URL. The download URL is available for the number of seconds supplied to the expiresIn input argument. |
| name | String |
The file name. |
| contentType | String |
The MIME type of the file. |
| contentLength | String |
The size of the file, in bytes. |
Party type
| Attribute | Type | Description |
|---|---|---|
| partyName | String |
The name of the of the supplier or customer that appears on the invoice. |
| partyTaxScheme | PartyTaxScheme |
Provides further details about the supplier or customer that appears on the invoice. |
| partyLegalEntity | PartyLegalEntity |
Provides further details about the supplier or customer that appears on the invoice. |
PartyTaxScheme type
| Attribute | Type | Description |
|---|---|---|
| companyID | String |
The party’s identification code for tax purposes. This is typically the Romanian CIF (Cod de identificare fiscală) prefixed by the country’s two letter code (BT-31). This may also be the fiscal identifier of a company that is not registered as a VAT payer (BT-32). |
PartyLegalEntity type
| Attribute | Type | Description |
|---|---|---|
| registrationName | String |
The party’s legal name. |
| companyID | String |
The party’s identification code for tax purposes. This is typically the Romanian CIF (Cod de identificare fiscală) prefixed by the country’s two letter code (BT-31). This may also be the fiscal identifier of a company that is not registered as a VAT payer (BT-32). |
LegalMonetaryTotal type
| Attribute | Type | Description | Code |
|---|---|---|---|
| lineExtensionAmount | CurrencyAmount |
The total of all net amounts of all items on the invoice. | BT-106 |
| taxExclusiveAmount | CurrencyAmount |
The total amount of the invoice, excluding VAT. | BT-109 |
| taxInclusiveAmount | CurrencyAmount |
The total amount of the invoice, including VAT. | BT-112 |
| allowanceTotalAmount | CurrencyAmount |
The total of all document-level discounts on the invoice. | BT-107 |
| chargeTotalAmount | CurrencyAmount |
The total of all document-level charges on the invoice. | BT-108 |
| prepaidAmount | CurrencyAmount |
The total of prepaid amounts on the invoice. This amount is deducted from the total VAT for the calculation of the payment due amount. | BT-113 |
| payableRoundingAmount | CurrencyAmount |
The amount which must be added to the total in order to round off the payment amount. | BT-114 |
| payableAmount | CurrencyAmount |
The total amount of the invoice with VAT deducted for the prepaid amount. The amount is zero in case of a fully paid invoice. The amount may be negative, in which case the seller owes that amount to the buyer. | BT-115 |
TaxTotal type
| Attribute | Type | Description |
|---|---|---|
| taxAmount | CurrencyAmount |
The total amount of VAT in the accounting currency. |
CurrencyAmount type
| Attribute | Type | Description |
|---|---|---|
| currency | String |
The currency code. Valid values are according to ISO 4217 (for example, RON for Romanian Lei). |
| amount | Float |
The amount, rounded to two decimals. |
Example
The following query fetches an outbound invoice by its ID and the organization ID where it belongs.
query QueryInvoice($organizationId:ID!, $id:ID!) {
invoice(organizationId:$organizationId, id:$id) {
id
organizationId
invoiceNumber
issueDate
invoiceTypeCode
status
uploadDate
requestId
downloadId
messages { id creationDate tin requestId details type },
notifications { message, createdAt }
xmlFile {
id
downloadUrl(expiresIn:3600)
},
pdfFile {
id
downloadUrl(expiresIn:3600)
},
zipFile{
id
downloadUrl(expiresIn:3600)
},
attachments {
id
downloadUrl
name
contentType
contentLength
}
uploadedToTestEnvironment,
accountingCustomerParty { partyName partyTaxScheme {companyID}}
accountingSupplierParty { partyName partyTaxScheme {companyID}}
supplierName
supplierTin
customerName
customerTin
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
taxTotal { taxAmount { currency amount }}
createdAt
customerRelationship
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"id": "YOUR_INVOICE_ID"
}
invoiceByRequestId
Retrieves an invoice by its requestId attribute. An invoice gets a request ID upon upload to ANAF; therefore, running this query is meaningful only for uploaded invoices (regardless of the upload outcome).
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The organization for which the invoice retrieval is requested. |
| invoiceRequestId | ID! |
Mandatory. The request ID of the invoice. |
Result
See the Invoice type.
Example
The following query fetches an outbound invoice by its request ID and the organization ID where it belongs.
query QueryInvoiceByRequestId($organizationId:ID!, $invoiceRequestId:ID!) {
invoiceByRequestId(organizationId:$organizationId, invoiceRequestId:$invoiceRequestId) {
id
organizationId
invoiceNumber
issueDate
invoiceTypeCode
status
uploadDate
requestId
downloadId
messages { id creationDate tin requestId details type },
notifications { message, createdAt }
xmlFile {
id
downloadUrl(expiresIn:3600)
},
pdfFile {
id
downloadUrl(expiresIn:3600)
},
zipFile{
id
downloadUrl(expiresIn:3600)
},
attachments {
id
downloadUrl
name
contentType
contentLength
}
uploadedToTestEnvironment,
accountingCustomerParty { partyName partyTaxScheme {companyID}}
accountingSupplierParty { partyName partyTaxScheme {companyID}}
supplierName
supplierTin
customerName
customerTin
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
taxTotal { taxAmount { currency amount }}
createdAt
customerRelationship
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"invoiceRequestId": "YOUR_REQUEST_ID"
}
invoices
Retrieves a list of created and submitted invoices, filtered by the organization ID and status.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. Specifies the organization ID for which invoices are to be retrieved. |
| filter | InvoicesFilter! |
Mandatory. Specifies the filtering options, as an InvoicesFilter input. |
| nextToken | String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the InvoicesResult type. |
InvoicesFilter input
| Attribute | Type | Description |
|---|---|---|
| status | InvoiceStatus |
Optional. Provides the ability to filter by the invoice status. Valid values: CREATED - the invoice has been created but not uploaded yet, UPLOADED - the invoice has been uploaded and is pending resolution with ANAF, SIGNED - the invoice has been signed and accepted by ANAF, REJECTED - the invoice has been rejected by ANAF. |
| createdAt | DateFilter |
Optional. Lets you filter invoices created within a specific date interval. Use the GMT time zone when applying this filter. |
| uploadDate | DateFilter |
Optional. Lets you filter invoices uploaded within a specific date interval. The invoice upload date is provided by ANAF; therefore, use the Romanian time zone when applying this filter. |
| issueDate | DateFilter |
Optional. Lets you filter inbound invoices issued within a specific date interval. Use the GMT time zone when applying this filter. |
| invoiceTypeCode | String |
Optional. Lets you filter invoices by type. Valid values: 380 - Invoice, 389 - Self-invoice, 384 - Corrected invoice, 381 - Credit note, 751 - Invoice information for accounting purposes. |
| supplierTin | Int |
Optional. Lets you filter invoices by the supplier’s tax identification number. |
| customerTin | Int |
Optional. Lets you filter invoices by the customer’s tax identification number. |
| invoiceNumberLike | String |
Optional. Lets you filter invoices by the full or partial number of the invoice. |
| supplierNameLike | String |
Optional. Lets you filter invoices by the full or partial supplier company name. Filtering by this criterion is case-insensitive (for example, “son” will match both “Sonar” and “Thomson”). |
| customerNameLike | String |
Optional. Lets you filter invoices by the full or partial customer company name. Filtering by this criterion is case-insensitive. |
Result
InvoicesResult type
| Attribute | Type | Description |
|---|---|---|
| items | [Invoice] |
The list of Invoice objects matching the filtering criteria. |
| nextToken | String |
If null, then the query has reached the end of the list of invoices that match the query criteria. If not null, then use this value in the nextToken input argument to obtain the next page. |
Example
The following query fetches outbound invoices by the organization ID where they belong. The query uses a filter to fetch invoices where creation date is January the 8th, 2026, or later. The nextToken parameter is set to null, meaning that only the first page of results will be retrieved.
query QueryInvoices($organizationId:ID!, $filter:InvoicesFilter!, $nextToken:String) {
invoices(organizationId:$organizationId, filter:$filter, nextToken:$nextToken) {
items {
id
organizationId
invoiceNumber
issueDate
invoiceTypeCode
status
requestId
downloadId
messages { id, creationDate, tin, requestId, details, type },
notifications { message, createdAt }
xmlFile {
id
#downloadUrl
}
pdfFile {
id
#downloadUrl
}
zipFile {
id
#downloadUrl
}
uploadedToTestEnvironment
accountingCustomerParty { partyName partyTaxScheme {companyID}}
accountingSupplierParty { partyName partyTaxScheme {companyID}}
external
createdAt
standard
}
nextToken
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"filter": {
"createdAt": {
"from": "2026-01-08"
}
},
"nextToken": null
}
messages
Lists up-to-date messages as provided by ANAF in real time. A message indicates that some event was registered by ANAF, for example:
- an invoice has been uploaded to ANAF or received from ANAF
- an invoice has been rejected by ANAF due to errors
- a notification concerning some invoice was sent or received
The type field of each Message indicates the actual kind of event that took place.
Note the following:
- the
messagesquery retrieves messages only for the past 60 days. To retrieve older messages, run thestoredMessagesquery. - the
messagesquery retrieves a global list of messages for all invoices. To retrieve messages for specific invoices only, run theinvoiceorinvoicesquery. Any messages pertaining to the invoice are listed in themessagesfield of the responseInvoiceobject.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. Specifies the organization ID for which messages are to be retrieved. |
| filter | MessagesFilter! |
Mandatory. Specifies the filtering options, as an MessagesFilter input. |
| nextToken | String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the MessagesResult type. |
MessagesFilter input
| Attribute | Type | Description |
|---|---|---|
| days | Float! |
Mandatory. Specifies the number of days for which messages are to be retrieved. |
| typeCode | MessageTypeCode |
Optional. Lets you filter messages by their type as assigned by ANAF. Valid values: E - ERORI FACTURA, P - FACTURA PRIMITA, T - FACTURA TRIMISA, R - MESAJ CUMPARATOR PRIMIT or MESAJ CUMPARATOR TRANSMIS |
Result
MessagesResult type
| Attribute | Type | Description |
|---|---|---|
| items | [Message] |
The list of Message objects matching the filtering criteria. |
| nextToken | String |
If null, then the query has reached the end of the list of messages that match the query criteria. If not null, then use this value in the nextToken input argument to obtain the next page. |
Example
The following query fetches messages from ANAF for the organization id supplied as argument. The filter parameter specifies that only messages from the last 1 day are to be retrieved. The nextToken parameter is set to null, meaning that only the first page of results will be retrieved.
query Messages($organizationId:ID!, $filter:MessagesFilter!, $nextToken: String) {
messages (organizationId:$organizationId, filter:$filter, nextToken: $nextToken) {
items {
id
requestId
invoiceRequestId
inboundInvoiceRequestId
tin
details
type
creationDate
}
nextToken
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"filter": {
"days": 1
},
"nextToken": null
}
notification
Returns an invoice notification. See Sending and receiving notifications.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. Specifies the organization ID for which the notification is to be retrieved. |
| messageId | MessageId! |
Mandatory. Specifies the ID of the ANAF message that concerns this notification. This must be an ANAF message of type “MESAJ CUMPARATOR TRANSMIS” or “MESAJ CUMPARATOR PRIMIT”. |
Result
See the Notification type.
Example
The following query fetches a notification for the organization id and message id supplied as arguments.
query QueryNotification($organizationId:ID!, $messageId:ID!) {
notification(organizationId:$organizationId, messageId:$messageId) {
message
createdAt
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"messageId": "YOUR_MESSAGE_ID"
}
organizations
Returns a list of active organizations defined in the Organizations Service. This is a convenience query used to obtain the list of organizations in e-Factura 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 e-Factura.
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. |
Example
The following query fetches all active organizations.
query organizations{
organizations {
id
name
tin
regNo
country
createdAt
}
}
previewInvoice
Generates an XML invoice string according to the input, without storing any objects. This query is intended only for development purpose. For example, it may be useful to create an invoice for testing or debugging, without actually storing it. It works in the same way as the createInvoice mutation, the only difference being that, in case of previewInvoice, the resulting XML invoice is not stored anywhere.
By default, if the input is not valid, the response contains all the validation errors as returned by ANAF. To return the generated invoice even if it is not valid, set the skipVerification input parameter to true.
Arguments
| Argument | Type | Description |
|---|---|---|
| input | CreateInvoiceInput! |
Mandatory. The input data from which the XML invoice is to be created. |
| skipVerification | Boolean |
Optional. If true, the query returns the invoice even if it is not valid. The default value is false. |
CreateInvoiceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| invoiceNumber | String! |
Mandatory. The internal reference which uniquely identifies the invoice in the seller’s invoicing system. The maximum allowed number of characters is 200. | BT-1 |
| issueDate | Date! |
Mandatory. The invoice issue date, in YYYY-MM-DD format. | BT-2 |
| dueDate | Date |
Optional. The invoice due date, in YYYY-MM-DD format. | BT-9 |
| invoiceTypeCode | String! |
Mandatory. The type of the invoice. Valid values: 380 - Invoice, 389 - Self-invoice, 384 - Corrected invoice, 381 - Credit note, 751 - Invoice information for accounting purposes. | BT-3 |
| notes | [String] |
Optional. Stores free text pertaining to the invoice. You can supply multiple note strings as input. If any given note string exceeds 300 characters in length, it will be split into multiple <cbc:Note> elements in the resulting XML, so that the length of each <cbc:Note> obeys ANAF’s validation rules. |
BT-22 |
| profileId | String |
Optional. Identifies the business process context in which the transaction appears, to enable the Buyer to process the Invoice in an appropriate way. | BT-23 |
| taxPointDate | Date |
Optional. The date when the VAT becomes due for an invoice. This field is mutually exclusive with Invoice Period (BT-8). | BT-7 |
| documentCurrencyCode | String! |
Mandatory. The currency in which amounts stated on the invoice are expressed. Valid values are according to ISO 4217. | BT-5 |
| taxCurrencyCode | String |
Optional. The currency in which VAT is expressed. Valid values are according to ISO 4217. | BT-6 |
| invoicePeriod | invoicePeriodInput |
Optional. Provides information about the VAT effective date. See invoicePeriodInput. |
|
| buyerReference | String |
Optional. An identifier of the buyer on the invoice, as assigned by the buyer for their own internal purposes. | BT-10 |
| orderReference | OrderReferenceInput |
Optional. An identifier specified by the buyer on the invoice, which provides the link between the invoice and the purchase order. See OrderReferenceInput. |
|
| billingReference | [BillingReferenceInput] |
Optional. Provides billing information about one or more previous invoices, specified by the seller, as a list of BillingReferenceInput objects. |
BG-3 |
| despatchDocumentReference | SimpleReferenceInput |
Optional. Provides information about the document or identifier that confirms the dispatch or transportation of the goods from the seller to the buyer, as a SimpleReferenceInput object. The maximum allowed number of characters is 200. |
BT-16 |
| contractDocumentReference | SimpleReferenceInput |
Optional. References the contract document or identifier associated with the transaction between the buyer and the seller, as a SimpleReferenceInput object. The maximum allowed number of characters is 200. |
BT-12 |
| projectReference | ProjectReferenceInput |
Optional. References a project-related identifier or reference number associated with the goods or services provided, as a ProjectReferenceInput object. |
BT-11 |
| additionalDocumentReference | [AdditionalDocumentReferenceInput] |
Optional. References one or more additional documents, as an array of AdditionalDocumentReferenceInput objects. |
BG-24 |
| receiptReference | ReceiptDocumentReferenceInput |
Optional. References a receipt. See ReceiptDocumentReferenceInput. |
|
| accountingCost | String |
Optional. This textual value determines where data will be entered in the buyer’s financial accounts. The maximum allowed number of characters is 100. | BT-19 |
| accountingSupplierParty | AccountingSupplierPartyInput |
Optional. Provides information about the supplier, from an accounting perspective, as an AccountingSupplierPartyInput object. |
BG-4 |
| accountingCustomerParty | AccountingCustomerPartyInput |
Optional. Provides information about the customer, from an accounting perspective, as an AccountingCustomerPartyInput object. |
BG-7 |
| delivery | DeliveryInput |
Optional. Provides information about the delivery, as a DeliveryInput object. |
BG-13 |
| paymentMeans | [PaymentMeansInput] |
Optional. Provides payment information pertaining to the invoice, as an array of PaymentMeansInput objects. |
BG-16 |
| paymentTerms | PaymentTermsInput |
Optional. Provides information about payment terms pertaining to the amount due, as a PaymentTermsInput object. |
|
| taxTotal | [TaxTotalInput] |
Optional. Provides information about the VAT applicable to the invoice, as a list of TaxTotalInput objects. |
BT-110, BT-111 |
| withholdingTaxTotal | [TaxTotalInput] |
Optional. Not applicable to invoices created according to the UBL syntax. | |
| legalMonetaryTotal | LegalMonetaryTotalInput |
Mandatory. Provides information about the total monetary amount on the invoice, as a LegalMonetaryTotalInput object. |
BG-22 |
| lines | [InvoiceLineInput] |
Optional. Provides information about the invoice lines (items), as a list of InvoiceLineInput objects. |
BG-25 |
InvoicePeriodInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| descriptionCode | String! |
Code for VAT effective date. Valid values are according to UNTDID 2005 [6]. This field is mutually exclusive with Tax Point Date (BT-7). | BT-8 |
OrderReferenceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String! |
Mandatory. The identifier of the purchase order, issued by the buyer. The maximum allowed number of characters is 200. | BT-13 |
| salesOrderID | String |
Optional. The identifier of the sales order, issued by the seller. The maximum allowed number of characters is 200. | BT-14 |
BillingReferenceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| invoiceDocumentReference | InvoiceDocumentReferenceInput |
Optional. Provides reference to a previous invoice. | BG-3 |
InvoiceDocumentReferenceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String! |
The identifier of the referenced document. | BT-25 |
| issueDate | Date |
The issue date of the referenced document. | BT-26 |
SimpleReferenceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String! |
The identifier of the referenced document. |
AdditionalDocumentReferenceInput input
An additional document reference may be:
- a reference to a previous invoice. In this case, populate
idwith the ID of referenced invoice anddocumentTypeCodewith 130. - a reference to a URI. In this case, populate
id,documentDescription(optionally), andattachment/externalReference. - an attachment. In this case, populate
id,documentDescription(optionally), andattachment/embeddedDocumentBinaryObject.
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String! |
Mandatory. The identifier of the referenced document. | BT-122 or BT-18a |
| documentTypeCode | String |
Conditional. If the document referenced by id is an invoice, use code 130. NOTE: If you populate this field, do not populate documentDescription and attachment, and vice versa. |
BT-18b |
| documentDescription | String |
Conditional. A text description of the referenced document. NOTE: if you populate this field, do not populate documentTypeCode, and vice versa. |
BT-123 |
| attachment | AttachmentInput |
Conditional. The actual attachment data, as an AttachmentInput object. The attached data can be either a URI reference or the ID of a file created through the File Management Service. NOTE: if you populate this field, do not populate documentTypeCode, and vice versa. |
ReceiptDocumentReferenceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String! |
Mandatory. The identifier of the referenced receipt. The maximum allowed number of characters is 200. | BT-15 |
AttachmentInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| externalReference | ExternalReferenceInput |
Conditional. The URI reference, as an object of type ExternalReferenceInput. This field is mutually exclusive with embeddedDocumentBinaryObject. |
BT-124 |
| embeddedDocumentBinaryObject | EmbeddedDocumentBinaryObjectInput |
Conditional. The embedded binary object, as an object of type EmbeddedDocumentBinaryObjectInput. This field is mutually exclusive with externalReference. |
BT-125 |
EmbeddedDocumentBinaryObjectInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| fileId | ID |
The id of a file created in File Management Service. |
ExternalReferenceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| uri | Uri |
The URI of the referenced document. |
SimpleDocumentReferenceInput input
| Attribute | Type | Description |
|---|---|---|
| id | String! |
The identifier of the referenced document. |
ProjectReferenceInput input
| Attribute | Type | Description |
|---|---|---|
| id | ID! |
The identifier of the referenced project. |
AccountingSupplierPartyInput input
| Attribute | Type | Description |
|---|---|---|
| party | PartyInput! |
Mandatory. Provides information about the party taking part in the transaction (customer or supplier), as a PartyInput object. |
AccountingCustomerPartyInput input
| Attribute | Type | Description |
|---|---|---|
| party | PartyInput! |
Mandatory. Provides information about the party taking part in the transaction (customer or supplier), as a PartyInput object. |
PartyInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| endpointID | String |
Currently not in use. | |
| partyIdentification | String |
Optional. The identifier of the party, according to the identification scheme provided by schemeID (see below). |
BT-29 (for suppliers), BT-46 (for customers) |
| schemeID | String |
Optional. The scheme that identifies the party provided in partyIdentification. Valid values are in the ISO 6523 ICD list. For example, 0088 indicates that the party is identified by an EAN Location Code. If you don’t populate this field, the schemeID attribute in the XML invoice will be 0088. |
BT-29 (for suppliers), BT-46 (for customers) |
| partyName | String |
Optional. The trade name of the party, other than the formal name reported in BT-27 (for suppliers) or BT-44 (for customers). The maximum allowed number of characters is 200. | BT-28 (for suppliers), BT-45 (for customers), BT-70 (for a delivery party) |
| postalAddress | AddressInput |
Optional. The address of the party, as an AddressInput object. |
BG-5 (for suppliers), BG-8 (for customers) |
| partyTaxScheme | PartyTaxSchemeInput |
Optional. Provides the party’s tax details, as a PartyTaxSchemeInput input. |
|
| partyLegalEntity | PartyLegalEntityInput |
Optional. Provides legal information about the party, as a PartyLegalEntityInput input. |
|
| contact | ContactInput |
Optional. Provides contact information about the party involved, see the ContactInput input. |
BG-6 (for suppliers), BG-9 (for customers) |
AddressInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| streetName | String |
Optional. The name of the street where the party address is located. The maximum allowed number of characters is 150. | BT-35 (for suppliers), BT-50 (for customers), BT-75 (for a delivery address) |
| additionalAddressDetails | String |
Optional. Provides further address details that complement the address. The maximum allowed number of characters is 100. | BT-36 (for suppliers), BT-51 (for customers), BT-76 (for a delivery address) |
| city | String |
Optional. The name of the town, city, or settlement on the address. The maximum allowed number of characters is 50. | BT-37 (for suppliers), BT-52 (for customers), BT-77 (for a delivery address) |
| postalCode | String |
Optional. The postal/ZIP code. The maximum allowed number of characters is 20. | BT-38 (for suppliers), BT-53 (for customers), BT-78 (for a delivery address) |
| region | String |
Optional. The code of the district/county, according to the ISO 3166-2 RO code list (for example, “RO-B” for Bucharest, “RO-AB” for Alba County). | BT-39 (for suppliers), BT-54 (for customers), BT-79 (for a delivery address) |
| addressLines | [String] |
Optional. A list of address lines. | BT-162 (for suppliers), BT-163 (for customers), BT-165 (for a delivery address) |
| country | CountryCode |
Optional. The country code, according to ISO 3166-1. | BT-40 (for suppliers), BT-55 (for customers), BT-80 (for a delivery address) |
PartyTaxSchemeInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| companyID | String |
Conditional. The party’s identification code for tax purposes. This is typically the Romanian CIF (Cod de identificare fiscală) prefixed by the country’s two letter code. | BT-31 (for suppliers), BT-48 (for customers) |
| taxScheme | TaxSchemeInput |
Conditional. Identifies the tax scheme, see TaxSchemeInput. |
TaxSchemeInput input
| Attribute | Type | Description |
|---|---|---|
| id | String |
Conditional. Identifies the tax scheme. Valid values are according to UNTDID 5153. Set this value to “VAT” if BT-31 is a Romanian CIF (Cod de identificare fiscală). |
PartyLegalEntityInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| registrationName | String |
Optional. The party’s formal name by which it is entered in the national register. The maximum allowed number of characters is 200. | BT-27 (for suppliers), BT-44 (for customers) |
| companyID | String |
Optional. The officially issued identifier of the party. | BT-30 (for suppliers), BT-47 (for customers) |
| companyLegalForm | String |
Optional. Captures additional legal information about the party (for example, the so-called company’s “memorandum of association”). The maximum allowed number of characters is 1000. | BT-33 (for suppliers) |
ContactInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| name | String |
Optional. The contact name. The maximum allowed number of characters is 100. | BT-41 (for suppliers), BT-56 (for customers) |
| telephone | String |
Optional. The contact’s phone number. The maximum allowed number of characters is 100. | BT-42 (for suppliers), BT-57 (for customers) |
EmailAddress |
Optional. The contact’s email address. The maximum allowed number of characters is 100. | BT-43 (for suppliers), BT-58 (for customers) |
DeliveryInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| actualDeliveryDate | Date |
Optional. The date of completion of delivery of goods or services. | BT-72 |
| deliveryLocation | DeliveryLocationInput |
Optional. The place where the goods or services are being delivered to, as a DeliveryLocationInput object. |
|
| deliveryParty | PartyInput |
Optional. The name of the party to whom goods and services are supplied. Used if delivery is to a customer other than the buyer. See PartyInput. |
DeliveryLocationInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String |
Optional. Provides an identifier of the delivery location. The scheme of the identifier may be indicated in the schemeID field below; otherwise, the scheme is assumed to be 0088 by default. |
BT-71 |
| address | AddressInput |
Optional. Provides information about the address at which the invoiced goods or services are being delivered to. See AddressInput. |
BG-15 |
| schemeID | String |
Optional. Identifies the scheme used to identify the delivery location. Valid values are according to the ISO 6523 code list. | BT-71 |
PaymentMeansInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| name | String |
Optional. Describes the payments means as text. | BT-82 |
| code | String! |
Mandatory. Identifies the way in which payment is expected, or has been made. Valid values are according to UNTDID 4461 [6] code list. | BT-81 |
| paymentId | String |
Optional. Allocation information which establishes a link between the payment and the invoice issued by the seller (usually, the number of the invoice being paid). | BT-83 |
| cardAccount | CardAccountInput |
Optional. Provides information about the card used to pay, as CardAccountInput. Used only if the buyer has paid with a card. |
BG-18 |
| payeeFinancialAccount | FinancialAccountInput |
Optional. Provides information about the payee, as FinancialAccountInput. |
BG-17 |
| paymentMandate | PaymentMandateInput |
Optional. Provides information about a direct debit mandate, as PaymentMandateInput. Applicable if the payment has been or is to be made through direct debit means. |
BG-19 |
CardAccountInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| primaryAccountNumberId | String |
Optional. The primary account number of the card used for payment. According to the latest PCI Data Security Standards, this value must not be included in full. Only the first six and the last four digits are to be displayed. | BT-87 |
| networkId | String |
Optional. The identifier of the payment network that facilitates the transaction. | |
| holderName | String |
Optional. The name of the payer. | BT-88 |
FinancialAccountInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String |
Optional. The identifier of the account to which payment is to be executed. This can be the IBAN in case of SEPA payments. | BT-84 |
| name | String |
Optional. The name of the account to which payment is to be executed. | BT-85 |
| financialInstitutionBranchId | String |
Optional. The identifier of the payment service provider, for example, BIC (Bank Interchange Code). | BT-86 |
PaymentMandateInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String |
Optional. The unique identifier assigned by the payee in reference to the direct debit authorization. | BT-89 |
| payerFinancialAccount | FinancialAccountInput |
Optional. The bank account which is charged by direct debit, as FinancialAccountInput. |
BT-91 |
PaymentTermsInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| note | String |
The textual description of payment terms applicable to the amount due. The maximum allowed number of characters is 300. | BT-20 |
TaxTotalInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| taxAmount | CurrencyAmountInput |
The VAT amount applicable to the invoice. | BT-110, BT-111 |
| taxSubtotals | [TaxSubtotalInput] |
A list of TaxSubtotalInput objects that provide information about the distribution of VAT by different categories, rates, and reasons for VAT exemption. |
BG-23 |
CurrencyAmountInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| currency | String |
Mandatory. The currency code. Valid values are according to ISO 4217 (for example, RON for Romanian Lei). | |
| amount | Float |
Mandatory. The amount, rounded to two decimals. |
TaxSubtotalInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| taxableAmount | CurrencyAmountInput |
The amount on which VAT is applied. | BT-116 |
| taxAmount | CurrencyAmountInput |
The VAT amount applicable to this subtotal. | BT-117 |
| taxCategory | TaxCategoryInput |
The VAT details (including VAT category code and rate), expressed as a TaxCategoryInput object, applicable to this subtotal. |
TaxCategoryInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String |
Mandatory. The VAT category code. Valid values are according to UNTDID 5305[6] | BT-118, BT-151 |
| percent | Float |
Mandatory. The VAT rate, expressed as a percentage. | BT-119, BT-152 |
| taxExemptionReason | String |
Optional. A textual statement of the reason why the amount is exempt from VAT. The maximum allowed number of characters is 100. | BT-120 |
| taxExemptionReasonCode | String |
Optional. A code expressing the reason why the amount is exempt from VAT. Valid values are according to CEF (Connecting Europe Facility) VATEX code list. | BT-121 |
| taxScheme | TaxSchemeInput |
Mandatory. Identifies the tax scheme used, see TaxSchemeInput. |
LegalMonetaryTotalInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| lineExtensionAmount | CurrencyAmountInput |
The total of all net amounts of all items on the invoice. | BT-106 |
| taxExclusiveAmount | CurrencyAmountInput |
The total amount of the invoice, excluding VAT. | BT-109 |
| taxInclusiveAmount | CurrencyAmountInput |
The total amount of the invoice, including VAT. | BT-112 |
| allowanceTotalAmount | CurrencyAmountInput |
The total of all document-level discounts on the invoice. | BT-107 |
| chargeTotalAmount | CurrencyAmountInput |
The total of all document-level charges on the invoice. | BT-108 |
| prepaidAmount | CurrencyAmountInput |
The total of prepaid amounts on the invoice. This amount is deducted from the total VAT for the calculation of the payment due amount. | BT-113 |
| payableRoundingAmount | CurrencyAmountInput |
The amount which must be added to the total in order to round off the payment amount. | BT-114 |
| payableAmount | CurrencyAmountInput |
The total amount of the invoice with VAT deducted for the prepaid amount. The amount is zero in case of a fully paid invoice. The amount may be negative, in which case the seller owes that amount to the buyer. | BT-115 |
InvoiceLineInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String! |
Mandatory. The identifier of the invoiced item. | BT-126 |
| notes | [String] |
Optional. The text note relevant to the invoiced item. Note that a single item having maximum 300 characters in length is accepted in the input array, to meet ANAF’s validation rules. | BT-127 |
| invoicedQuantity | QuantityInput |
Optional. The quantity of invoiced items. See QuantityInput. |
|
| lineExtensionAmount | CurrencyAmountInput! |
Mandatory. The total amount for the invoiced items, without VAT, but including item-level discounts and charges. See CurrencyAmountInput. |
BT-131 |
| orderLineReference | OrderLineReferenceInput |
Optional. Identifies the item on the purchase order issued by the buyer. | BT-132 |
| allowanceCharge | LineAllowanceChargeInput |
Optional. Specifies the charge or discount applicable to this line item. | BG-27 (for discount) or BG-28 (for charge) |
| taxTotal | [TaxTotalInput] |
Optional. Provides VAT information about the invoiced items, as a list of TaxTotalInput objects. |
|
| withholdingTaxTotal | [TaxTotalInput] |
Optional. Provides withholding tax information about the invoiced items, as a list of TaxTotalInput objects. |
|
| item | ItemInput! |
Mandatory. Provides information about the invoiced good or service, as an ItemInput object. |
BG-31 |
| price | PriceInput |
Optional. The item’s price details, as a PriceInput object. |
BG-29 |
QuantityInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| unitCode | String! |
Mandatory. The unit of measure applicable to the invoiced quantity. Valid values are according to the UN/ECE Recommendation 20 [7] and UN/ECE Recommendation 21 [19]. | BT-130 |
| quantity | Float! |
Mandatory. The quantity of invoiced goods or services. | BT-129 |
OrderLineReferenceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String |
Mandatory. The identifier of the purchase order issued by the buyer. | BT-132 |
LineAllowanceChargeInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| chargeIndicator | Boolean |
Optional. Determines whether a charge or discount applies to this line item. Valid values: false - discount, true - charge. | |
| allowanceChargeReasonCode | String |
Optional. If chargeIndicator = false, this is the discount reason, expressed as a code. Valid values are according to UNTDID 5189 [6] code list. If chargeIndicator = true, this is the charge reason, expressed as a code. Valid values are according to UNTDID 7161 [6] code list. |
BT-140 if chargeIndicator = false, BT-145 if chargeIndicator = true |
| allowanceChargeReason | String |
Optional. If chargeIndicator = false, this is the discount reason, expressed as text. If chargeIndicator = true, this is the charge reason, expressed as text. |
BT-139 if chargeIndicator = false, BT-144 if chargeIndicator = true |
| multiplierFactorNumeric | Float |
Optional. If chargeIndicator = false, this is the percentage that, together with the base amount of the invoice item, can be used to calculate the discount amount for the invoice item. If chargeIndicator = true, this is the percentage that, together with the base amount of the invoice item, can be used to calculate the charge for the invoice item. |
BT-138 if chargeIndicator = false, BT-143 if chargeIndicator = true |
| amount | CurrencyAmountInput! |
Optional. If chargeIndicator = false, this is the amount of discount without VAT. If chargeIndicator = true, this is the amount charged without VAT. |
BT-136 if chargeIndicator = false, BT-141 if chargeIndicator = true |
| baseAmount | CurrencyAmountInput |
Optional. If chargeIndicator = false, this is the basic amount that, together with the discount percentage of the invoice item, can be used to calculate the discount amount of the invoice item. If chargeIndicator = true, this is the basic amount that, together with the charge percentage of the invoice item, can be used to calculate the charge of the invoice item. |
BT-137 if chargeIndicator = false, BT-142 if chargeIndicator = true |
ItemInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| description | String |
Optional. The description of the invoiced item. | BT-154 |
| name | String |
Optional. The name of the invoiced item. | BT-153 |
| buyersItemIdentifications | ItemIdentificationInput |
Optional. The identifier assigned to the item by the buyer, as an ItemIdentificationInput object. |
BT-156 |
| sellersItemIdentification | ItemIdentificationInput |
Optional. The identifier assigned to the item by the seller, as an ItemIdentificationInput object. |
BT-155 |
| standardItemIdentification | StandardItemIdentificationInput |
Optional. The identifier assigned to the item based on a registered scheme. See StandardItemIdentificationInput. |
BT-157 |
| originCountry | CountryInput |
Optional. The item’s country of origin, as a CountryInput object. |
BT-159 |
| commodityClassifications | [CommodityClassificationInput] |
Optional. The item’s classification according to one or multiple code schemes, as a list of CommodityClassificationInput objects. |
|
| classifiedTaxCategory | TaxCategoryInput |
Optional. The item’s tax details, as a TaxCategoryInput object. |
BG-30 |
| additionalItemProperties | [AdditionalItemPropertyInput] |
Optional. This field provides additional item properties (name-value pairs), as a list of AdditionalItemPropertyInput objects. |
BG-32 |
ItemIdentificationInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String |
The actual identifier value assigned to the item. |
StandardItemIdentificationInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String |
Optional. The identifier value assigned to the item, for example, an EAN (European Article Number) code. | |
| schemeID | String |
Optional. The identifier of the scheme that describes the identifier value above. Valid values are according to ISO/IEC 6523. If you don’t supply this value, the scheme identifier is assumed to be 0160 (this code denotes a Global Trade Item Number, according to ISO/IEC 6523). |
CountryInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| identificationCode | CountryCode |
The country code according to ISO 3166-1. |
CommodityClassificationInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| itemClassificationCode | ItemClassificationCodeInput |
The item’s classification information, as an ItemClassificationCodeInput object. |
ItemClassificationCodeInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| id | String |
Optional. The code used to classify the item. | BT-158 |
| listID | String |
Mandatory. The identification scheme used for classification. Valid values are according to UNTDID 7143 [6]. | BT-158 |
| listVersionID | String |
Optional. The version of the identification scheme. | BT-158 |
AdditionalItemPropertyInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| name | String |
The name of the additional property. For example, “color”. | BT-160 |
| value | String |
The value of the additional property. For example, “red”. | BT-161 |
PriceInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| priceAmount | CurrencyAmountInput |
The item’s price without VAT after deduction of the discount price. The net price of the item must be equal to the gross price of the item, reduced by the value of the discount of the item. | BT-146 |
| baseQuantity | QuantityInput |
The number of item units to which the price refers, as a QuantityInput object. |
BT-149 |
| allowanceCharge | AllowanceChargeInput |
Provides information about (i) the discounts or (ii) the charges and taxes other than the VAT, applicable at line level, as an AllowanceChargeInput object. |
AllowanceChargeInput input
| Attribute | Type | Description | Code |
|---|---|---|---|
| chargeIndicator | Boolean |
Specifies whether a charge or a discount is involved. Valid values: true - tax or charge, false - discount. | |
| amount | CurrencyAmountInput |
For discounts, it specifies the amount of discount, without VAT. For charges, it specifies the amount charged, without VAT. | BT-147 |
| baseAmount | CurrencyAmountInput |
For discounts, it specifies the basic amount that, together with the discount percentage of the invoice item, can be used to calculate the discount amount of the invoice item. For charges, it specifies the basic amount that, together with the charge percentage of an invoice item, can be used to calculate the charge of the invoice item. | BT-148 |
Result
The generated XML invoice, as a String type.
Example
The following query returns a B2C invoice issued by an example company “Alpha SRL” to a physical person. For the invoice to be valid, make sure to replace {{SUPPLIER_TIN}} with the actual Romanian tax identification number of the organization that issues the invoice.
query PreviewInvoice($input:CreateInvoiceInput!, $skipVerification:Boolean) {
previewInvoice(input:$input,skipVerification:$skipVerification)
}
{
"input": {
"invoiceNumber": "20260112-01",
"issueDate": "2026-01-12",
"dueDate": "2026-01-19",
"invoiceTypeCode": "380",
"documentCurrencyCode": "RON",
"accountingSupplierParty": {
"party": {
"partyName": "Alpha SRL",
"partyTaxScheme": {
"companyID": "RO{{SUPPLIER_TIN}}",
"taxScheme": {
"id": "VAT"
}
},
"partyLegalEntity": {
"registrationName": "Alpha SRL"
},
"postalAddress": {
"streetName": "Universului, 1",
"city": "Brasov",
"region": "RO-BV",
"country": "RO"
}
}
},
"accountingCustomerParty": {
"party": {
"partyLegalEntity": {
"registrationName": "Maria Marin"
},
"partyTaxScheme": {
"companyID": "0000000000000",
"taxScheme": {}
},
"postalAddress": {
"streetName": "Nucului, 1",
"city": "Târgoviște",
"region": "RO-DB",
"country": "RO"
}
}
},
"taxTotal": {
"taxAmount": {
"currency": "RON",
"amount": 5
},
"taxSubtotals": {
"taxableAmount": {
"currency": "RON",
"amount": 100
},
"taxAmount": {
"currency": "RON",
"amount": 5
},
"taxCategory": {
"id": "S",
"percent": 5,
"taxScheme": {
"id": "VAT"
}
}
}
},
"legalMonetaryTotal": {
"lineExtensionAmount": {
"currency": "RON",
"amount": 100
},
"taxExclusiveAmount": {
"currency": "RON",
"amount": 100
},
"taxInclusiveAmount": {
"currency": "RON",
"amount": 105
},
"payableAmount": {
"currency": "RON",
"amount": 105
}
},
"lines": [
{
"id": "1",
"invoicedQuantity": {
"unitCode": "C62",
"quantity": 1
},
"lineExtensionAmount": {
"currency": "RON",
"amount": 100
},
"item": {
"name": "eBook",
"classifiedTaxCategory": {
"id": "S",
"percent": 5,
"taxScheme": {
"id": "VAT"
}
}
},
"price": {
"priceAmount": {
"currency": "RON",
"amount": 100
},
"baseQuantity": {
"unitCode": "C62",
"quantity": 1
}
}
}
]
},
"skipVerification": false
}
storedMessages
Retrieves messages received from ANAF and subsequently stored in SBS. Unlike the messages query, the storedMessages query enables listing of messages older than 60 days.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. Specifies the organization ID for which messages are to be retrieved. |
| filter | StoredMessagesFilter |
Optional. Specifies the filtering options, as an StoredMessagesFilter input. |
| nextToken | String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the StoredMessagesResult type. |
StoredMessagesFilter input
| Attribute | Type | Description |
|---|---|---|
| createdAt | DateFilter |
Mandatory. Specifies the date range for which messages are to be retrieved, as a DateFilter input. |
Result
StoredMessagesResult type
| Attribute | Type | Description |
|---|---|---|
| items | [StoredMessage] |
The list of StoredMessage objects matching the filtering criteria. |
| nextToken | String |
If null, then the query has reached the end of the list of messages that match the query criteria. If not null, then use this value in the nextToken input argument to obtain the next page. |
StoredMessage type
| Attribute | Type | Description |
|---|---|---|
| id | String |
The unique identifier of the message. |
| creationDate | String |
The date when the message was created by ANAF. |
| tin | String |
The tax identification number (TIN) of the organization to which this message applies. |
| requestId | String |
The identifier of the ANAF request. This field is provided by ANAF; it identifies either an invoice or an invoice notification submitted to ANAF. If message type is “FACTURA TRIMISA” or “FACTURA PRIMITA”, the requestId correlates with the requestId of the Invoice object. |
| invoiceRequestId | String |
The identifier of the outbound invoice to which this message makes reference. This field will be populated only if the message references an outbound invoice (that is, if message type is “FACTURA TRIMISA”). |
| inboundInvoiceRequestId | String |
The identifier of the inbound invoice to which this message makes reference. This field will be populated only if the message references an inbound invoice (that is, if message type is “FACTURA PRIMITA”). |
| details | String |
Any other information which may be applicable to the message. |
| type | String |
The message type, as populated by ANAF. |
| createdAt | DateTime |
The date and time when the message was stored in SBS. |
Example
The following query fetches stored messages by organization ID. The query uses a filter to fetch messages between January the 1st, 2024 and December the 31st, 2025. The nextToken parameter is set to null, meaning that only the first page of results will be retrieved.
query StoredMessages($organizationId:ID!, $filter:StoredMessagesFilter, $nextToken: String) {
storedMessages (organizationId:$organizationId, filter:$filter, nextToken: $nextToken) {
items {
id
creationDate
tin
requestId
invoiceRequestId
inboundInvoiceRequestId
details
type
createdAt
}
nextToken
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"filter": {
"createdAt": {
"from": "2024-01-01",
"to": "2024-12-31"
}
},
"nextToken": null
}
verifyXml
Returns the result of validating an XML invoice against the ANAF validation API. This method is a wrapper around the ANAF e-Factura validation API, therefore, it returns the same errors and validation outcome as returned by ANAF.
Arguments
| Argument | Type | Description |
|---|---|---|
| xml | String! |
Mandatory. The XML invoice to be validated, as a string type. |
Result
VerifyXmlResult type
| Attribute | Type | Description |
|---|---|---|
| status | VerifyXmlStatus |
An enumeration with the following valid values: ok - validation successful, error - validation failed with errors. |
| errors | [String] |
If validation fails, this field is populated with the actual validation errors encountered. |
Example
The following query returns the verification result of an XML invoice. The outcome of this query will be an error status, since the supplier TIN used in the input XML is a fictitious one.
query verifyXml($xml:String!) {
verifyXml(xml:$xml) {
status
errors
}
}
{
"xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Invoice xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\" xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\" xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd\">\n <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1</cbc:CustomizationID>\n <cbc:ID>20260112-01</cbc:ID>\n <cbc:IssueDate>2026-01-12</cbc:IssueDate>\n <cbc:DueDate>2026-01-19</cbc:DueDate>\n <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>\n <cbc:DocumentCurrencyCode>RON</cbc:DocumentCurrencyCode>\n <cac:AccountingSupplierParty>\n <cac:Party>\n <cac:PartyName>\n <cbc:Name>Alpha SRL</cbc:Name>\n </cac:PartyName>\n <cac:PostalAddress>\n <cbc:StreetName>Universului, 1</cbc:StreetName>\n <cbc:CityName>Brasov</cbc:CityName>\n <cbc:CountrySubentity>RO-BV</cbc:CountrySubentity>\n <cac:Country>\n <cbc:IdentificationCode>RO</cbc:IdentificationCode>\n </cac:Country>\n </cac:PostalAddress>\n <cac:PartyTaxScheme>\n <cbc:CompanyID>RO1234567</cbc:CompanyID>\n <cac:TaxScheme>\n <cbc:ID>VAT</cbc:ID>\n </cac:TaxScheme>\n </cac:PartyTaxScheme>\n <cac:PartyLegalEntity>\n <cbc:RegistrationName>Alpha SRL</cbc:RegistrationName>\n </cac:PartyLegalEntity>\n </cac:Party>\n </cac:AccountingSupplierParty>\n <cac:AccountingCustomerParty>\n <cac:Party>\n <cac:PostalAddress>\n <cbc:StreetName>Nucului, 1</cbc:StreetName>\n <cbc:CityName>Târgoviște</cbc:CityName>\n <cbc:CountrySubentity>RO-DB</cbc:CountrySubentity>\n <cac:Country>\n <cbc:IdentificationCode>RO</cbc:IdentificationCode>\n </cac:Country>\n </cac:PostalAddress>\n <cac:PartyTaxScheme>\n <cbc:CompanyID>0000000000000</cbc:CompanyID>\n <cac:TaxScheme/>\n </cac:PartyTaxScheme>\n <cac:PartyLegalEntity>\n <cbc:RegistrationName>Raymond Haley</cbc:RegistrationName>\n </cac:PartyLegalEntity>\n </cac:Party>\n </cac:AccountingCustomerParty>\n <cac:TaxTotal>\n <cbc:TaxAmount currencyID=\"RON\">5</cbc:TaxAmount>\n <cac:TaxSubtotal>\n <cbc:TaxableAmount currencyID=\"RON\">100</cbc:TaxableAmount>\n <cbc:TaxAmount currencyID=\"RON\">5</cbc:TaxAmount>\n <cac:TaxCategory>\n <cbc:ID>S</cbc:ID>\n <cbc:Percent>5</cbc:Percent>\n <cac:TaxScheme>\n <cbc:ID>VAT</cbc:ID>\n </cac:TaxScheme>\n </cac:TaxCategory>\n </cac:TaxSubtotal>\n </cac:TaxTotal>\n <cac:LegalMonetaryTotal>\n <cbc:LineExtensionAmount currencyID=\"RON\">100</cbc:LineExtensionAmount>\n <cbc:TaxExclusiveAmount currencyID=\"RON\">100</cbc:TaxExclusiveAmount>\n <cbc:TaxInclusiveAmount currencyID=\"RON\">105</cbc:TaxInclusiveAmount>\n <cbc:PayableAmount currencyID=\"RON\">105</cbc:PayableAmount>\n </cac:LegalMonetaryTotal>\n <cac:InvoiceLine>\n <cbc:ID>1</cbc:ID>\n <cbc:InvoicedQuantity unitCode=\"C62\">1</cbc:InvoicedQuantity>\n <cbc:LineExtensionAmount currencyID=\"RON\">100</cbc:LineExtensionAmount>\n <cac:Item>\n <cbc:Name>eBook</cbc:Name>\n <cac:ClassifiedTaxCategory>\n <cbc:ID>S</cbc:ID>\n <cbc:Percent>5</cbc:Percent>\n <cac:TaxScheme>\n <cbc:ID>VAT</cbc:ID>\n </cac:TaxScheme>\n </cac:ClassifiedTaxCategory>\n </cac:Item>\n <cac:Price>\n <cbc:PriceAmount currencyID=\"RON\">100</cbc:PriceAmount>\n <cbc:BaseQuantity unitCode=\"C62\">1</cbc:BaseQuantity>\n </cac:Price>\n </cac:InvoiceLine>\n</Invoice>"
}
version
Returns the API version.
Example
The following query returns the current API version.
{
version
}
Mutations
createArchive
Creates a new archive.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization for which the archive should be created. |
| input | CreateArchiveInput! |
Mandatory. The input data to the mutation. |
CreateArchiveInput input
| Argument | Type | Description |
|---|---|---|
| invoiceType | InvoiceType! |
Mandatory. Specifies whether the archive shall include inbound or outbound invoices. Valid values: INBOUND, OUTBOUND. |
| startDate | Date! |
Mandatory. The archive start date, in YYYY-MM-DD format. This date refers to the invoice upload date (NOT the issue date or creation date). |
| endDate | Date! |
Mandatory. The archive end date, in YYYY-MM-DD format. Only invoices up to and including this date will be archived. This date refers to the invoice upload date (NOT the issue date or creation date). |
Result
See the Archive type.
Example
The code listing below shows how to create an archive of all inbound invoices between January the 1st, 2025 and December the 31st, 2025.
mutation CreateArchive($organizationId:ID!, $input:CreateArchiveInput!) {
createArchive(organizationId:$organizationId, input:$input) {
id
status
invoiceType
status
startDate
endDate
errorMessage
archivedInvoices
createdAt
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"input": {
"invoiceType": "INBOUND",
"startDate": "2025-01-01",
"endDate": "2025-12-31"
}
}
createInvoice
Creates an invoice without actually uploading it to ANAF. This call does not require authorization to ANAF.
Arguments
| Attribute | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization issuing the invoice. You can create organizations through the Organizations Service. |
| input | CreateInvoiceInput! |
Mandatory. The input data for creating the invoice, as a CreateInvoiceInput object. |
Result
See the Invoice type.
Example
The following mutation creates a B2C invoice issued by an example company “Alpha SRL” to a physical person. For the invoice to be valid, make sure to replace the following variables:
YOUR_ORGANIZATION_ID- use the unique identifier (in SBS) of the organization that issues the invoice{{SUPPLIER_TIN}}- use the Romanian tax identification number of the organization that issues the invoice.
mutation CreateInvoice($organizationId:ID!, $input:CreateInvoiceInput!) {
createInvoice(organizationId:$organizationId, input:$input) {
id
organizationId
invoiceNumber
issueDate
dueDate
invoiceTypeCode
documentCurrencyCode
orderReference { id, salesOrderID }
status
uploadDate
requestId
downloadId
messages { id, creationDate, tin, requestId, details, type }
notifications { message, createdAt }
xmlFile { id downloadUrl }
pdfFile { id downloadUrl }
zipFile { id downloadUrl }
attachments { id downloadUrl }
uploadedToTestEnvironment
accountingSupplierParty { partyName partyTaxScheme {companyID} partyLegalEntity { registrationName companyID } }
accountingCustomerParty { partyName partyTaxScheme {companyID} partyLegalEntity { registrationName companyID } }
supplierTin
customerTin
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
taxTotal { taxAmount { currency amount } }
external
createdAt
standard
customerRelationship
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"input": {
"invoiceNumber": "20260113-01",
"issueDate": "2026-01-13",
"dueDate": "2026-01-20",
"invoiceTypeCode": "380",
"documentCurrencyCode": "RON",
"accountingSupplierParty": {
"party": {
"partyName": "Alpha SRL",
"partyTaxScheme": {
"companyID": "RO{{SUPPLIER_TIN}}",
"taxScheme": {
"id": "VAT"
}
},
"partyLegalEntity": {
"registrationName": "Alpha SRL"
},
"postalAddress": {
"streetName": "Universului, 1",
"city": "Brasov",
"region": "RO-BV",
"country": "RO"
}
}
},
"accountingCustomerParty": {
"party": {
"partyLegalEntity": {
"registrationName": "Maria Marin"
},
"partyTaxScheme": {
"companyID": "0000000000000",
"taxScheme": {}
},
"postalAddress": {
"streetName": "Nucului, 1",
"city": "Târgoviște",
"region": "RO-DB",
"country": "RO"
}
}
},
"taxTotal": {
"taxAmount": {
"currency": "RON",
"amount": 5
},
"taxSubtotals": {
"taxableAmount": {
"currency": "RON",
"amount": 100
},
"taxAmount": {
"currency": "RON",
"amount": 5
},
"taxCategory": {
"id": "S",
"percent": 5,
"taxScheme": {
"id": "VAT"
}
}
}
},
"legalMonetaryTotal": {
"lineExtensionAmount": {
"currency": "RON",
"amount": 100
},
"taxExclusiveAmount": {
"currency": "RON",
"amount": 100
},
"taxInclusiveAmount": {
"currency": "RON",
"amount": 105
},
"payableAmount": {
"currency": "RON",
"amount": 105
}
},
"lines": [
{
"id": "1",
"invoicedQuantity": {
"unitCode": "C62",
"quantity": 1
},
"lineExtensionAmount": {
"currency": "RON",
"amount": 100
},
"item": {
"name": "eBook",
"classifiedTaxCategory": {
"id": "S",
"percent": 5,
"taxScheme": {
"id": "VAT"
}
}
},
"price": {
"priceAmount": {
"currency": "RON",
"amount": 100
},
"baseQuantity": {
"unitCode": "C62",
"quantity": 1
}
}
}
]
}
}
deleteArchive
Deletes an archive.
Arguments
| Argument | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization for which the archive should be created. |
| id | ID! |
Mandatory. The ID of the archive to be deleted. |
Result
See the Archive type.
Example
The code listing below illustrates deleting an archive by ID.
mutation DeleteArchive($organizationId:ID!, $id:ID!) {
deleteArchive(organizationId:$organizationId, id:$id) {
id
status
invoiceType
status
startDate
endDate
errorMessage
archivedInvoices
createdAt
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"id": "YOUR_ARCHIVE_ID"
}
createInvoiceFromXml
Creates an invoice from XML input, without actually uploading it to ANAF. This call does not require authorization to ANAF.
Arguments
| Attribute | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization issuing the invoice. You can create organizations through the Organizations Service. |
| xml | String! |
Mandatory. A string that provides the invoice data in XML format, using the UBL 2.1 syntax. |
Result
See the Invoice type.
Example
The code listing below illustrates creating an invoice from an XML. Note that the xml parameter uses a dummy supplier TIN set to RO123456. For the query to be successful, change this value to a real TIN.
mutation CreateInvoiceFromXml($organizationId:ID!, $xml:String!) {
createInvoiceFromXml(organizationId:$organizationId, xml:$xml) {
id
organizationId
invoiceNumber
issueDate
dueDate
invoiceTypeCode
documentCurrencyCode
orderReference { id, salesOrderID }
status
uploadDate
requestId
downloadId
messages { id, creationDate, tin, requestId, details, type }
notifications { message, createdAt }
xmlFile { id downloadUrl }
pdfFile { id downloadUrl }
zipFile { id downloadUrl }
attachments { id downloadUrl }
uploadedToTestEnvironment
accountingSupplierParty { partyName partyTaxScheme {companyID} partyLegalEntity { registrationName companyID } }
accountingCustomerParty { partyName partyTaxScheme {companyID} partyLegalEntity { registrationName companyID } }
supplierTin
customerTin
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
taxTotal { taxAmount { currency amount } }
external
createdAt
standard
customerRelationship
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Invoice xmlns:cac=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\" xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\" xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd\">\n <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:efactura.mfinante.ro:CIUS-RO:1.0.1</cbc:CustomizationID>\n <cbc:ID>20260112-01</cbc:ID>\n <cbc:IssueDate>2026-01-12</cbc:IssueDate>\n <cbc:DueDate>2026-01-19</cbc:DueDate>\n <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>\n <cbc:DocumentCurrencyCode>RON</cbc:DocumentCurrencyCode>\n <cac:AccountingSupplierParty>\n <cac:Party>\n <cac:PartyName>\n <cbc:Name>Demo SRL</cbc:Name>\n </cac:PartyName>\n <cac:PostalAddress>\n <cbc:StreetName>Universului, 1</cbc:StreetName>\n <cbc:CityName>Brasov</cbc:CityName>\n <cbc:CountrySubentity>RO-BV</cbc:CountrySubentity>\n <cac:Country>\n <cbc:IdentificationCode>RO</cbc:IdentificationCode>\n </cac:Country>\n </cac:PostalAddress>\n <cac:PartyTaxScheme>\n <cbc:CompanyID>RO1234567</cbc:CompanyID>\n <cac:TaxScheme>\n <cbc:ID>VAT</cbc:ID>\n </cac:TaxScheme>\n </cac:PartyTaxScheme>\n <cac:PartyLegalEntity>\n <cbc:RegistrationName>Alpha SRL</cbc:RegistrationName>\n </cac:PartyLegalEntity>\n </cac:Party>\n </cac:AccountingSupplierParty>\n <cac:AccountingCustomerParty>\n <cac:Party>\n <cac:PostalAddress>\n <cbc:StreetName>Nucului, 1</cbc:StreetName>\n <cbc:CityName>Târgoviște</cbc:CityName>\n <cbc:CountrySubentity>RO-DB</cbc:CountrySubentity>\n <cac:Country>\n <cbc:IdentificationCode>RO</cbc:IdentificationCode>\n </cac:Country>\n </cac:PostalAddress>\n <cac:PartyTaxScheme>\n <cbc:CompanyID>0000000000000</cbc:CompanyID>\n <cac:TaxScheme/>\n </cac:PartyTaxScheme>\n <cac:PartyLegalEntity>\n <cbc:RegistrationName>Ion Popescu</cbc:RegistrationName>\n </cac:PartyLegalEntity>\n </cac:Party>\n </cac:AccountingCustomerParty>\n <cac:TaxTotal>\n <cbc:TaxAmount currencyID=\"RON\">5</cbc:TaxAmount>\n <cac:TaxSubtotal>\n <cbc:TaxableAmount currencyID=\"RON\">100</cbc:TaxableAmount>\n <cbc:TaxAmount currencyID=\"RON\">5</cbc:TaxAmount>\n <cac:TaxCategory>\n <cbc:ID>S</cbc:ID>\n <cbc:Percent>5</cbc:Percent>\n <cac:TaxScheme>\n <cbc:ID>VAT</cbc:ID>\n </cac:TaxScheme>\n </cac:TaxCategory>\n </cac:TaxSubtotal>\n </cac:TaxTotal>\n <cac:LegalMonetaryTotal>\n <cbc:LineExtensionAmount currencyID=\"RON\">100</cbc:LineExtensionAmount>\n <cbc:TaxExclusiveAmount currencyID=\"RON\">100</cbc:TaxExclusiveAmount>\n <cbc:TaxInclusiveAmount currencyID=\"RON\">105</cbc:TaxInclusiveAmount>\n <cbc:PayableAmount currencyID=\"RON\">105</cbc:PayableAmount>\n </cac:LegalMonetaryTotal>\n <cac:InvoiceLine>\n <cbc:ID>1</cbc:ID>\n <cbc:InvoicedQuantity unitCode=\"C62\">1</cbc:InvoicedQuantity>\n <cbc:LineExtensionAmount currencyID=\"RON\">100</cbc:LineExtensionAmount>\n <cac:Item>\n <cbc:Name>eBook</cbc:Name>\n <cac:ClassifiedTaxCategory>\n <cbc:ID>S</cbc:ID>\n <cbc:Percent>5</cbc:Percent>\n <cac:TaxScheme>\n <cbc:ID>VAT</cbc:ID>\n </cac:TaxScheme>\n </cac:ClassifiedTaxCategory>\n </cac:Item>\n <cac:Price>\n <cbc:PriceAmount currencyID=\"RON\">100</cbc:PriceAmount>\n <cbc:BaseQuantity unitCode=\"C62\">1</cbc:BaseQuantity>\n </cac:Price>\n </cac:InvoiceLine>\n</Invoice>"
}
notifyInvoiceSender
Sends a message to the sender of an inbound invoice, through the ANAF infrastructure.
This call requires authorization to ANAF, which you can obtain through the RO ANAF OAuth Service.
Arguments
| Attribute | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization that sends the message (that is, the organization that received the invoice). |
| input | NotifyInvoiceSenderInput! |
Mandatory. The input data, as an object of type NotifyInvoiceSenderInput. |
NotifyInvoiceSenderInput input
| Attribute | Type | Description |
|---|---|---|
| inboundInvoiceId | ID! |
Mandatory. The identifier of the inbound invoice that concerns this message. |
| message | String! |
Mandatory. The message to be sent to the invoice sender. The text length must not exceed 4000 characters. |
Result
Notification type
| Attribute | Type | Description |
|---|---|---|
| message | String |
The text of the notification message. |
| createdAt | DateTime |
The date and time when the message was created. |
Example
The code listing below illustrates sending a notification to the invoice sender. In this example,
YOUR_ORGANIZATION_ID is the company that received the inbound invoice (YOUR_INBOUND_INVOICE_ID).
mutation NotifyInvoiceSender($organizationId:ID!, $input:NotifyInvoiceSenderInput!) {
notifyInvoiceSender(organizationId:$organizationId, input:$input) {
message
createdAt
}
}
{
"organizationId": "YOUR_ORGANIZATION_ID",
"input": {
"inboundInvoiceId": "YOUR_INBOUND_INVOICE_ID",
"message": "Lorem ipsum."
}
}
sendInvoice
Creates and also uploads an invoice to ANAF, in a single call. Running this mutation is equivalent to running createInvoice and then uploadInvoice.
Arguments
| Attribute | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization issuing the invoice. You can create organizations through the Organizations Service. |
| input | CreateInvoiceInput! |
Mandatory. The input data for creating the invoice, as a CreateInvoiceInput object. |
Result
See the Invoice type.
Example
The code listing below illustrates sending an invoice. For the call to be successful, replace {{SUPPLIER_TIN}} with a real Romanian company TIN.
mutation SendInvoice($organizationId:ID!, $input:CreateInvoiceInput!) {
sendInvoice(organizationId:$organizationId, input:$input) {
id
organizationId
invoiceNumber
issueDate
invoiceTypeCode
status
requestId
downloadId
messages { id, creationDate, tin, requestId, details, type },
uploadedToTestEnvironment,
accountingCustomerParty { partyName partyTaxScheme {companyID} partyLegalEntity { registrationName companyID } }
accountingSupplierParty { partyName partyTaxScheme {companyID} partyLegalEntity { registrationName companyID } }
supplierTin
customerTin
legalMonetaryTotal {
lineExtensionAmount { currency amount }
taxExclusiveAmount { currency amount }
taxInclusiveAmount { currency amount }
allowanceTotalAmount { currency amount }
chargeTotalAmount { currency amount }
prepaidAmount { currency amount }
payableRoundingAmount { currency amount }
payableAmount { currency amount }
}
external
createdAt
}
}
{
"organizationId": "{{ORGANIZATION_ID}}",
"input": {
"invoiceNumber": "20260114-01",
"issueDate": "2026-01-14",
"dueDate": "2026-01-21",
"invoiceTypeCode": "380",
"documentCurrencyCode": "RON",
"accountingSupplierParty": {
"party": {
"partyName": "Demo SRL",
"partyTaxScheme": {
"companyID": "RO{{SUPPLIER_TIN}}",
"taxScheme": {
"id": "VAT"
}
},
"partyLegalEntity": {
"registrationName": "Demo SRL"
},
"postalAddress": {
"streetName": "Universului, 1",
"city": "Brasov",
"region": "RO-BV",
"country": "RO"
}
}
},
"accountingCustomerParty": {
"party": {
"partyLegalEntity": {
"registrationName": "Maria Popescu"
},
"partyTaxScheme": {
"companyID": "0000000000000",
"taxScheme": {}
},
"postalAddress": {
"streetName": "Nucului, 1",
"city": "Târgoviște",
"region": "RO-DB",
"country": "RO"
}
}
},
"taxTotal": {
"taxAmount": {
"currency": "RON",
"amount": 5
},
"taxSubtotals": {
"taxableAmount": {
"currency": "RON",
"amount": 100
},
"taxAmount": {
"currency": "RON",
"amount": 5
},
"taxCategory": {
"id": "S",
"percent": 5,
"taxScheme": {
"id": "VAT"
}
}
}
},
"legalMonetaryTotal": {
"lineExtensionAmount": {
"currency": "RON",
"amount": 100
},
"taxExclusiveAmount": {
"currency": "RON",
"amount": 100
},
"taxInclusiveAmount": {
"currency": "RON",
"amount": 105
},
"payableAmount": {
"currency": "RON",
"amount": 105
}
},
"lines": [
{
"id": "1",
"invoicedQuantity": {
"unitCode": "C62",
"quantity": 1
},
"lineExtensionAmount": {
"currency": "RON",
"amount": 100
},
"item": {
"name": "eBook",
"classifiedTaxCategory": {
"id": "S",
"percent": 5,
"taxScheme": {
"id": "VAT"
}
}
},
"price": {
"priceAmount": {
"currency": "RON",
"amount": 100
},
"baseQuantity": {
"unitCode": "C62",
"quantity": 1
}
}
}
]
}
}
sendInvoiceFromXml
Creates an invoice from XML input, and also uploads it to ANAF, in one operation. Running this mutation is equivalent to running createInvoiceFromXml and then uploadInvoice.
Arguments
| Attribute | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization issuing the invoice. You can create organizations through the Organizations Service. |
| xml | String! |
Mandatory. A string that provides the invoice data in XML format, using the UBL 2.1 syntax. |
Result
See the Invoice type.
uploadInvoice
Uploads an invoice to ANAF. Before using this call, the invoice must first be created either through the createInvoice or createInvoiceFromXml mutation.
This call requires authorization to ANAF, which you can obtain through the RO ANAF OAuth Service.
Arguments
| Attribute | Type | Description |
|---|---|---|
| organizationId | ID! |
Mandatory. The ID of the organization uploading the invoice. |
| id | ID! |
Mandatory. The ID of the invoice created previously either through the createInvoice or createInvoiceFromXml mutation. |
Result
See the Invoice type.
Webhooks
The RO e-Factura Service supports webhooks. This means you can optionally configure SBS to send an HTTP POST request to an external server or application whenever any of the following events occur:
- NEW_INBOUND_INVOICE - fires whenever a new inbound invoice is received
- INVOICE_STATUS_CHANGED - fires whenever the status of an outbound invoice changes
- INVOICE_NOTIFICATION_RECEIVED - fires when a notification sent by the invoice recipient to the invoice sender reaches the recipient.
The POST request sent when the NEW_INBOUND_INVOICE event takes place has the following payload:
{
"tenantId": "<your-tenant-id>",
"service": "ro-efactura-api",
"event": "NEW_INBOUND_INVOICE",
"payload": {
"organizationId": "<your-organization-id>",
"invoiceId": "<your-invoice-id>",
}
}
The POST request sent when the INVOICE_STATUS_CHANGED event takes place has the following payload:
{
"tenantId": "<your-tenant-id>",
"service": "ro-efactura-api",
"event": "INVOICE_STATUS_CHANGED",
"payload": {
"organizationId": "<your-organization-id>",
"invoiceId": "<your-invoice-id>",
"status": "SIGNED|REJECTED"
}
}
The POST request sent when the INVOICE_NOTIFICATION_RECEIVED event takes place has the following payload:
{
"tenantId": "<your-tenant-id>",
"service": "ro-efactura-api",
"event": "INVOICE_NOTIFICATION_RECEIVED",
"payload": {
"organizationId": "<your-organization-id>",
"invoiceId": "<your-invoice-id>",
"createdAt": "<DateTime (when notification was received)>"
}
}
For information about configuring webhooks, see Webhooks.