Оди на содржината

Одлука по примен документ

POST
/api/integration/v1/inbound/{docUid}/decision

Accepts or rejects an inbound document.

Read decisionDeadline first: once that day has passed the tax authority accepts the document on its own, and a decision sent afterwards is refused. A rejection needs both a reason code from codelists/reject-reasons and a comment; an acceptance carries neither.

The decision is recorded before it is reported onward, so a successful answer does not yet mean the tax authority has confirmed it — confirmedByTaxAuthority says whether it has. This is not an acknowledgement: ack says you fetched the document, this says what you decided about it.

Примерот важи само за demo околината.

Request

curl -i -X POST "https://sandbox.api.earhiva.mk/api/integration/v1/inbound/<docUid>/decision" \
  -H "X-Api-Key: <ВАШИОТ КЛУЧ>" \
  -H "X-Software-Id: <ИМЕ И ВЕРЗИЈА НА ВАШАТА АПЛИКАЦИЈА>" \
  -H "Content-Type: application/json" \
  -d '{ }'

Секој повик носи X-Api-Key со клуч што го има опфатот IntegrationApi, и X-Software-Id со името и верзијата на твојот софтвер. Како се бара клуч стои во Автентикација.

Parameters

Сите параметри (2)
ParameterInTypePresenceDescription
docUidpathstringalwaysIdentifier of the document being decided on.
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 decision.

Тип: application/json.

null

Error codes

EARH-1001 · EARH-1002 · EARH-1003 · EARH-1004 · EARH-1005 · EARH-1006 · EARH-1010 · EARH-1011 · EARH-2022 · EARH-3001 · EARH-3006 · EARH-9002

Целосниот список шифри, со што значат и што да се направи, е во Каталог на грешки.

The decision is recorded.

{
  "docUid": "eah_i_01M0ZZB88FT117S27PM8ZEK9RY",
  "accepted": true,
  "confirmedByTaxAuthority": false,
  "confirmedAt": null,
  "failureCode": null
}
Сите полиња во телото (5)
FieldTypePresenceDescription
docUidstringalwaysIdentifier of the document the decision was made on.
acceptedbooleanalwaysThe decision as it was recorded: true accepted, false rejected.
confirmedByTaxAuthoritybooleanalwaysWhether the tax authority has already confirmed the decision. The decision is recorded before it is reported onward, so false here does not mean it was lost: it means the reporting is still under way and the answer will appear on the document itself.
confirmedAtstring · date-timenullableWhen the tax authority confirmed it, or null while confirmedByTaxAuthority is false.
failureCodestringnullablePresent only when the tax authority refused the decision — then it is EARH-4006 and the decision can be replaced with a corrected one. null in every other case.

EARH-2022 — the decision cannot be read as submitted: a rejection without a reason or without a comment, an acceptance carrying either, or a reason code that is not active.

{
  "type": "https://earhiva.mk/errors/EARH-2022",
  "title": "Decision cannot be read as submitted.",
  "status": 400,
  "code": "EARH-2022"
}
Сите полиња во телото (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 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. Телото е стандардното тело на грешка — исто кај сите повици. Што да се направи со секоја шифра стои во Каталог на грешки.

EARH-3001 — no such document, or nothing on that document to decide on. An unknown identifier and a document belonging to another tenant give an identical answer.

{
  "type": "https://earhiva.mk/errors/EARH-3001",
  "title": "Document not found.",
  "status": 404,
  "code": "EARH-3001"
}
Сите полиња во телото (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.

EARH-3006 — the state does not allow a decision: the deadline has passed, a decision is already confirmed, or one is being reported right now.

EARH-9002 — the decision cannot be handed on because of something on our side: the document has no EUID at the tax authority, the signer is not configured, or their address is not resolved. Nothing about the request is wrong, so repeating it will not help until we fix it — that is why it is 9xxx and not 3xxx.

{
  "type": "https://earhiva.mk/errors/EARH-3006",
  "title": "Current state does not allow a decision.",
  "status": 409,
  "code": "EARH-3006"
}
Сите полиња во телото (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. Телото е стандардното тело на грешка — исто кај сите повици. Што да се направи со секоја шифра стои во Каталог на грешки.

Unexpected error on our side — EARH-9000. The body carries eventId; quote it when reporting the problem. Телото е стандардното тело на грешка — исто кај сите повици. Што да се направи со секоја шифра стои во Каталог на грешки.