API V2

API Version 2 - Integrators Manual

Ping

Checks if service is up.

Ping Example

Ping Response

Send

Send Electronic Document to recipient.

Send action will upload document to moj-eracun.hr server, validate, digitally sign and timestamp document and then send notification emails to customers.

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

Send Parameters

Send Example Request

Send Example Request with IsHighImportantReceive

Send Example response

If document is valid, it gets saved, signed and email notification is sent to customer. API returns ElectronicId

Example error responses

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

This error indicates that Company which is sending the eInvoice is not registered on Moj-eRačun service:

This error indicates that a user doesn't have privileges in Company for which it wants to send eInvoice:

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 – Customer did not download invoice in 5 days – from this point usual flow is to resend document

Query Inbox

Query inbox is used to discover new documents addressed to your company or business unit. For this method, the API returns 10.000 results.

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

Query Inbox Parameters

Query Inbox Example

Query outbox is used to monitor sent documents statuses.

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

Query Inbox 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>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>99999999927</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Test Klising d.o.o.</SenderBusinessName>
        <Sent>2016-04-18T08:13:03.177</Sent>
        <Delivered />
    </InboxDocumentHeader>
    <InboxDocumentHeader>
        <ElectronicId>394163</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>99999999927</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Test Klising d.o.o.</SenderBusinessName>
        <Sent>2016-04-18T08:17:22.937</Sent>
        <Delivered />
    </InboxDocumentHeader>
    <InboxDocumentHeader>
        <ElectronicId>394166</ElectronicId>
        <DocumentNr>20156256</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>99999999927</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Test Klising d.o.o.</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 version="1.0" encoding="utf-8" ?>
<InboxDocumentHeaders>
    <InboxDocumentHeader>
        <ElectronicId>394162</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>99999999927</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Test Klising d.o.o.</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 />
    </InboxDocumentHeader>
    <InboxDocumentHeader>
        <ElectronicId>394163</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>99999999927</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Test Klising d.o.o.</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 />
    </InboxDocumentHeader>
    <InboxDocumentHeader>
        <ElectronicId>394166</ElectronicId>
        <DocumentNr>20156256</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>99999999927</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Test Klising d.o.o.</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 />
    </InboxDocumentHeader>
</InboxDocumentHeaders>

Example error responses

This error indicates that StatusId parameter is not correct:

General error responses

This error indicates that Get HTTP verb was used instead of POST:

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 GLN Code:

Example with Moj-eRačun Subject ID:

Example with the name of the Business Unit:

Receive Document Response Document

Receive Document Respnse contains XML document containing electronic Invoice.

            
<?xml version="1.0" encoding="utf-8" ?>
<OutgoingInvoicesData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://fina.hr/eracun/erp/OutgoingInvoicesData/v3.2">
...
    </AttachedDocumentEnvelope>
  </OutgoingInvoice>
</OutgoingInvoicesData>
            
            

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 - Document is successfully approved by the recepient
1 - REJECTED - Document is rejected by the recepient
2 - PAYMENT_FULFILLED - Document is fully paid
3 - PAYMENT_PARTIALLY_FULLFILLED – Document is partially paid
4 - RECEIVING_CONFIRMED – Document successfully downloaded by the recepient
99 - RECEIVED – Document received in the inbox of the recepient (e.g. FINA service)

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. For this method, the API returns 20.000 results.

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>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>99999999927</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Test Klising d.o.o.</SenderBusinessName>
        <Sent>2018-04-18T08:13:03.177</Sent>
        <Delivered />
        <IssueDate>2016-04-17T08:13:08.148</IssueDate>
        <DocumentProcessStatusId>null</DocumentProcessStatusId>
        <DocumentProcessStatusName>DocumentProcessStatusName</DocumentProcessStatusName>
        <AdditionalDokumentStatusId></AdditionalDokumentStatusId>
        <RejectReason></RejectReason>
    </InboxDocumentHeader>
        <InboxDocumentHeader>
        <ElectronicId>394163</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>99999999927</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Test Klising d.o.o.</SenderBusinessName>
        <Sent>2018-04-18T08:17:22.937</Sent>
        <Delivered>2018-04-19T18:03:27.457</Delivered>
        <IssueDate>2016-04-17T08:13:08.148</IssueDate>
        <DocumentProcessStatusId>0</DocumentProcessStatusId>
        <DocumentProcessStatusName>APPROVED</DocumentProcessStatusName>
        <AdditionalDokumentStatusId>15</AdditionalDokumentStatusId>
        <RejectReason></RejectReason>
    </InboxDocumentHeader>
        <InboxDocumentHeader>
        <ElectronicId>394166</ElectronicId>
        <DocumentNr>20156256</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <SenderBusinessNumber>99999999927</SenderBusinessNumber>
        <SenderBusinessUnit>
        </SenderBusinessUnit>
        <SenderBusinessName>Test Klising d.o.o.</SenderBusinessName>
        <Sent>2018-04-18T08:18:47.33</Sent>
        <Delivered>2018-04-18T09:38:33.47</Delivered>
        <IssueDate>2016-04-17T08:13:08.148</IssueDate>
        <DocumentProcessStatusId>2</DocumentProcessStatusId>
        <DocumentProcessStatusName>PAYMENT_FULFILLED</DocumentProcessStatusName>
        <AdditionalDokumentStatusId></AdditionalDokumentStatusId>
        <RejectReason></RejectReason>
    </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>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>99999999927</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Test Klising d.o.o.</RecipientBusinessName>
        <Created>2016-04-18T08:13:01.693</Created>
        <Updated>2016-04-18T08:13:05.007</Updated>
        <IssueDate>2016-04-17T08:13:08.148</IssueDate>
        <Sent>2016-04-18T08:13:03.177</Sent>
        <Delivered />
        <DocumentProcessStatusId>null</DocumentProcessStatusId>
        <DocumentProcessStatusName>DocumentProcessStatusName</DocumentProcessStatusName>
        <AdditionalDokumentStatusId></AdditionalDokumentStatusId>
        <RejectReason></RejectReason>
    </OutboxDocumentHeader>
    <OutboxDocumentHeader>
        <ElectronicId>394163</ElectronicId>
        <DocumentNr>3-1-1</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>99999999927</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Test Klising d.o.o.</RecipientBusinessName>
        <Created>2016-04-18T08:17:20.657</Created>
        <Updated>2016-04-18T08:17:24.89</Updated>
        <IssueDate>2016-04-17T08:13:08.148</IssueDate>
        <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>
        <RejectReason></RejectReason>
    </OutboxDocumentHeader>
        <OutboxDocumentHeader>
        <ElectronicId>394166</ElectronicId>
        <DocumentNr>20156256</DocumentNr>
        <DocumentTypeId>1</DocumentTypeId>
        <DocumentTypeName>Invoice</DocumentTypeName>
        <StatusId>30</StatusId>
        <StatusName>Sent</StatusName>
        <RecipientBusinessNumber>99999999927</RecipientBusinessNumber>
        <RecipientBusinessUnit></RecipientBusinessUnit>
        <RecipientBusinessName>Test Klising d.o.o.</RecipientBusinessName>
        <Created>2016-04-18T08:18:45.94</Created>
        <Updated>2016-04-18T08:18:47.357</Updated>
        <IssueDate>2016-04-17T08:13:08.148</IssueDate>
        <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>
        <RejectReason></RejectReason>
    </OutboxDocumentHeader>
</OutboxDocumentHeaders>

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/DocumentId
Header: contentType="application/json; charset=utf-8"

NotifyImport Parameters

NotifyImport Example

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

MarkPaid

Mark Paid method is used for sending an information that an invoice is paid, to the Moj-eRačun service.

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

MarkPaid Parameters

MarkPaid Example

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

MarkPaid Response Example

Document Action

Apply resend or cancel 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.

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: