API V2

API Version 2 - Integrators Manual

Send

Send electronic document to recipient.

Send action will upload a document to moj-eracun.rs server, validate it, digitally sign it, timestamp the document, register it on SEF and then send an email notification to the customer.

POST /apis/v2/send
Header: "content-type:application/json; charset:utf-8"
* For json requests

Send Parameters

Send Example Request

Send Example response

Send Example response Xml

        
        <?xml version="1.0" encoding="utf-8" standalone="no" ?>
        <SendDocumentResponse>
        <ElectronicId>394162</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>110712050</SenderBusinessNumber>
        <SenderBusinessUnit>
                </SenderBusinessUnit>
        <SenderBusinessName>Docloop doo</SenderBusinessName>
        <Sent>2016-04-18T08:13:03.177</Sent>
        <Delivered />
            </SendDocumentResponse>
    

Example error responses

This error indicates that either Username and/or Password are not correct:

This error indicates that a user doesn't have sufficient privileges to send eInvoice:

This error indicates that there is an error with SoftwareId parameter:

All of these errors should be parsed in order for user to be able to read the error description.

Query

Query document status

Status description

10 In preparation - Document is successfully uploaded, but pending validation and sending.
20 In validation - Document is successfully uploaded, pending recipient company data validation.
30 Sent - Document is successfully uploaded, digitally signed and time stamped. Notification email is sent to customer.
40 Delivered - Customer accepted and downloaded digital invoice.
45 Canceled - Sender canceled digital invoicing process, as customer didn't accept invoice. Customer can no longer download document.
50 Unsuccessful - The document was not successfully registered in the SEF.

Query Inbox

Query inbox is used to discover new documents addressed to your company or business unit.

POST /apis/v2/queryInbox
Header: "content-type:application/json; charset:utf-8"
* For json requests

Query Inbox Parameters

Query Inbox Example

Query inbox is used to monitor received documents statuses.

POST /apis/v2/queryInbox
Header: "content-type:application/json; charset:utf-8"

Query Inbox Example Response Xml


<?xml version="1.0" encoding="utf-8" standalone="no" ?>
        <InboxDocumentHeaders>
        <InboxDocumentHeader>
        <ElectronicId>394162</ElectronicId>
        <SalesInvoiceId>99144</SalesInvoiceId>
        <PurchaseInvoiceId>83824</PurchaseInvoiceId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>110712050</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Docloop doo</SenderBusinessName>
        <Sent>2016-04-18T08:13:03.177</Sent>
        <Delivered />
        </InboxDocumentHeader>
        <InboxDocumentHeader>
        <ElectronicId>394163</ElectronicId>
        <SalesInvoiceId>99145</SalesInvoiceId>
        <PurchaseInvoiceId>83825</PurchaseInvoiceId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>110712050</SenderBusinessNumber>
        <SenderBusinessUnit>
            </SenderBusinessUnit>
        <SenderBusinessName>Docloop doo</SenderBusinessName>
        <Sent>2016-04-18T08:17:22.937</Sent>
        <Delivered />
        </InboxDocumentHeader>
        <InboxDocumentHeader>
        <ElectronicId>394166</ElectronicId>
        <SalesInvoiceId>99146</SalesInvoiceId>
        <PurchaseInvoiceId>83826</PurchaseInvoiceId>
        <DocumentNr>20156256</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>110712050</SenderBusinessNumber>
        <SenderBusinessUnit>
            </SenderBusinessUnit>
        <SenderBusinessName>Docloop doo</SenderBusinessName>
        <Sent>2016-04-18T08:18:47.33</Sent>
        <Delivered />
        </InboxDocumentHeader>
</InboxDocumentHeaders>

Query Inbox Example Json

POST /apis/v2/queryInbox
Header: "content-type:application/json; charset:utf-8"

Example error responses

This error indicates that StatusId parameter is not correct:

Query Outbox

Query outbox is used to discover new statuses of sent documents. For this method, the API returns 10.000 results.

POST /apis/v2/queryOutbox
Header: "content-type:application/json; charset:utf-8"

Query Outbox Parameters

Query Outbox Example

POST /apis/v2/queryOutbox
Header: "content-type:application/json; charset:utf-8"

Query Outbox Example Response XML


<?xml version="1.0" encoding="utf-8" ?>
<OutboxDocumentHeaders>
        <OutboxDocumentHeader>
        <ElectronicId>394162</ElectronicId>
        <SalesInvoiceId>99144</SalesInvoiceId>
        <PurchaseInvoiceId>83824</PurchaseInvoiceId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>110712050</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Docloop doo</RecipientBusinessName>
        <Created>2016-04-18T08:13:01.693</Created>
        <Updated>2016-04-18T08:13:05.007</Updated>
        <Sent>2016-04-18T08:13:03.177</Sent>
        <Delivered />
    </OutboxDocumentHeader>
        <OutboxDocumentHeader>
        <ElectronicId>394163</ElectronicId>
        <SalesInvoiceId>99145</SalesInvoiceId>
        <PurchaseInvoiceId>83825</PurchaseInvoiceId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>110712050</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Docloop doo</RecipientBusinessName>
        <Created>2016-04-18T08:17:20.657</Created>
        <Updated>2016-04-18T08:17:24.89</Updated>
        <Sent>2016-04-18T08:17:22.937</Sent>
        <Delivered />
        </OutboxDocumentHeader>
        <OutboxDocumentHeader>
        <ElectronicId>394166</ElectronicId>
        <SalesInvoiceId>99146</SalesInvoiceId>
        <PurchaseInvoiceId>83826</PurchaseInvoiceId>
        <DocumentNr>20156256</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>110712050</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Docloop doo</RecipientBusinessName>
        <Created>2016-04-18T08:18:45.94</Created>
        <Updated>2016-04-18T08:18:47.357</Updated>
        <Sent>2016-04-18T08:18:47.33</Sent>
        <Delivered />
        </OutboxDocumentHeader>
</OutboxDocumentHeaders>

Query Outbox Example Json

POST /apis/v2/queryOutbox
Header: "content-type:application/json; charset:utf-8"

Example error responses

This error indicates that StatusId parameter is not correct:

Receive

Receive method is used for downloading documents. Both sent and incoming, eg. Inbox and Outbox documents.

POST /apis/v2/receive
Header: "content-type:application/json; charset:utf-8"

Receive parameters

Receive Document Example

Following examples show how to POST a receive request using all possible values for CompanyBu parameter.

POST /apis/v2/receive
Header: "content-type:application/json; charset:utf-8"

Example with no Business Unit:

Example with the name of the Business Unit:

Receive Document Response Document

Receive Document Response contains XML document containing electronic Invoice.

            
<?xml version="1.0" encoding="utf-8" ?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
         xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
            <ext:UBLExtensions xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
            <ext:UBLExtension>
            <ext:ExtensionContent>
            <sig:UBLDocumentSignatures xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2">
            <sac:SignatureInformation xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2">
            <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="Signature-394791601">
   .......                        
    </cac:InvoiceLine>

</ds:Signature></sac:SignatureInformation></sig:UBLDocumentSignatures></ext:ExtensionContent></ext:UBLExtension></ext:UBLExtensions></Invoice>
            
            

Example error responses

This error indicates that ElectronicId parameter is not found:

This error indicates that the document is archived and is no longer accessible via API, i.e. it can not be received via API:

Document process

Document process status

Status description

0 - APPROVED
1 - REJECTED
2 - PAYMENT_FULFILLED
3 - PAYMENT_PARTIALLY_FULLFILLED
4 - RECEIVING_CONFIRMED
5 - CANCELLED
6 - NEW
7 - DRAFT
8 - SENT
9 - MISTAKE
10 - OVERDUE
11 - ARCHIVED
12 - SENDING
13 - DELETED
14 - STORNO
15 - UNKNOWN
16 - SEEN
17 - REMINDED
18 - RENOTIFED
99 - RECEIVED
*Statuses do not yet have a description because it is not available by the authorities that define it.

Document process status is used to update the status of the recepients process of some incoming invoice.

POST /apis/v2/UpdateDokumentProcessStatus
Header: "content-type:application/json; charset:utf-8" //for json requests

Document Process Status Parameters

Document Process Status Example

POST /apis/v2/UpdateDokumentProcessStatus
Header: "content-type:application/json; charset:utf-8"

Response Example (JSON)

POST /apis/v2/UpdateDokumentProcessStatus
Header: "content-type:application/json; charset:utf-8"

Query Document Process

Query document process status

Query Document Process Status - Inbox

Query inbox is used to discover new documents addressed to your company or business unit. The response to this method contains basic data and additional information about the process status of the received documents.

POST /apis/v2/queryDocumentProcessStatusInbox
Header: "content-type:application/json; charset:utf-8" //for json requests

Parameters

Example

POST /apis/v2/queryDocumentProcessStatusInbox
Header: "content-type:application/json; charset:utf-8"

Response Example (XML)


<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<InboxDocumentHeaders>
        <InboxDocumentHeader>
        <ElectronicId>394162</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <SenderBusinessNumber>110712050</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Docloop doo</SenderBusinessName>
        <Sent>2018-04-18T08:13:03.177</Sent>
        <Delivered />
        <DocumentProcessStatusId>null</DocumentProcessStatusId>
        <DocumentProcessStatusName>DocumentProcessStatusName</DocumentProcessStatusName>
        <AdditionalDokumentStatusId></AdditionalDokumentStatusId>
        <RejectReason></RejectReason>
        <StornoComment></StornoComment>
    </InboxDocumentHeader>
        <InboxDocumentHeader>
        <ElectronicId>394163</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <SenderBusinessNumber>110712050</SenderBusinessNumber>
        <SenderBusinessUnit>
            </SenderBusinessUnit>
        <SenderBusinessName>Docloop doo</SenderBusinessName>
        <Sent>2018-04-18T08:17:22.937</Sent>
        <Delivered>2018-04-19T18:03:27.457</Delivered>
        <DocumentProcessStatusId>0</DocumentProcessStatusId>
        <DocumentProcessStatusName>APPROVED</DocumentProcessStatusName>
        <AdditionalDokumentStatusId>15</AdditionalDokumentStatusId>
        <RejectReason></RejectReason>
        <StornoComment></StornoComment>
        </InboxDocumentHeader>
        <InboxDocumentHeader>
        <ElectronicId>394166</ElectronicId>
        <DocumentNr>20156256</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <SenderBusinessNumber>110712050</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Docloop doo</SenderBusinessName>
        <Sent>2018-04-18T08:18:47.33</Sent>
        <Delivered>2018-04-18T09:38:33.47</Delivered>
        <DocumentProcessStatusId>2</DocumentProcessStatusId>
        <DocumentProcessStatusName>PAYMENT_FULFILLED</DocumentProcessStatusName>
        <AdditionalDokumentStatusId></AdditionalDokumentStatusId>
        <RejectReason></RejectReason>
        <StornoComment></StornoComment>
    </InboxDocumentHeader>
</InboxDocumentHeaders>

Response Example (JSON)

POST /apis/v2/queryDocumentProcessStatusInbox
Header: "content-type:application/json; charset:utf-8"

Example error responses

This error indicates that StatusId parameter is not correct:

Query Document Process Status - Outbox

Query outbox is used to discover new statuses of sent documents. For this method, the API returns 20.000 results.

POST /apis/v2/queryDocumentProcessStatusOutbox
Header: "content-type:application/json; charset:utf-8"

Parameters

Example

POST /apis/v2/queryDocumentProcessStatusOutbox
Header: "content-type:application/json; charset:utf-8"

Response Example (XML)


<?xml version="1.0" encoding="utf-8" ?>
<OutboxDocumentHeaders>
        <OutboxDocumentHeader>
        <ElectronicId>394162</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <ReceiverBusinessNumber>110712050</ReceiverBusinessNumber>
        <ReceiverBusinessUnit></ReceiverBusinessUnit>
        <ReceiverBusinessName>Docloop doo</ReceiverBusinessName>
        <Created>2016-04-18T08:13:01.693</Created>
        <Updated>2016-04-18T08:13:05.007</Updated>
        <Sent>2016-04-18T08:13:03.177</Sent>
        <Delivered />
        <DocumentProcessStatusId>null</DocumentProcessStatusId>
        <DocumentProcessStatusName>DocumentProcessStatusName</DocumentProcessStatusName>
        <AdditionalDokumentStatusId></AdditionalDokumentStatusId>
        <AdditionalDokumentStatusName></AdditionalDokumentStatusName>
        <RejectReason></RejectReason>
        <StornoComment></StornoComment>
    </OutboxDocumentHeader>
        <OutboxDocumentHeader>
        <ElectronicId>394163</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <ReceiverBusinessNumber>110712050</ReceiverBusinessNumber>
        <ReceiverBusinessUnit></ReceiverBusinessUnit>
        <ReceiverBusinessName>Docloop doo</ReceiverBusinessName>
        <Created>2016-04-18T08:17:20.657</Created>
        <Updated>2016-04-18T08:17:24.89</Updated>
        <Sent>2016-04-18T08:17:22.937</Sent>
        <Delivered>2018-04-19T18:03:27.457</Delivered>
        <DocumentProcessStatusId>0</DocumentProcessStatusId>
        <DocumentProcessStatusName>APPROVED</DocumentProcessStatusName>
        <AdditionalDokumentStatusId>15</AdditionalDokumentStatusId>
        <AdditionalDokumentStatusName>Dokument uspešno dostavljen na SEF</AdditionalDokumentStatusName>
        <RejectReason></RejectReason>
        <StornoComment></StornoComment>
    </OutboxDocumentHeader>
        <OutboxDocumentHeader>
        <ElectronicId>394166</ElectronicId>
        <DocumentNr>20156256</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <ReceiverBusinessNumber>110712050</ReceiverBusinessNumber>
        <ReceiverBusinessUnit></ReceiverBusinessUnit>
        <ReceiverBusinessName>Docloop doo</ReceiverBusinessName>
        <Created>2016-04-18T08:18:45.94</Created>
        <Updated>2016-04-18T08:18:47.357</Updated>
        <Sent>2016-04-18T08:18:47.33</Sent>
        <Delivered>2018-04-18T09:38:33.47</Delivered>
        <DocumentProcessStatusId>2</DocumentProcessStatusId>
        <DocumentProcessStatusName>PAYMENT_FULFILLED</DocumentProcessStatusName>
        <AdditionalDokumentStatusId></AdditionalDokumentStatusId>
        <AdditionalDokumentStatusName></AdditionalDokumentStatusName>
        <RejectReason></RejectReason>
        <StornoComment></StornoComment>
    </OutboxDocumentHeader>
</OutboxDocumentHeaders>

Response Example (JSON)

POST /apis/v2/queryDocumentProcessStatusOutbox
Header: "content-type:application/json; charset:utf-8"

Example error responses

This error indicates that StatusId parameter is not correct:

NotifyImport

Notify import method is used for sending an information that an invoice is imported into an ERP solution, to the Moj-eRačun service.

NotifyImport

POST /apis/v2/notifyimport/ElectronicID
Header: contentType="application/json; charset=utf-8"

NotifyImport Parameters

NotifyImport Example

POST /apis/v2/notifyimport/189919
Header: contentType="application/json; charset=utf-8"

Document Action

Apply resend, cancel, storno or delete action to document.

Resend action will send email notification to customer.
Cancel action cancels digital invoicing process, as customer didn't accept invoice. Customer can no longer download document.
Storno action will storno sent document. Storno action is able only when Sales document is in status Approved.
Delete action will delete sent document. Delete action will be possible only when Sales document is in status Draft or New.

POST /apis/v2/documentAction
Header: "content-type:application/json; charset:utf-8"

Document Action Parameters

Document Action Example

POST /apis/v2/documentAction
Header: "content-type:application/json; charset:utf-8"

Example error responses

This error indicates that Action can not be applied to this document:

Document Action Example

Example error responses

This error indicates that Action can not be applied to this document:

Individual Vat

Send individual VAT record

SendIndividualVat method used to send individual VAT records, to the Moj-eRačun service.

POST /apis/v2/SendIndividualVat
Header: contentType="application/json; charset=utf-8"

SendIndividualVat Parameters

SendIndividualVat Example

POST /apis/v2/SendIndividualVat
Header: contentType="application/json; charset=utf-8"

SendIndividualVat Response Example

SendIndividualVat Error Response Example

Cancel group VAT record

CancelIndividualVat method used to cancel all version of individual VAT records, to the Moj-eRačun service.

POST /apis/v2/CancelIndividualVat
Header: contentType="application/json; charset=utf-8"

CancelIndividualVat Parameters

CancelIndividualVat Example

POST /apis/v2/CancelIndividualVat
Header: contentType="application/json; charset=utf-8"

CancelIndividualVat Response Example

CancelIndividualVat Error Responses Example

Change individual VAT record

ChangeIndividualVat method used to change individual VAT records, to the Moj-eRačun service.

POST /apis/v2/ChangeIndividualVat
Header: contentType="application/json; charset=utf-8"

ChangeIndividualVat Parameters

ChangeIndividualVat Example

POST /apis/v2/ChangeIndividualVat
Header: contentType="application/json; charset=utf-8"

ChangeIndividualVat Response Example

ChangeIndividualVat Error Response Example

Group VAT

Send group VAT record

SendGroupVat method used to send group VAT records, to the Moj-eRačun service.

POST /apis/v2/SendGroupVat
Header: contentType="application/json; charset=utf-8"

SendGroupVat Parameters

SendGroupVat Example

POST /apis/v2/SendGroupVat
Header: contentType="application/json; charset=utf-8"

SendGroupVat Response Example

SendGroupVat Error Responses Example

Cancel group VAT record

CancelGroupVat method used to cancel all version of group VAT records, to the Moj-eRačun service.

POST /apis/v2/CancelGroupVat
Header: contentType="application/json; charset=utf-8"

CancelGroupVat Parameters

CancelGroupVat Example

POST /apis/v2/CancelGroupVat
Header: contentType="application/json; charset=utf-8"

CancelGroupVat Response Example

CancelGroupVat Error Responses Example

Change group VAT record

ChangeGroupVat method used to change group VAT records, to the Moj-eRačun service.

POST /apis/v2/ChangeGroupVat
Header: contentType="application/json; charset=utf-8"

ChangeGroupVat Parameters

ChangeGroupVat Example

POST /apis/v2/ChangeGroupVat
Header: contentType="application/json; charset=utf-8"

ChangeGroupVat Response Example

ChangeGroupVat Error Responses Example