> ## 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.

# Fetch Data

> Retrieve the financial data collected for a consent, and derived analytics.

Once data has been fetched for a consent (see [Request Data](./request-data)),
retrieve it using the same `transactionId` and `consentId`. You can fetch the raw
**FI data** or the derived **analytics**.

<Tabs>
  <Tab title="Get FI Data">
    Fetch financial data for a consent, in the standard Account Aggregator `FIData`
    format.

    ### Endpoint

    ```
    POST /finpro/transaction/data
    ```

    Base URL: provided to you at onboarding.

    ### Headers

    | Header          | Description                             |
    | --------------- | --------------------------------------- |
    | `Content-Type`  | `application/json`                      |
    | `Authorization` | `Basic base64(client_id:client_secret)` |

    ### Request body

    ```jsonc theme={null}
    {
      "transactionId": "string",   // required
      "consentId": "string",       // required
      "latest": false              // optional — true = most recent fetch only, default = full history
    }
    ```

    <ParamField body="transactionId" type="string" required>
      The `transactionId` returned by Consent Creation.
    </ParamField>

    <ParamField body="consentId" type="string" required>
      The consent to fetch data for.
    </ParamField>

    <ParamField body="latest" type="boolean">
      `true` returns only the most recent fetch's data per account; otherwise the full
      fetch history — everything not yet expired per MoneyOne's data-retention/expiry
      policy (see `dataExpiry` in [Track Status](./track-status)) — is included.
    </ParamField>

    <Note>
      This call does not take a `fiuId` field — MoneyOne always resolves which FIU a
      consent belongs to from `consentId` itself, the same as [Request Data](./request-data).
    </Note>

    ### Sample request

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url 'https://<base_url>/finpro/transaction/data' \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Basic <base64(client_id:client_secret)>' \
        --data '{
          "transactionId": "<transaction_id>",
          "consentId": "<consent_id>",
          "latest": false
        }'
      ```
    </CodeGroup>

    ### Response

    An array of account-level financial data objects, one per account under the consent.
    Field set shown below is for `fiType: DEPOSIT` (bank accounts) — the type relevant to
    lending use cases. Other `fiType` values carry a different `Profile`/`Summary` shape
    under the same envelope.

    ```jsonc theme={null}
    {
      "data": [
        {
          "linkedAccRef": "string",
          "maskedAccNumber": "string",
          "fiType": "DEPOSIT",
          "Profile": {
            "Holders": {
              "type": "SINGLE",        // Holders-level, not per-Holder
              "Holder": [
                {
                  "name": "string",
                  "mobile": "string",
                  "email": "string",
                  "dob": "string",
                  "pan": "string",
                  "address": "string",
                  "nominee": "string",
                  "landline": "string",
                  "ckycCompliance": "string"
                }
              ]
            }
          },
          "Summary": {
            "currentBalance": "string",
            "balanceDateTime": "string",
            "type": "string",           // e.g. SAVINGS, CURRENT
            "accountType": "string",    // optional
            "branch": "string",         // optional
            "ifscCode": "string",       // optional
            "micrCode": "string",       // optional
            "status": "string",         // optional — e.g. ACTIVE, INACTIVE
            "exchgeRate": "string",     // optional
            "currency": "string",       // optional
            "facility": "string",       // optional
            "openingDate": "string",    // optional
            "currentODLimit": "string", // optional
            "drawingLimit": "string",   // optional
            "Pending": [                // optional — array, not a single value
              { "amount": 0, "transactionType": "string" }
            ]
          },
          "Transactions": {
            "startDate": "string",
            "endDate": "string",
            "Transaction": [
              {
                "txnId": "string",
                "transactionTimestamp": "string",
                "valueDate": "string",
                "amount": "string",
                "currentBalance": "string",
                "type": "string",      // CREDIT / DEBIT
                "mode": "string",      // e.g. UPI, NEFT, ATM
                "narration": "string",
                "reference": "string"
              }
            ]
          },
          "bank": "string"        // the FIP name — see note below
        }
      ]
    }
    ```

    <Note>
      Several fields marked `optional` above are only present when the FIP actually
      reports them — `Transactions.Transaction[]` itself can legitimately be absent or
      empty for an account with no transaction history in the fetched window.
    </Note>

    <Note>
      `bank` is a top-level field naming the FIP. Some onboarding configurations return
      this same information as `fipID` instead — check your onboarding configuration for
      which applies.
    </Note>

    ### Error Codes

    ```jsonc theme={null}
    {
      "status": "FAILURE",
      "errorCode": "DATA_NOT_AVAILABLE",
      "message": "string"
    }
    ```

    `consentId` resolves correctly, but no data has been fetched yet.

    | Error Code              | HTTP status | Meaning                                                                                                                                                                                                                         |
    | ----------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `UNAUTHORIZED`          | 401         | `Authorization` header is missing, malformed, or the credentials don't match your onboarded `client_id`/`client_secret`.                                                                                                        |
    | `TRANSACTION_NOT_FOUND` | 404         | `transactionId` doesn't resolve to any known transaction.                                                                                                                                                                       |
    | `CONSENT_NOT_FOUND`     | 404         | `consentId` doesn't resolve, or resolves under a different `transactionId` than supplied. `TRANSACTION_NOT_FOUND` is checked first — a request with both fields wrong reports the transaction problem, not the consent problem. |
    | `DATA_NOT_AVAILABLE`    | 404         | `consentId` resolves correctly, but no data has been fetched yet.                                                                                                                                                               |
  </Tab>

  <Tab title="Analytics">
    Fetch analytics derived from a consent's data — spend/income categorization, balance
    trends, and similar computed insights. Requires at least one successful Data Request
    for the consent first.

    ### Endpoint

    ```
    POST /finpro/transaction/analytics/json
    ```

    Base URL: provided to you at onboarding.

    ### Headers

    | Header          | Description                             |
    | --------------- | --------------------------------------- |
    | `Content-Type`  | `application/json`                      |
    | `Authorization` | `Basic base64(client_id:client_secret)` |

    ### Request body

    ```jsonc theme={null}
    {
      "transactionId": "string",          // required
      "journeyId": "string",              // required — static value, provided to you by MoneyOne at onboarding
      "consentId": "string",              // required
      "linkReferenceNumber": ["string"]   // optional
    }
    ```

    <ParamField body="transactionId" type="string" required>
      The `transactionId` returned by Consent Creation.
    </ParamField>

    <ParamField body="journeyId" type="string" required>
      A static value provided to you by MoneyOne at onboarding — not obtained from any
      other endpoint's response.
    </ParamField>

    <ParamField body="consentId" type="string" required>
      The consent to fetch analytics for.
    </ParamField>

    <ParamField body="linkReferenceNumber" type="array">
      Optional list of link reference numbers to scope the analytics to.
    </ParamField>

    <Note>
      This call does not take a `fiuId` field, for the same reason as
      [Request Data](./request-data) and Get FI Data above.
    </Note>

    ### Sample request

    <CodeGroup>
      ```bash cURL theme={null}
      curl --request POST \
        --url 'https://<base_url>/finpro/transaction/analytics/json' \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Basic <base64(client_id:client_secret)>' \
        --data '{
          "transactionId": "<transaction_id>",
          "journeyId": "<your_journey_id>",
          "consentId": "<consent_id>"
        }'
      ```
    </CodeGroup>

    ### Response

    ```jsonc theme={null}
    {
      "status": "success",
      "message": "string",
      "data": {
        "overallAnalysis": {
          "totalNetCreditTransactionAmount": 0,
          "totalNetDebitAmount": 0,
          "minimumEodBalance": 0,
          "maximumBalance": 0,
          "averageBalanceLast3Months": 0,
          "bankPenaltiesDetected": false,
          "weeklyAnalytics": [
            {
              "week": 0,
              "year": 0,
              "month": 0,
              "avgBalance": 0,
              "totalCreditAmount": 0,
              "totalDebitAmount": 0,
              "totalCreditTxn": 0,
              "totalDebitTxn": 0
            }
          ]
        },
        "accountWiseAnalysis": [
          "one entry per linked account, same shape as overallAnalysis"
        ],
        "accountProfiles": [
          "account holder/FIP metadata, one entry per linked account"
        ],
        "allTransactions": [
          "full transaction list across all linked accounts"
        ]
      }
    }
    ```

    `accountWiseAnalysis`, `accountProfiles`, and `allTransactions` are arrays with one
    entry per linked account (or, for `allTransactions`, one entry per transaction across
    all linked accounts) — see the Postman collection for a fully expanded example.

    ### Error Codes

    | Error Code              | HTTP status | Meaning                                                                                                                             |
    | ----------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------- |
    | `UNAUTHORIZED`          | 401         | `Authorization` header is missing, malformed, or the credentials don't match your onboarded `client_id`/`client_secret`.            |
    | `TRANSACTION_NOT_FOUND` | 404         | `transactionId` doesn't resolve to any known transaction.                                                                           |
    | `CONSENT_NOT_FOUND`     | 404         | `consentId` doesn't resolve, or resolves under a different `transactionId` than supplied. `TRANSACTION_NOT_FOUND` is checked first. |
  </Tab>
</Tabs>

<Card title="Postman Collection" icon="flask" href="/lsp_postman_collection.json">
  Import pre-configured API collection for testing
</Card>
