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

# Analytics Excel

> Retrieve analytics data as an S3 link or Excel file for a completed consent journey.

## Overview

The Analytics Excel API allows you to retrieve analytics and insights data as a downloadable Excel file or an S3 pre-signed URL for a specific consent journey. The output format (S3 link or direct Excel file) depends on your organization's configuration.

### Key Use Cases

* **Downloadable Reports**: Get analytics data as an Excel file for offline analysis and reporting.
* **S3 Integration**: Receive a pre-signed S3 URL to programmatically download or store the analytics report.
* **Account-Level Analytics**: Request analytics for specific linked accounts using link reference numbers.

### Important Notes

* The consent journey must be completed before calling this API.
* The output format (S3 URL or Excel file) is configured at the organization level during onboarding.
* The `linkRefNumber` parameter allows you to request analytics for specific linked accounts rather than all accounts in the consent.

## Authentication

This API requires authentication using the following headers:

<ParamField header="client_id" type="string" required>
  Your unique client identifier provided by FinPro during onboarding. This ID is used to authenticate your application.
</ParamField>

<ParamField header="client_secret" type="string" required>
  Your confidential client secret key provided by FinPro. This must be kept secure and never exposed in client-side code.
</ParamField>

<ParamField header="appIdentifier" type="string" required>
  The unique identifier for your application (e.g., your application's package name or bundle ID). This helps FinPro identify which application is making the request.
</ParamField>

<ParamField header="organisationId" type="string" required>
  Your organization's unique identifier assigned by FinPro. This identifies your organization in the FinPro system.
</ParamField>

<ParamField header="content-Type" type="string" required>
  Must be set to `application/json` to indicate that the request body contains JSON data.
</ParamField>

## Request Body

<ParamField body="consentID" type="string" required>
  The unique consent identifier provided by the Account Aggregator after consent approval. This must be a valid consent ID.
</ParamField>

<ParamField body="journeyID" type="string" required>
  The unique journey identifier associated with the consent flow. This identifies the specific journey for which analytics data is requested.
</ParamField>

<ParamField body="linkRefNumber" type="string[]" required>
  An array of link reference numbers identifying the specific linked accounts for which analytics should be generated. Each link reference number corresponds to a specific account authorization.
</ParamField>

### Request Example

```json theme={null}
{
  "consentID": "ef33fe97-ac6f-4c28-98fd-b3f9716736da",
  "journeyID": "aa_excel_analytics_v1",
  "linkRefNumber": [
    "2f3ad75d-87e2-4b1d-8b5b-a39b5160d208"
  ]
}
```

## Response

The response format depends on your organization's configuration:

* **S3 URL**: Returns a pre-signed S3 URL to download the Excel file.
* **Excel File**: Returns the Excel file directly as a binary download.

### Success Response Example (S3 URL)

```json theme={null}
{
  "ver": "1.21.0",
  "status": "success",
  "data": {
    "status": "SUCCESS",
    "message": "Success",
    "status_code": "success",
    "transaction_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "journey_id": "aa_excel_analytics_v1",
    "data": {
      "s3Url": "https://s3.ap-south-1.amazonaws.com/bucket-name/analytics/report.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&...",
      "expiresIn": 3600
    }
  }
}
```

<Note>
  When the response contains an S3 URL, the pre-signed URL has an expiry time. Download the file before the URL expires. The `expiresIn` field indicates the validity period in seconds.
</Note>

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl --location --request POST '{{Base_URL}}/analytics/excel' \
  --header 'client_id: {{Client_Id}}' \
  --header 'client_secret: {{Client_Secret}}' \
  --header 'organisationId: {{Organisation_Id}}' \
  --header 'appIdentifier: {{App_Identifier}}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "consentID": "ef33fe97-ac6f-4c28-98fd-b3f9716736da",
      "journeyID": "aa_excel_analytics_v1",
      "linkRefNumber": [
          "2f3ad75d-87e2-4b1d-8b5b-a39b5160d208"
      ]
  }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('{{Base_URL}}/analytics/excel', {
    method: 'POST',
    headers: {
      'client_id': '{{Client_Id}}',
      'client_secret': '{{Client_Secret}}',
      'organisationId': '{{Organisation_Id}}',
      'appIdentifier': '{{App_Identifier}}',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      consentID: 'ef33fe97-ac6f-4c28-98fd-b3f9716736da',
      journeyID: 'aa_excel_analytics_v1',
      linkRefNumber: [
        '2f3ad75d-87e2-4b1d-8b5b-a39b5160d208'
      ]
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  url = "{{Base_URL}}/analytics/excel"

  headers = {
      "client_id": "{{Client_Id}}",
      "client_secret": "{{Client_Secret}}",
      "organisationId": "{{Organisation_Id}}",
      "appIdentifier": "{{App_Identifier}}",
      "Content-Type": "application/json"
  }

  payload = {
      "consentID": "ef33fe97-ac6f-4c28-98fd-b3f9716736da",
      "journeyID": "aa_excel_analytics_v1",
      "linkRefNumber": [
          "2f3ad75d-87e2-4b1d-8b5b-a39b5160d208"
      ]
  }

  response = requests.post(url, json=payload, headers=headers)
  print(response.json())
  ```
</CodeGroup>


## OpenAPI

````yaml POST /analytics/excel
openapi: 3.0.3
info:
  title: FinPro API
  description: MoneyOne FinPro - Account Aggregator FIU Platform APIs
  version: 1.21.0
servers:
  - url: '{baseUrl}'
    description: FinPro API Server
    variables:
      baseUrl:
        default: https://scramblerpay-uat.moneyone.in
        description: API Base URL - change this to your environment
security:
  - clientId: []
    clientSecret: []
    organisationId: []
    appIdentifier: []
paths:
  /analytics/excel:
    post:
      tags:
        - Analytics
      summary: Analytics Excel
      description: >-
        Retrieve analytics data as an S3 link or Excel file for a completed
        consent journey.
      operationId: getAnalyticsExcel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyticsExcelRequest'
            example:
              consentID: ef33fe97-ac6f-4c28-98fd-b3f9716736da
              journeyID: aa_excel_analytics_v1
              linkRefNumber:
                - 2f3ad75d-87e2-4b1d-8b5b-a39b5160d208
      responses:
        '200':
          description: Analytics Excel data retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsExcelResponse'
              example:
                ver: 1.21.0
                status: success
                data:
                  status: SUCCESS
                  message: Success
                  status_code: success
                  transaction_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                  journey_id: aa_excel_analytics_v1
                  data:
                    s3Url: >-
                      https://s3.ap-south-1.amazonaws.com/bucket-name/analytics/report.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&...
                    expiresIn: 3600
        '400':
          description: Bad Request - Invalid data or validation failure
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                ver: 1.21.0
                timestamp: '2025-10-01T11:49:28.920Z'
                errorCode: InvalidRequest
                errorMsg: Invalid consent ID or journey ID
                status: FP0001
        '401':
          description: Authentication Failed - Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - clientId: []
          clientSecret: []
          organisationId: []
          appIdentifier: []
components:
  schemas:
    AnalyticsExcelRequest:
      type: object
      description: Request body for retrieving analytics data as Excel or S3 link.
      required:
        - consentID
        - journeyID
        - linkRefNumber
      properties:
        consentID:
          type: string
          description: >-
            The unique consent identifier provided by the Account Aggregator
            after consent approval.
          example: ef33fe97-ac6f-4c28-98fd-b3f9716736da
        journeyID:
          type: string
          description: The unique journey identifier associated with the consent flow.
          example: aa_excel_analytics_v1
        linkRefNumber:
          type: array
          description: Array of link reference numbers for specific linked accounts.
          items:
            type: string
          example:
            - 2f3ad75d-87e2-4b1d-8b5b-a39b5160d208
    AnalyticsExcelResponse:
      type: object
      description: Response containing analytics data as S3 URL or Excel file reference.
      properties:
        ver:
          type: string
          description: API version that processed the request.
          example: 1.21.0
        status:
          type: string
          description: Overall API call status.
          example: success
        data:
          type: object
          description: Analytics response payload.
          properties:
            status:
              type: string
              description: Processing status.
              example: SUCCESS
            message:
              type: string
              description: Status message.
              example: Success
            status_code:
              type: string
              description: Status code.
              example: success
            transaction_id:
              type: string
              description: Unique transaction identifier.
              example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
            journey_id:
              type: string
              description: Journey identifier used for the analytics.
              example: aa_excel_analytics_v1
            data:
              type: object
              description: Contains the S3 URL or file reference.
              properties:
                s3Url:
                  type: string
                  description: Pre-signed S3 URL to download the Excel analytics report.
                expiresIn:
                  type: integer
                  description: URL expiry time in seconds.
                  example: 3600
    ErrorResponse:
      type: object
      properties:
        ver:
          type: string
          description: API version
        timestamp:
          type: string
          format: date-time
          description: When the error occurred
        errorCode:
          type: string
          description: Error category code
        errorMsg:
          type: string
          description: Detailed error message
        status:
          type: string
          description: FinPro-specific error code (FPxxxx format)
  securitySchemes:
    clientId:
      type: apiKey
      in: header
      name: client_id
      description: Your unique client identifier provided by MoneyOne during FIU onboarding
    clientSecret:
      type: apiKey
      in: header
      name: client_secret
      description: Your confidential client secret provided by MoneyOne
    organisationId:
      type: apiKey
      in: header
      name: organisationId
      description: Your organization's unique identifier in the FinPro system
    appIdentifier:
      type: apiKey
      in: header
      name: appIdentifier
      description: Application-specific identifier for tracking API calls

````