> For the complete documentation index, see [llms.txt](https://amast-einvoice.gitbook.io/amast-einvoice-sass/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://amast-einvoice.gitbook.io/amast-einvoice-sass/status-model.md).

# Status Model

## Two dimensions per document

| Field              | Source            | Meaning                                    |
| ------------------ | ----------------- | ------------------------------------------ |
| `submissionStatus` | Platform pipeline | Queuing, building UBL, calling LHDN submit |
| `lhdnStatus`       | LHDN              | Outcome after submit / sync jobs           |

## Scenario flows

### Happy path

| Step | submissionStatus | lhdnStatus |
| ---- | ---------------- | ---------- |
| 1    | Queued           | null       |
| 2    | Processing       | null       |
| 3    | Submitted        | Submitted  |
| 4    | Submitted        | Valid      |

Batch `status` becomes `Valid` when **every** document is LHDN `Valid`.

### Pipeline failure

| Step | submissionStatus | lhdnStatus |
| ---- | ---------------- | ---------- |
| 1    | Queued           | null       |
| 2    | Processing       | null       |
| 3    | SubmitFailed     | null       |

Any `SubmitFailed` forces batch `SubmitFailed`.

### LHDN rejected at submit

| Step | submissionStatus | lhdnStatus |
| ---- | ---------------- | ---------- |
| 3    | Submitted        | Rejected   |

### Invalid / cancelled after processing

| Step | submissionStatus | lhdnStatus |
| ---- | ---------------- | ---------- |
| 4    | Submitted        | Invalid    |

(`Cancelled` follows the same pattern.)

### Mixed batch

Document A reaches LHDN `Valid` while B remains `Submitted` → batch stays `Submitted` until all are done processed by LHDN.\
\
i.e we submit 2 document in a batch, below is the possible outcomes:

<table><thead><tr><th width="319">Situation</th><th width="197">Platform Batch Status</th><th>Doc A LHDN</th><th>Doc B LHDN</th></tr></thead><tbody><tr><td>LHDN accepts doc A, rejects doc B </td><td><code>Submitted</code></td><td><code>Valid</code> </td><td><code>Rejected</code></td></tr><tr><td>LHDN HTTP failure</td><td><code>SubmitFailed</code></td><td><code>null</code></td><td><code>null</code></td></tr><tr><td>LHDN accept doc A and B but invalidate doc B due to<br> i.e wrong TIN combination, wrong IV reference for CN</td><td><code>Submitted</code></td><td><code>Valid</code></td><td><code>Invalid</code></td></tr></tbody></table>

{% hint style="warning" %}
Integrator takeaway: batch `Submitted` ≠ “all good”, always check each row’s `lhdnStatus`
{% endhint %}

### LHDN Statuses (How it Works at MyTax side):

| lhdnStatus  | When it happens                                | LHDN moment                                  |
| ----------- | ---------------------------------------------- | -------------------------------------------- |
| `Submitted` | Accepted into processing; not final yet        | After submit accept, or sync while pending   |
| `Valid`     | Passed validation                              | Sync (`getSubmission`)                       |
| `Rejected`  | Line in `rejectedDocuments` on submit response | Same HTTP as submit — never accepted         |
| `Invalid`   | `status` from submission summary on sync       | Later — was accepted, then failed validation |
| `Cancelled` | Cancel flow                                    | After cancel                                 |

## Polling guidance

* Start at 2–5 second intervals.
* Exponential backoff after 1–2 minutes.
* No webhooks, only polling is supported.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://amast-einvoice.gitbook.io/amast-einvoice-sass/status-model.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
