Logo
Openapi.it Public API Documentation

SDI

Number of APIs: 21


This service allows you to handle interactions with the Italian SDI (Sistema Di Interscambio)

You can configure your account to send invoices directly to the legal storage by setting the api_configuration to your needs

Before we begin

In order to operate, you should register our Recipient Code on the Italian Revenue Agency's website. Please follow this step-by-step guide and provide the following code when needed: JKKZDGR

## Get started:

  1. Create an BusinessRegistryConfiguration with POST /businessregistryconfigurations for your fiscal_id and your email

  2. A mail will be sent to your address to activate the account on the legal storage platform, if required.

  3. Create an ApiConfiguration for your BusinessRegistryConfiguration with POST /api_configurations. This endpoint can be configured to receive all the notifications with a callback.

  4. Create an XML invoice on the endpoint relative to your configuration

To see an example of the callback objects, plese check the Callbacks tab in the /api_configurations request


Please note that in the English translation:

Customer invoices: Fatture attive

Supplier invoices: Fatture passive

Legal storage: Certificazione a norma

Interacting with the legal storage

Legal Storage is the service that enables the legal preservation for your documents. All the stored documents are available into the legal storage management software, a third party software.

When creating a BusinessRegistryConfiguration, you will be asked to provide an email address which will be registed on the platform. You will receive an email containing all the steps to complete the registration and access the platform.

Reactivating a BusinessRegistryConfiguration

If you receive a callback but you have no credit left on your wallet, your account will be temporarily suspended: when this happens, you will be sent a reminder email immediately. In order to re-activate it after a wallet recharge, you would need to submit a PATCH request to /business_registry_configurations/{fiscal_id}/activate

## Interacting with the Public Administration (PA)

Invoices to the Public Administration are automatically detected and signed.

Contact Support: Name: Support


1. {{baseUrl}}/invoices_signature

POST {{baseUrl}}/invoices_signature

Create a new invoice and send it to the government channel. You should explicit the request body format using the content-type header. Your invoice will be queued instantly and you will get back the invoice UUID as a callback



2. {{baseUrl}}/invoices_legal_storage

POST {{baseUrl}}/invoices_legal_storage

Create a new invoice and send it to the government channel. You should explicit the request body format using the content-type header. Your invoice will be queued instantly and you will get back the invoice UUID as a callback



3. {{baseUrl}}/invoices_signature_legal_storage

POST {{baseUrl}}/invoices_signature_legal_storage

Create a new invoice and send it to the government channel. You should explicit the request body format using the content-type header. Your invoice will be queued instantly and you will get back the invoice UUID as a callback



4. {{baseUrl}}/invoices_download/:uuid

GET {{baseUrl}}/invoices_download/:uuid

You can get an invoice in many different formats just specifying a different Accept header:

  • application/xml, you get the XML format
  • text/html, you get the invoice formatted with the chosen stylesheet (via X-PrintTheme header, see below)
  • application/pdf, same as HTML but as a PDF file
  • application/octet-stream, get the raw file (P7M or XML format)


5. {{baseUrl}}/invoices_notifications/:uuid

GET {{baseUrl}}/invoices_notifications/:uuid

Retrieve the collection of notifications for a given invoice. You can have the notification message in JSON format or the original XML by sending the Accept HTTP header to either application/json or application/xml



6. {{baseUrl}}/customer_invoice_imports

POST {{baseUrl}}/customer_invoice_imports

Import a customer invoice that was already sent to SDI. The invoice will not be sent to SDI. You can disable webhook events by sending X-DisableEndpoints: true header.



7. {{baseUrl}}/supplier_invoice_imports

POST {{baseUrl}}/supplier_invoice_imports

Import a supplier invoice that was already received from SDI.



8. {{baseUrl}}/customer_invoice_imports_legal_storage

POST {{baseUrl}}/customer_invoice_imports_legal_storage

Import a customer invoice that was already sent to SDI. The invoice will not be sent to SDI, but it will be sent to the legal storage. You can disable webhook events by sending X-DisableEndpoints: true header.



9. {{baseUrl}}/supplier_invoice_imports_legal_storage

POST {{baseUrl}}/supplier_invoice_imports_legal_storage

Import a supplier invoice that was already received from SDI. The invoice will be sent to the legal storage



10. {{baseUrl}}/simulate/:type

POST {{baseUrl}}/simulate/:type

This service in valid only in Sandbox

This endpoint facilitates testing of services within a sandbox environment, providing the ability to simulate various functionalities:

  1. Supplier Invoice Simulation: Enables the submission of supplier invoices. This service accepts simulated invoices without specific restrictions on the 'codice_destinatario'. Upon submission, the invoice is sent to your account's configured endpoints for the 'supplier-invoice' event.

  2. Customer Notification Simulation: Allows the simulation of customer notifications with various types (NS, RC, MC, NE, DT, AT). It triggers notifications sent to your configured endpoints for the 'customer-notification' event.

  • NS (Notifica di scarto) Received when SDI reject your invoice because it contains errors. The marking property of the related invoice will be set at rejected.

  • RC (Ricevuta consegna) Received when SDI delivers your invoice. The marking property of the related invoice will be set at delivered in case of B2B invoice or delivered-pa in case of B2G invoice.

  • MC (Mancata consegna) Received when SDI can not deliver the invoice to the recipient. The marking property of the related invoice will be set at not-delivered.

  • NE (Notifica esito) Received from SDI when a PA decided to accept or reject your invoice. The marking property of the related invoice will be set at accepted-pa in caso of outcome EC01 or rejected-pa in case of outcome EC02.

  • DT (Notifica decorrenza termini) Received when a PA doesn't reaply with acceptance or rejection within 15 days. The marking property of the related invoice will be set at deadline-terms.

  • AT (Attestazione trasmissione con impossibilità di recapito) Received when SDI can't deliver your invoice to PA after 10 days. The marking property of the related invoice will be set at not-delivered.

  1. Legal Storage Receipt Simulation: Simulates the legal storage receipt event, dispatching a PreservedDocument payload to your pre-configured endpoint as a POST request.

These services serve distinct purposes, allowing controlled testing of specific functionalities within a simulated environment.



11. business registry configurations-{fiscal id} - {{baseUrl}}/business_registry_configurations/:fiscal_id

GET {{baseUrl}}/business_registry_configurations/:fiscal_id



12. business registry configurations-{fiscal id} - {{baseUrl}}/business_registry_configurations/:fiscal_id

DELETE {{baseUrl}}/business_registry_configurations/:fiscal_id



13. business registry configurations-{fiscal id} - {{baseUrl}}/business_registry_configurations/:fiscal_id/activate

PATCH {{baseUrl}}/business_registry_configurations/:fiscal_id/activate

This method allows you to re-activate a Business Registry Configuration that was previously deactivated, either automatically or manually by the user.



14. business registry configurations - {{baseUrl}}/business_registry_configurations

POST {{baseUrl}}/business_registry_configurations

The Business Registry Configuration is a tool used to set and manage company data for your own business. It functions as an entity representing a company managed by your account. Through this configuration, various settings can be customized, including:

  • apply_legal_storageEnable legal storage functionality
  • apply_signatureEnable digital signatures

IMPORTANT: To receive supplier invoices, it is necessary to configure the POST/api_configurations and set the value supplier-invoice as indicated in the documentation. Invoices will be sent to the specified callback and can then be accessed via the Get/invoices endpoint.



15. business registry configurations - {{baseUrl}}/business_registry_configurations

GET {{baseUrl}}/business_registry_configurations



16. api configurations - {{baseUrl}}/api_configurations

POST {{baseUrl}}/api_configurations

Create the configurations of your callback endpoints.

All the notifications received by SDI will be dispatched to your configured endpoints.
The `fiscal_id` is the unique identifier of the business that you want to configure.

You can create separate endpoints for each event: the event code can be one of `supplier-invoice`, `customer-invoice`, `invoice-status-quarantena`,`invoice-status-invoice-error`, `customer-notification`, `legal-storage-missing-vat`, `legal-storage-receipt` You will need to create a single API configuration with all the necessary endpoints. Every time you create an API configuration it overwrites the previous one.



17. api configurations - {{baseUrl}}/api_configurations

GET {{baseUrl}}/api_configurations?fiscal_id=<string>



18. api configurations - {{baseUrl}}/api_configurations/:id

DELETE {{baseUrl}}/api_configurations/:id



19. invoices - {{baseUrl}}/invoices

POST {{baseUrl}}/invoices

Invoices

This service facilitates the creation and submission of a new invoice through the government channel. To use this service effectively, it's crucial to explicitly specify the request body format by utilizing the content-type header. Once the invoice is submitted, it will be promptly queued for processing, and you will receive the invoice UUID as a callback for further reference.

All the notifications received by SDI will be dispatched to your configured endpoints for the event customer-notification.

You can test a customer-notification by making a POST request to the /simulate/{type} endpoint. Replace {type} with the desired notification type (e.g., customer-notification).

The is a code which identify the event:

  • NS (Notifica di scarto) Received when SDI reject your invoice because it contains errors. The marking property of the related invoice will be set at rejected.

  • MT (File metadati) Received along with the supplier invoice when delivered by SDI.

  • RC (Ricevuta consegna) Received when SDI delivers your invoice. The marking property of the related invoice will be set at delivered in case of B2B invoice or delivered-pa in case of B2G invoice.

  • MC (Mancata consegna) Received when SDI can not deliver the invoice to the recipient. The marking property of the related invoice will be set at not-delivered.

  • EC (Esito committente) Sent to the SDI when a PA decide to accept or reject an invoice (only for PA users).

  • SE (Scarto esito committente) Received when SDI doesn't accept an EC notification because it's not valid (only for PA users).

  • NE (Notifica esito) Received from SDI when a PA decided to accept or reject your invoice. The marking property of the related invoice will be set at accepted-pa in caso of outcome EC01 or rejected-pa in case of outcome EC02.

  • DT (Notifica decorrenza termini) Received when a PA doesn't reaply with acceptance or rejection within 15 days. The marking property of the related invoice will be set at deadline-terms.

  • AT (Attestazione trasmissione con impossibilità di recapito) Received when SDI can't deliver your invoice to PA after 10 days. The marking property of the related invoice will be set at not-delivered.

Self-invoices

Self-invoices require specific information:

When issuing a self-invoice, it's crucial to specify the document type ('tipo_documento'). The correct values vary depending on the situation and may include: TD16, TD17, TD18, TD19, TD20, TD21, TD22, TD23, TD26, TD27, and TD01 (the latter only if 'SoggettoEmittente' is equal to 'CC').

Generally, when generating a self-invoice, you can simplify the required information by setting 'SoggettoEmittente' to 'CC' in the case of TD01. This means that the information of the CessionarioCommittente will be automatically used, streamlining the process.

If you encounter challenges specifying 'SoggettoEmittente=CC', you can input the VAT number of the CessionarioCommittente in 'DatiTrasmissione.IdTrasmittente'. In this scenario as well, the information of the CessionarioCommittente will be taken into account during the self-invoicing process.

For further details or specific inquiries, we recommend consulting with an accountant for personalized assistance



20. invoices - {{baseUrl}}/invoices

GET {{baseUrl}}/invoices?createdAt[before]=<string>&createdAt[strictly_before]=<string>&createdAt[after]=<string>&createdAt[strictly_after]=<string>&signed=<boolean>&downloaded=<boolean>&toPa=<string>&type=<string>&sender=<string>&recipient=<string>&invoiceDate[before]=<string>&invoiceDate[strictly_before]=<string>&invoiceDate[after]=<string>&invoiceDate[strictly_after]=<string>&invoiceNumber=<string>&recipient.businessName=<string>&recipient.businessVatNumberCode=<string>&recipient.businessVatNumberCode[]=<string>&recipient.businessVatNumberCode[]=<string>&recipient.businessFiscalCode=<string>&recipient.businessFiscalCode[]=<string>&recipient.businessFiscalCode[]=<string>&sender.businessName=<string>&sender.businessVatNumberCode=<string>&sender.businessVatNumberCode[]=<string>&sender.businessVatNumberCode[]=<string>&sender.businessFiscalCode=<string>&sender.businessFiscalCode[]=<string>&sender.businessFiscalCode[]=<string>&marking=<string>&marking[]=<string>&marking[]=<string>&page=<integer>

This endpoint allows retrieving information about invoices. Various query parameters can be specified to filter the results based on user needs.

Query Parameters: - type (optional): The type of search to be performed. Allowed values: 0 or 1. If 0, invoices where the user is the sender are returned. If 1, invoices where the user is the recipient are returned. If not specified, the default value is 0. - sender (optional): Specifies the sender of the invoices. It can be a single sender or a list of senders separated by commas. - recipient (optional): Specifies the recipient of the invoices. It can be a single recipient or a list of recipients separated by commas.

Example: Retrieve all invoices for the user: GET /invoices?type=1 GET /invoices?type=1&recipient=987654321,123456789 GET /invoices?type=0&sender=123456789,987654321

Note: If type is not specified, the default value is 0, and all invoices for the user of type 0 are returned.



21. invoices - {{baseUrl}}/invoices/:uuid

GET {{baseUrl}}/invoices/:uuid

Get an invoice in application/json by default



ENDPOINTS