REST API FATTURA ELETTRONICA - EFFATTA
Descriptions
The following APIs expect a JSON containing a token its owner’s userId (“idMittente”). Both are automatically assigned on login. The output will be a JSON wrapped in a single key called “d”, as follows:
1 2 3 |
{ "d": "{<json>}" } |
Every API returns an errCode and an errMsg (brief error description) as output. Possible errCode values:
1 2 3 4 |
“0” Operation performed succesfully “-1” Server error -> http status code = 500 “-2” Application error -> http status code = 404 “-3” Expired token -> http status code = 401 |
Login
Login API, takes username and password as input and returns a token to be used in subsequent API calls.
- Input JSON:
1 2 3 4 5 6 7 8 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/login HTTP Method: POST { username: "usertest@test.com", password: "test123", source: "App_name" } |
- Output JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
{ "d": "{ \"token\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\", \"userId\": \"yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\", \"email\":\"usertest@test.com\", \"appTemplate\":\"ESERCENTE\", \"qrCode\": {\ "qrCodeAgEnt\":\"NO\", \"anag\": { \"naz\":\"IT\", \"cf\":\"XXXYYYNNANNHNNNE\", \"piva\":\"11111111111\", \"denom\":\"USER TEST\", \"domFisc\": { \"prov\":\"NA\", \"cap\":\"80121\", \"com\":\"NAPOLI\", \"ind\":\"via roma\", \"naz\":\"IT\" } }, }, \"SDI\": { \"cod\":\"0000000\", \"pec\":\usertest@pec.it\ } } }" } |
User Header Data
Retrieves data relative to a user, identified with the “dataUserId” key. Used in order to evaluate the sender or recipient of an invoice
- Input JSON:
1 2 3 4 5 6 7 8 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/getUserData HTTP Method: POST { token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", idMittente: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", dataUserId: "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" } |
- Output JSON:
1 2 3 4 5 6 7 8 9 |
{ "d": "[ { \"Denominazione\":\"MARIO ROSSI\", \"PartitaIVA\":\"12345678901\",
\"Indirizzo\":\"via col Vento, 36 - NAPOLI (NA) - 80133 \" } ]" } |
User Invoice List
Used to retrieve a list of invoice documents related to a specific user, identified by the “dataUserId” key. The type (“Tipo”) field indicates wheter the invoice has been issued/sent (“I”) or received (“R”).
-
Input JSON:
1 2 3 4 5 6 7 8 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/getUserDocuments HTTP Method: POST {
token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", idMittente: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", dataUserId: "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"
} |
-
Output JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
{"d":"[
{ \"Tipo\":\"I\",
\"IdFattura\":\"105\",
\"CurrentState\":\"10\",
\"StatoDocumento\":\"Invio in corso...\",
\"Denominazione\":\"Universita\\u0027 Degli Studi Suor Orsola Benincasa di Napoli\", \"fgen_TipoDocumento\":\"TD01\", \"fgen_DataDocumento\":\"2015-12-30\", \"fgen_Numero\":\"1\", \"fgen_ImportoTotaleDocumento\":\"1.07\", \"fgen_Causale\":\"\" },
{
\"Tipo\":\"I\",
\"IdFattura\":\"67\",
\"CurrentState\":\"10\", \"StatoDocumento\":\"Invio in corso...\", \"Denominazione\":\"A.Di.S.U. L\\u0027Orientale\", \"fgen_TipoDocumento\":\"TD01\", \"fgen_DataDocumento\":\"2015-09-30\", \"fgen_Numero\":\"1\", \"fgen_ImportoTotaleDocumento\":\"106.88\", \"fgen_Causale\":\"\"
},
{
\"Tipo\":\"R\"
, \"IdFattura\":\"30533\",
\"CurrentState\":\"0\", \"StatoDocumento\":\"Creazione\", \"Denominazione\":\"\", \"fgen_TipoDocumento\":\"TD01\", \"fgen_DataDocumento\":\"2018-07-11\", \"fgen_Numero\":\"223\", \"fgen_ImportoTotaleDocumento\":\"12.20\", \"fgen_Causale\":\"test fattura\" },
{
\"Tipo\":\"I\",
\"IdFattura\":\"340\",
\"CurrentState\":\"0\", \"StatoDocumento\":\"Creazione\", \"Denominazione\":\"\", \"fgen_TipoDocumento\":\"TD01\", \"fgen_DataDocumento\":\"2018-01-11\", \"fgen_Numero\":\"\", \"fgen_ImportoTotaleDocumento\":\"0.00\", \"fgen_Causale\":\"\"
},
{
\"Tipo\":\"R\",
\"IdFattura\":\"10489\", \"CurrentState\":\"10\", \"StatoDocumento\":\"Invio in corso...\", \"Denominazione\":\"\", \"fgen_TipoDocumento\":\"TD01\", \"fgen_DataDocumento\":\"2018-06-10\", \"fgen_Numero\":\"1\", \"fgen_ImportoTotaleDocumento\":\"394.34\", \"fgen_Causale\":\"completa\"
}, {
\"Tipo\":\"R\",
\"IdFattura\":\"10490\" ,\"CurrentState\":\"10\", \"StatoDocumento\":\"Invio in corso...\", \"Denominazione\":\"\", \"fgen_TipoDocumento\":\"TD01\", \"fgen_DataDocumento\":\"2018-06-10\", \"fgen_Numero\":\"1\", \"fgen_ImportoTotaleDocumento\":\"394.34\", \"fgen_Causale\":\"completa\"
} ]" } |
Create Invoice for Merchant / Professional
Used to issue a new invoice for a Merchant and/or a professional. Requires the user to set up an invoice as the web application’s model. The input field “idDestinatario” can either be:
- an email address, in case the invoice needs to be received by a private user;
a unique code representing the public administration in case of a PA;
Alternatively, you need to send a qrCode field containing the JSON read by the qrCode released by the Revenue Agency, or from the app itself if the user happens to be registered.
-
Input JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/creaDocumento HTTP Method: POST { token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", idMittente: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", idDestinatario: "mariorossi@esempio.it", isPrivato: "1", modalitaPagamento:"MP01", causale:"test fattura", prodList:
{ "list": [ { "numeroLinea": "1", "descrizione":"descrizione 1", "quantita":"1", "prezzoUnitario":"10.00", "prezzoTotale":"10.00", "aliquotaIVA":"22.00" } ] }, qrCode: { "anag":
{
"naz":"IT",
"cf":
"PRLGPP78A31H931E",
"piva":"05058331215",
"denom":"MULTIGESTIONE DI MARIO ROSSI", "domFisc": {
"prov":"RM",
"cap":"12345",
"com":"ROMA",
"ind":"VIA ROMA 3", "naz":"IT" }
}, "dtGenQr":"2018-07-05T1536:59.916+0200", "SDI":
{
"cod":"0000000", "pec":mario.rossi@pec.it
} } } |
-
Output JSON:
1 2 3 4 5 6 7 8 |
{ "d":
"{ \"errCode\":\"0\", \"errMsg\":\"\", \"idFattura\":\"xxxxx\" }" } |
Calculate Document’s Total Amount
Used to calculate the total amount from a document to show. Takes a list of products as input.
The API takes into account the user’s tax profile as well as any social security funds and / or withholding taxes set in the user’s registry.
- Input JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/calcolaTotaleDocumento HTTP Method: POST { token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", idMittente: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", idDestinatario: "mario.rossi@esempio.com", "isPrivato": "1", "prodList":{ "list": [
{ "quantita":"1", "prezzoUnitario":"1000.00" } ] } } |
-
Output JSON:
1 2 3 4 5 6 7 8 9 10 |
{ "d":
"{ \"TotaleDocumento\":\"819.67\", \"CPA\":\"0.00\", \"Imponibile\":\"819.67\", \"IVA\":\"180.33\", \"RA\":\"0.00\", \"NettoAPagare\":\"1000.00\" }" } |
Get Document Receipts
Used to retrieve a receipts list from a document. Returns a JSON with the desired list as output.
-
Input JSON:
1 2 3 4 5 6 7 8 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/getEsitoDocument HTTP Method: POST {
token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
idMittente: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
idFattura: "522"
} |
-
Output JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
{
"d": " \"Stato_Documento\":\"OK\",
\“Lista_Esiti\”: [ {
\"Titolo\":\"INVIO SDI\",
\"Stato_Documento\":\"OK\",
\"Identificativo_SdI\":\"1614054\",
\"Nome_File\":\"IT05058331215_000EI.xml.p7m\",
\"Errore_SDI\":\"Nessuno\",
\"Descrizione_Esito_SdI\":\"522 - Invio al Sistema di Intescambio avvenuto con successo\", \"Data_Ora_Ricezione_SdI\":\"28/08/2018 15:18:27\"
},
{
\"Titolo\":\"NOTIFICA MANCATA CONSEGNA\", \"Identificativo_SdI\":\"1614054\", \"Nome_File\": \"IT05058331215_000EI.xml.p7m\", \"Message_Id\":\"5371527\", \"Data_Ora_Ricezione\": \"28/08/2018 Ore 15:18:27\", \"Data_Ora_Consegna\":\"\",
\"Note\":\"\", \"Descrizione\":\"\" }
]"
} |
Create Credit Note
Used to issue a new Credit Note for a Merchant and/or a Professional. Requires the user to set up an invoice as the web application’s model. The input field “idDestinatario” can either be:
- an email address, in case the invoice needs to be received by a private user;
a unique code representing the public administration in case of a PA;
Alternatively, you need to transfer a qrCode field containing the JSON read by the qrCode released by the Revenue Agency, or from the app itself if the user happens to be registered.
- Input JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/creaNotaCredito HTTP Method: POST { token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", idMittente: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", idDestinatario: "mario.rossi@esempio.com", isPrivato: "1", modalitaPagamento:"MP01", causale:"test fattura", prodList:
{ "list": [ { "numeroLinea": "1", "descrizione":"descrizione 1", "quantita":"1", "prezzoUnitario":"10.00", "prezzoTotale":"10.00", "aliquotaIVA":"22.00" } ] }, qrCode: { "anag":
{
"naz":"IT",
"cf":
"MARRSS78A31H931E",
"piva":"0123456789",
"denom":"MULTIGESTIONE DI MARIO ROSSI", "domFisc": {
"prov":"RM",
"cap":"12345",
"com":"ROMA",
"ind":"VIA ROMA 3", "naz":"IT"
}
}, "dtGenQr":"2018-07-05T1536:59.916+0200", "SDI":
{
"cod":"0000000", "pec":mario.rossi@pec.it
} } } |
-
Output JSON:
1 2 3 4 5 6 7 8 |
{ "d":
"{ \"errCode\":\"0\", \"errMsg\":\"\", \"idNotaCredito\":\"xxxxx\" }" } |
Create Total Credit Note
Used to issue a new Credit Note relative to an entire existing invoice.
- Input JSON:
1 2 3 4 5 6 7 8 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/creaNotaCreditoTotale HTTP Method: POST { token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", idMittente: "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy", idFattura:"y” <- id fattura per cui creare la nota di credito } |
-
Output JSON:
1 2 3 4 5 6 7 8 |
{ "d":
"{ \"errCode\":\"0\", \"errMsg\":\"\", \"idNotaCredito\":\"xxxxx\" }" } |
Create full document
Used to issue a new invoice, along with rounding and payment type specifications.
- Input JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/creaDocumentoFullRound
HTTP Method: POST {"token":"xxxxxxxx", "idMittente":"yyyyyyyyyyy", "arrotondamento": "0.00", idDestinatario: '',isPrivato: '1', causale:'round rit 1', numeroDocumento:'661 / 18', dataDocumento:'20/01/2019', importoBollo:'0.00',
datiPagamento:{'list':[ {condizioniPagamento:'TP02', modalitaPagamento:'MP01', dataRiferimentoTe
rminiPagamento:'', giorniTerminiPagamento:'0', dataScadenzaPagamento:'', importoPagamento:'0.0 0', codUfficioPostale:'', cognomeQuietanzante:'', nomeQuietanzante:'', CFQuietanzante:'', titoloQuieta nzante:'', istitutoFinanziario:'', IBAN:'', ABI:'', CAB:'', BIC:'', scontoPagamentoAnticipato:'', dataLimitePag amentoAnticipato:'', penalitaPagamentiRitardati:'', dataDecorrenzaPenale:'', codicePagamento:'', Onl yCode:'1'} ] },
attachmentName:'', attachmentContent:’’, prodList:{'list': [ {numeroLinea: '1',descrizione:'1',quantita:'1.00', prezzoUnitario:'31.75', prezzoTotale:'31.75', aliquotaIVA:'22.00'}, {numeroLinea: '2',quantita:'1.00', prezzoUnitario:'10.20',' prezzoTotale':'10.20', aliquotaIVA:'0.00', Natura:'N1', RiferimentoNormativa:''} ] },
qrCode: {
'anag': {
naz:'IT',cf: '',
piva: '00000000000',
denom: 'xxxxxxxx',
domFisc:{ prov: 'PA', cap: '90135', com: 'PALERMO', ind: 'VIA xxx‘, naz:'IT'}}, dtGenQr:'', SDI:{cod: 'UF5D7W',pec:''}}
} |
- Output JSON:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
{ "d": "{
\"errCode\":\"0\",
\"errMsg\":\"\",
\"idDocumento\":\"6190\",
\"fileContent\":\"\",
\"fileName\":\"IT12345678901_004RY.xml\",
\"numeroDocumento\":\"661 / 18\",
\"docInfo\":{\"idDocumento\":\"6190\",
\"Tipo\":\"I\",\"CurrentState\":\"10\",
\"StatoDocumento\":\"Invio in corso...\",
\"Denominazione\":\"xxxxxxxx\", \"fgen_TipoDocumento\":\"TD01\",
\"fgen_DataDocumento\":\"2019-01-20\",
\"fgen_Numero\":\"661 / 18\",
\"fgen_ImportoTotaleDocumento\":\"130.00\",
\"fgen_Causale\":\"round rit 1\"}}" } |
Send XML
Used to issue a new invoice from XML.
- Input JSON:
1 2 3 4 5 6 7 8 9 10 |
End point: https://fattura.effatta.it/webservice/RestAPI.asmx/sendXML
HTTP Method: POST {
token: "xxxxxxxxxxx",
idMittente: "yyyyyyyyyyyyyyyy", "dataUserId":"zzzzzzzzzzzzzzzzzzzz", "nomeFile":"IT12345678901_2zzz.xml", "base64File":"<BASE 64 FILE>"
} |
- Output JSON:
1 2 3 4 5 |
{
“errCode” = “0”,
“errMsg” = "",
idDocumento = “12345”
} |