> ## Documentation Index
> Fetch the complete documentation index at: https://developer.moneyone.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Track Status

> Track the PDF statement-upload journey via webhook, status polling, or in-iframe UI events.

There are three ways to know when a journey reaches a terminal state. Pick whichever
fits your integration — they can also be combined.

* **Webhook** (recommended) — MoneyOne pushes a terminal notification to your endpoint.
* **Status Polling** — you pull the journey status with the `transactionId`.
* **UI Events** — if you embed the orchestration UI in an iframe, listen for `postMessage` events.

<Tabs>
  <Tab title="Webhook (Recommended)">
    The webhook is a terminal push: MoneyOne calls your configured endpoint once the
    journey reaches a final state, so you don't have to poll. For the PDF flow, the
    `eventData` array contains a single `PDF` block.

    <Note>
      To configure your webhook URL, contact `support@moneyone.in`.
    </Note>

    ### Successful PDF journey

    When the user successfully uploads and processes their bank statements, the PDF block
    reports `SUCCESS` with the extracted account details.

    ```json theme={null}
    {
      "timestamp": "2026-03-31T08:02:45.111480334Z",
      "transactionID": "ad277c38-ca13-49b0-befd-38343e221e6b",
      "eventType": "JOURNEY_COMPLETE",
      "eventStatus": "SUCCESS",
      "accountID": "ACC-78291",
      "eventData": [
        {
          "type": "PDF",
          "status": "SUCCESS",
          "accounts": [
            {
              "maskedAccountNumber": "10021535948",
              "bankName": "hdfc",
              "accountType": "saving",
              "startDate": "02-09-2025",
              "endDate": "28-02-2026"
            }
          ]
        }
      ]
    }
    ```

    ### Failed PDF journey

    When the user skips the upload or statement processing fails, the PDF block reports
    a failure status with an empty `accounts` array.

    ```json theme={null}
    {
      "timestamp": "2026-03-31T06:59:46.465644026Z",
      "transactionID": "c664bcaa-c0bf-4101-b9ac-31e6d78cdb48",
      "eventType": "JOURNEY_COMPLETE",
      "eventStatus": "FAILED",
      "accountID": "ACC-90342",
      "eventData": [
        {
          "type": "PDF",
          "status": "SKIPPED",
          "accounts": []
        }
      ]
    }
    ```

    <Info>
      For the PDF flow, `eventData` contains a single `PDF` entry. There is no AA entry.
    </Info>

    ### Top-level fields

    | Field           | Description                                            |
    | --------------- | ------------------------------------------------------ |
    | `timestamp`     | ISO-8601 time the event was emitted.                   |
    | `transactionID` | Transaction identifier for the journey.                |
    | `eventType`     | Always `JOURNEY_COMPLETE` for the terminal push.       |
    | `eventStatus`   | `SUCCESS` or `FAILED`.                                 |
    | `accountID`     | Your account identifier for the user.                  |
    | `eventData`     | Array of result blocks. For PDF, a single `PDF` block. |

    ### PDF block fields

    | Field      | Description                                               |
    | ---------- | --------------------------------------------------------- |
    | `type`     | Always `PDF`.                                             |
    | `status`   | `SUCCESS`, `FAILED`, or `SKIPPED`.                        |
    | `accounts` | Array of accounts extracted from the uploaded statements. |

    #### `accounts[]` fields

    | Field                 | Description                                        |
    | --------------------- | -------------------------------------------------- |
    | `maskedAccountNumber` | Masked account number from the uploaded statement. |
    | `bankName`            | Bank the statement belongs to (e.g. `hdfc`).       |
    | `accountType`         | Account type (e.g. `saving`).                      |
    | `startDate`           | Statement period start (`DD-MM-YYYY`).             |
    | `endDate`             | Statement period end (`DD-MM-YYYY`).               |

    <Info>
      When `status` is `SKIPPED`, the `accounts` array is empty — the user did not complete the
      statement upload.
    </Info>
  </Tab>

  <Tab title="Status Polling">
    If you prefer to pull the journey status rather than receive a webhook, poll this
    endpoint with the `transactionId`. For the PDF flow, the response contains
    `health_check`, `pdf`, and `analytics` steps.

    ### Endpoint

    ```
    POST /transaction/status
    ```

    Base URL (UAT / Production): Contact `support@moneyone.in`.

    ### Headers

    | Header           | Description                              |
    | ---------------- | ---------------------------------------- |
    | `Content-Type`   | `application/json`                       |
    | `client_id`      | Your client ID                           |
    | `client_secret`  | Your client secret                       |
    | `organisationId` | Your organisation ID                     |
    | `appIdentifier`  | Your app identifier                      |
    | `x-request-id`   | Optional request identifier for tracing. |

    ### Request body

    ```json theme={null}
    {
      "transactionId": "<transaction_id>"
    }
    ```

    ### Sample request

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url 'https://<base_url>/transaction/status' \
        --header 'Content-Type: application/json' \
        --header 'client_id: <your_client_id>' \
        --header 'client_secret: <your_client_secret>' \
        --header 'organisationId: <your_organisation_id>' \
        --header 'appIdentifier: <your_app_identifier>' \
        --data '{
          "transactionId": "<transaction_id>"
        }'
      ```
    </CodeGroup>

    ### Response

    ```json theme={null}
    {
      "status": "SUCCESSFUL",
      "transaction_id": "<transaction_id>",
      "data": [
        {
          "type": "health_check",
          "status": "SUCCESSFUL",
          "data": {
            "healthy_fips": [],
            "unhealthy_fips": ["<fip_id_1>", "<fip_id_2>"],
            "fip_decisions": [
              { "fip": "<fip_id_1>", "decision": "FIP_UNHEALTHY" },
              { "fip": "<fip_id_2>", "decision": "FIP_UNHEALTHY" }
            ]
          }
        },
        {
          "type": "pdf",
          "status": "SUCCESSFUL",
          "data": {
            "expected_fips": ["<fip_id_1>", "<fip_id_2>"],
            "total_expected": 2,
            "uploaded": 2,
            "processed": 2,
            "fetched": 2,
            "accounts": [
              {
                "maskedAccountNumber": "10021535948",
                "bankName": "hdfc",
                "accountType": "saving",
                "startDate": "02-09-2025",
                "endDate": "28-02-2026"
              },
              {
                "maskedAccountNumber": "20045678123",
                "bankName": "icici",
                "accountType": "saving",
                "startDate": "01-09-2025",
                "endDate": "28-02-2026"
              }
            ]
          }
        },
        { "type": "analytics", "status": "SUCCESSFUL" }
      ],
      "message": null
    }
    ```

    ### Step types

    | Type           | Description                                                                                                                                  |
    | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
    | `health_check` | FIP health evaluation. In the PDF-only flow, banks are typically listed as unhealthy, directing the user to PDF upload.                      |
    | `pdf`          | PDF statement upload and processing; reports `expected_fips`, counts (`total_expected`, `uploaded`, `processed`, `fetched`), and `accounts`. |
    | `analytics`    | Analytics computation over the extracted data.                                                                                               |

    ### `pdf` step data fields

    | Field            | Description                                            |
    | ---------------- | ------------------------------------------------------ |
    | `expected_fips`  | List of FIPs expected to be covered by PDF uploads.    |
    | `total_expected` | Total number of expected statement uploads.            |
    | `uploaded`       | Number of statements uploaded by the user.             |
    | `processed`      | Number of statements successfully processed (OCR).     |
    | `fetched`        | Number of statements with data successfully extracted. |
    | `accounts`       | Array of extracted account details.                    |

    ### Step statuses

    | Status         | Meaning                                 |
    | -------------- | --------------------------------------- |
    | `SUCCESSFUL`   | The step completed successfully.        |
    | `UNSUCCESSFUL` | The step completed but did not succeed. |
    | `FAILED`       | The step failed.                        |
    | `SKIPPED`      | The step was skipped.                   |
    | `IN_PROGRESS`  | The step is currently running.          |
    | `PENDING`      | The step has not started yet.           |
    | `PARTIAL`      | The step completed partially.           |

    ### Overall statuses

    | Status         | Meaning                                    |
    | -------------- | ------------------------------------------ |
    | `SUCCESSFUL`   | The journey completed successfully.        |
    | `UNSUCCESSFUL` | The journey completed but did not succeed. |
    | `IN_PROGRESS`  | The journey is still running.              |
    | `SKIPPED`      | The journey was skipped.                   |
    | `PENDING`      | The journey has not started yet.           |

    <Note>
      Poll until the overall `status` reaches a terminal value (`SUCCESSFUL` / `UNSUCCESSFUL`).
    </Note>

    ### Error Codes

    | HTTP Status                 | Condition                                                         |
    | --------------------------- | ----------------------------------------------------------------- |
    | `400 Bad Request`           | `transactionId` is missing or invalid in the request body.        |
    | `401 Unauthorized`          | Credentials are missing or invalid in the `Authorization` header. |
    | `500 Internal Server Error` | An unexpected server-side error occurred.                         |
  </Tab>

  <Tab title="UI Events">
    When the orchestration UI is embedded in an iframe, it communicates with the parent
    window using the browser [`postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
    API. Your parent window can listen for these events to react the moment a journey
    reaches a terminal state.

    ### Event structure

    ```json theme={null}
    {
      "type": "REDIRECT",
      "eventCode": "JOURNEY-SUCCESS",
      "message": "Workflow completed successfully for transaction <transaction_id>",
      "statusData": { ... }
    }
    ```

    | Field        | Type   | Description                                   |
    | ------------ | ------ | --------------------------------------------- |
    | `type`       | string | Event type (e.g. `REDIRECT`).                 |
    | `eventCode`  | string | The event code (see below).                   |
    | `message`    | string | Human-readable message.                       |
    | `statusData` | object | The full status response for the transaction. |

    ### Event codes

    | Event Code        | Trigger Condition                                          | Description                      |
    | ----------------- | ---------------------------------------------------------- | -------------------------------- |
    | `JOURNEY-SUCCESS` | `status === 'SUCCESSFUL'`                                  | Workflow completed successfully. |
    | `JOURNEY-FAILURE` | `status === 'UNSUCCESSFUL'`, `'EXPIRED'`, or `'CANCELLED'` | Workflow failed.                 |
    | `JOURNEY-SKIPPED` | `status === 'SKIPPED'`                                     | Workflow was skipped.            |

    ### Listening for events

    ```javascript theme={null}
    window.addEventListener('message', (event) => {
      const { type, eventCode, message, statusData } = event.data;

      if (eventCode === 'JOURNEY-SUCCESS') {
        // Handle successful PDF upload completion
        console.log('Workflow success:', statusData);
      } else if (eventCode === 'JOURNEY-FAILURE') {
        // Handle failure
        console.log('Workflow failed:', message);
      } else if (eventCode === 'JOURNEY-SKIPPED') {
        // Handle skipped journey
        console.log('Workflow skipped:', message);
      }
    });
    ```

    <Tip>
      For production integrations, verify `event.origin` against the orchestration UI's
      origin before trusting the payload.
    </Tip>
  </Tab>
</Tabs>

## Next step

Once the journey completes successfully, fetch the raw FI data or analytics on the
[Fetch Data](./fetch-data) page using the same `transaction_id`.
