RO e-Factura Service


Access info

Endpoint https://ro-efactura-api.socrate.io/graphql
Required access keys Tenant-level service access key
Pricing Please contact us for details at contact@bitsoftware.ro
Notes To call the service, the access key must be provided in the x-api-key header of the HTTP request. If you are using the GraphQL console, you can view the service’s documentation and schema only after entering an access key. Make sure that the scope of the key allows access to the queries and mutations that you require. For example, to grant the key access to all queries and mutations, the keys’s scope must be set to ro-efactura-api:query:* ro-efactura-api:mutation:*.

Usage

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.

In Romania, e-Factura reporting is mandatory for Business to Government (B2G) transactions, Business to Business (B2B) transactions, as well as for certain 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:

  1. 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.
  2. 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 ANAF Oauth 2.0 secrets.
  3. 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 generateAuthorizationRequest mutation of the RO ANAF OAuth Service. For instructions about performing the authorization process from the SBS Portal, see Managing ANAF Authorizations.

Conventions

  1. 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 createInvoice mutation and the previewInvoice query generate invoices according to the UBL 2.1 syntax.
  2. 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:

  1. Create the invoice using either the createInvoice or createInvoiceFromXml mutations. In either case, the result is of Invoice type. 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.
  2. Upload the invoice by running the uploadInvoice mutation. 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 messages field 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 the messages query.

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:

  1. 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.
  1. Run the createInvoice mutation to create the invoice. In the input parameters, supply an additionalDocumentReference object 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:

  • id is mandatory; it is an identifier of the supporting document as supplied by the invoice issuer
  • documentDescription is optional
  • Replace YOUR_FILE_ID with the file ID of the file created earlier in File Management Service.
  • Since additionalDocumentReference is 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:

  1. The invoice type is 389 (self-invoice)
  2. The customer details that appear on the invoice are those of the organization that issues the invoice.
  3. The issuing organization is ANAF-authorized, as described in Prerequisites.

Queries

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.

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.

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.
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.
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.
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.
supplierTin Int 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.
customerTin Int 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.
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.
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.

invoice

Retrieves a previously created 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.
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.
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.
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.
supplierTin Int The tax identification number of the supplier organization.
customerTin Int The tax identification number of the customer organization.
legalMonetaryTotal LegalMonetaryTotal Provides information about the total monetary amount on the invoice, as a LegalMonetaryTotal object.
external Boolean If true, this field indicates that the invoice is to be uploaded to ANAF with an indication that the customer on the invoice is located outside Romania. 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.
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.
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
CurrencyAmount type
Attribute Type Description Code
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.

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.

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.

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 messages query retrieves messages only for the past 60 days. To retrieve older messages, run the storedMessages query.
  • the messages query retrieves a global list of messages for all invoices. To retrieve messages for specific invoices only, run the invoice or invoices query. Any messages pertaining to the invoice are listed in the messages field of the response Invoice object.

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.

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.

previewInvoice

Generates an XML invoice string according to the input, without storing any objects. If the input is not valid, then the response contains all the validation errors as returned by ANAF. This query is intended only for development purpose, for example, when you need to create an invoice just for testing, 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.

The generated XML invoice string follows the UBL (Universal Business Language) syntax.

Arguments

Argument Type Description
input CreateInvoiceInput! The input data, as a CreateInvoiceInput object, from which the XML invoice is to be created.
CreateInvoiceInput input
Attribute Type Description Code
invoiceNumber String! Mandatory. The internal reference which uniquely identifies the invoice in the seller’s invoicing system. 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. 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. 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. 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. BT-20
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. BT-13
salesOrderID String Optional. The identifier of the sales order, issued by the seller. 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 id with the ID of referenced invoice and documentTypeCode with 130.
  • a reference to a URI. In this case, populate id, documentDescription (optionally), and attachment/externalReference.
  • an attachment. In this case, populate id, documentDescription (optionally), and attachment/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. 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). BT-28 (for suppliers), BT-45 (for customers)
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. 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. 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. BT-37 (for suppliers), BT-52 (for customers),BT-77 (for a delivery address)
postalCode String Optional. The postal/ZIP code. 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. 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”). BT-33 (for suppliers)
ContactInput input
Attribute Type Description Code
name String Optional. The contact name. BT-41 (for suppliers), BT-56 (for customers)
telephone String Optional. The contact’s phone number. BT-42 (for suppliers), BT-57 (for customers)
email EmailAddress Optional. The contact’s email address 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. BT-70
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. 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. 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.

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.

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.

version

Returns the API version.

Mutations

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.

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.

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.

sendInvoice

Creates and also uploads an invoice to ANAF, in a single call. Running this mutation is equivalent to running createInvoice and 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.

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 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.