Skip to content

Place a received document for a trial run

POST
/api/integration/v1/sandbox/inbound

Places an inbound invoice into your organisation, as if it had arrived from the tax authority.

documentNumber is the only field you must supply; everything else has a sensible default.

Supply euid to make the call repeatable: sending the same one again returns the existing document with alreadyExisted: true instead of creating a second one. Omit it and a new document is created each time.

payload and pdfBase64 are independent. With neither, the document exists and is listed but carries no content — a real state worth testing, and the one you get from the tax authority when a privilege is missing.

The example applies to the demo environment only.

Request

curl -i -X POST "https://sandbox.api.earhiva.mk/api/integration/v1/sandbox/inbound" \
  -H "X-Api-Key: <YOUR KEY>" \
  -H "X-Software-Id: <NAME AND VERSION OF YOUR APPLICATION>" \
  -H "Content-Type: application/json" \
  -d '{ }'

Every call carries X-Api-Key with a key that has the IntegrationApi scope, and X-Software-Id with the name and version of your software. How to request a key is on Authentication.

Parameters

All parameters (1)
ParameterInTypePresenceDescription
X-Software-IdheaderstringalwaysIdentifier of the calling software, e.g. SSBFocus/4.2.1. Free text, recorded in the audit trail. Required on every call; missing means EARH-1008.

Request Body

The invoice to place.

Type: application/json.

null

Error codes

EARH-1001 · EARH-1002 · EARH-1003 · EARH-1004 · EARH-1005 · EARH-1006 · EARH-1009 · EARH-1010 · EARH-1011 · EARH-2030

The full list of codes, what each means and what to do, is in the Error catalogue.

The document was created; the body carries its docUid.

{
  "docUid": "",
  "euid": "",
  "alreadyExisted": false
}
All fields in the body (3)
FieldTypePresenceDescription
docUidstringalwaysIdentifier of the inbound document. Use it with GET inbound/{docUid}, GET inbound/{docUid}/file and POST inbound/{docUid}/decision.
euidstringalwaysThe tax authority identifier the document carries — the one you supplied, or the one generated for you.
alreadyExistedbooleanalwaystrue when a document with that euid was already there and nothing new was created. Not an error — it is what lets you re-run the same script.

EARH-2030 — the body is missing a required field, or pdfBase64 is not valid base64.

{
  "type": "https://earhiva.mk/errors/EARH-2030",
  "title": "The request body is not usable.",
  "status": 400,
  "code": "EARH-2030"
}
All fields in the body (6)
FieldTypePresenceDescription
typestringalwaysAddress of this code in the error catalogue (RFC 7807).
titlestringalwaysShort, stable English summary of the error — the same string that appears in your log.
statusinteger · int32alwaysHTTP status code, repeated in the body (RFC 7807).
detailstringnullableWhat went wrong in this particular call, when there is more to say than the title. Absent when the title already says everything.
codestringalwaysThe EARH-xxxx code. This is the contract: match on it, not on the text.
eventIdstringnullableOnly on EARH-9000. Quote it when reporting the problem — it is the same reference we record in our log, so one number identifies the event on both sides.

The API key is missing, unknown, expired or revoked — EARH-1001, EARH-1002, EARH-1003. The body is the standard error body — the same on every call. What to do about each code is in the Error catalogue.

The caller’s address is outside the allowed list, the key does not carry the IntegrationApi scope, the organization’s plan does not include integration access, or the key has been switched off by its owner — EARH-1004, EARH-1005, EARH-1010, EARH-1011. The last two are returned on every call and carry no Retry-After: waiting does not change the state. The body is the standard error body — the same on every call. What to do about each code is in the Error catalogue.

EARH-1009 — this endpoint does not exist outside the sandbox server.

{
  "type": "https://earhiva.mk/errors/EARH-1009",
  "title": "This endpoint does not exist in this version.",
  "status": 404,
  "code": "EARH-1009"
}
All fields in the body (6)
FieldTypePresenceDescription
typestringalwaysAddress of this code in the error catalogue (RFC 7807).
titlestringalwaysShort, stable English summary of the error — the same string that appears in your log.
statusinteger · int32alwaysHTTP status code, repeated in the body (RFC 7807).
detailstringnullableWhat went wrong in this particular call, when there is more to say than the title. Absent when the title already says everything.
codestringalwaysThe EARH-xxxx code. This is the contract: match on it, not on the text.
eventIdstringnullableOnly on EARH-9000. Quote it when reporting the problem — it is the same reference we record in our log, so one number identifies the event on both sides.

The traffic limit for this key has been reached — EARH-1006. The response carries Retry-After. The limit is counted per key, and its size comes from the organization’s plan. The body is the standard error body — the same on every call. What to do about each code is in the Error catalogue.

Unexpected error on our side — EARH-9000. The body carries eventId; quote it when reporting the problem. The body is the standard error body — the same on every call. What to do about each code is in the Error catalogue.