Aller au contenu
Log in

Send invoice via SDI

Ce contenu n’est pas encore disponible dans votre langue.

Quick recipe to issue an invoice to the SDI (Sistema di Interscambio) with the B2Brouter API: account → contact → invoice → status.

Terminal window
curl --request POST \
--url https://api-staging.b2brouter.net/accounts \
--header 'X-B2B-API-Key: {YOUR_API_KEY}' \
--header 'X-B2B-API-Version: {YOUR_API_VERSION}' \
--header 'content-type: application/json' \
--data '{
"account": {
"country": "it",
"tin_value": "20339260422",
"tin_scheme": 211,
"name": "Test Sender Italy",
"address": "Milano street, 1",
"city": "Milano",
"postalcode": "20019",
"province": "MI",
"tax_regime": "RF01"
}
}'

transport_type_code: it.sdi, document_type_code: xml.fatturapa.1.2, the Partita IVA with tin_scheme: 9906 (or the Codice Fiscale with cin_scheme: 9907), and the Codice Destinatario in recipient_code (if there is none, 0000000).

Terminal window
curl --request POST \
--url https://api-staging.b2brouter.net/accounts/{ACCOUNT_ID}/contacts \
--header 'X-B2B-API-Key: {YOUR_API_KEY}' \
--header 'X-B2B-API-Version: {YOUR_API_VERSION}' \
--header 'content-type: application/json' \
--data '{
"contact": {
"tin_scheme": "9906",
"tin_value": "IT12345678901",
"name": "Esempio S.r.l.",
"address": "Via Inventata 88",
"postalcode": "00184",
"city": "Roma",
"province": "RM",
"country": "it",
"transport_type_code": "it.sdi",
"document_type_code": "xml.fatturapa.1.2",
"recipient_code": "{CODICE_DESTINATARIO}"
}
}'

With send_after_import: true the invoice is sent to the SDI directly.

Terminal window
curl --request POST \
--url https://api-staging.b2brouter.net/accounts/{ACCOUNT_ID}/invoices \
--header 'X-B2B-API-Key: {YOUR_API_KEY}' \
--header 'X-B2B-API-Version: {YOUR_API_VERSION}' \
--header 'content-type: application/json' \
--data '{
"send_after_import": true,
"invoice": {
"type": "IssuedInvoice",
"number": "1",
"date": "2025-01-22",
"contact_id": {YOUR_CONTACT_ID},
"invoice_lines_attributes": [
{
"quantity": 10,
"price": 47,
"description": "Test Item",
"taxes_attributes": [{ "name": "IVA", "percent": 22 }]
}
]
}
}'
Terminal window
curl --request GET \
--url 'https://api-staging.b2brouter.net/invoices/{INVOICE_ID}' \
--header 'X-B2B-API-Key: {YOUR_API_KEY}' \
--header 'X-B2B-API-Version: {YOUR_API_VERSION}' \
--header 'accept: application/json'

The invoice goes through sendingsent; if the SDI rejects it, it moves to error. See Checking the invoice status for the details and the acknowledge step.

Dernière mise à jour :