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

# Create a Wallets Report

> Generate a legacy Wallets Report

<Note>
  **Note – Report expiration date**

  A report expires after 24 hours (i.e., you can no longer download it after this delay). You can still generate a new report with the same filters and information easily.
</Note>

### Body parameters

<ParamField body="Tag" type="string">
  Max. length: 255 characters

  Custom data that you can add to this object.

  For reports, this parameter can be useful to give the report a name.
</ParamField>

<ParamField body="DownloadFormat" type="string">
  **Possible values:** `CSV`

  The format of the report file.
</ParamField>

<ParamField body="CallbackURL" type="string">
  Max. length: 255 characters

  The URL to which the notification indicating that the report is ready to be downloaded will be sent.
</ParamField>

<ParamField body="Sort" type="string">
  **Possible values:** `CreationDate:ASC`, `CreationDate:DESC`

  **Default value**: `CreationDate:ASC`

  The sort direction based on transaction creation date.
</ParamField>

<ParamField body="Preview" type="boolean">
  Whether the report is limited to the first 10 lines (and therefore quicker to generate).
</ParamField>

<ParamField body="Filters" type="object">
  The filtering parameters to optimize the report.

  <Expandable title="properties">
    <ParamField body="BeforeDate" type="Unix timestamp">
      The date before which the wallet was created (based on the wallet’s `CreationDate` parameter).

      **Caution:** The time range between the `BeforeDate` and the `AfterDate` cannot exceed 24 months.
    </ParamField>

    <ParamField body="AfterDate" type="Unix timestamp">
      The date after which the wallet was created (based on the wallet's `CreationDate` parameter).
      Caution: The time range between the `BeforeDate` and the `AfterDate` cannot exceed 24 months.
    </ParamField>

    <ParamField body="OwnerId" type="string">
      The unique identifier of the user owning the wallet.
    </ParamField>

    <ParamField body="Currency" type="string">
      **Allowed values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

      The currency of the wallets to take into account.
    </ParamField>

    <ParamField body="MinBalanceAmount" type="integer">
      The balance amount above which the wallets are taken into account.
    </ParamField>

    <ParamField body="MinBalanceCurrency" type="string">
      **Allowed values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

      The currency of the `MinBalanceAmount` value.
    </ParamField>

    <ParamField body="MaxBalanceAmount" type="integer">
      The balance amount below which the wallets are taken into account.
    </ParamField>

    <ParamField body="MaxBalanceCurrency" type="string">
      **Allowed values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

      The currency of the `MaxBalanceAmount` value.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="Columns" type="array">
  **Allowed values:** The `Columns` listed in the <a href="/reports">Reports</a> article, which differ according to the report type.

  The information to be included in the report.
</ParamField>

### Responses

<AccordionGroup>
  <Accordion title="200">
    <ResponseField name="Id" type="string">
      Max length: 128 characters (see [data formats](/api-reference/overview/data-formats) for details)

      The unique identifier of the object.
    </ResponseField>

    <ResponseField name="CreationDate" type="Unix timestamp">
      The date and time at which the object was created.
    </ResponseField>

    <ResponseField name="Tag" type="string">
      Max. length: 255 characters

      Custom data that you can add to this object.

      For reports, this parameter can be useful to give the report a name.
    </ResponseField>

    <ResponseField name="ReportDate" type="Unix timestamp | null">
      The date and time at which the report was generated.
    </ResponseField>

    <ResponseField name="Status" type="string">
      **Returned values:** `PENDING`, `READY_FOR_DOWNLOAD`, `FAILED`, `EXPIRED`

      The status of the report:

      * `PENDING` – The report is being generated.
      * `READY_FOR_DOWNLOAD` – The report has been created, and can be downloaded.
      * `FAILED` – The report cannot be generated.
      * `EXPIRED` – The report was created, but is no longer available for download (it can be re-run to be downloaded again with fresh data).
    </ResponseField>

    <ResponseField name="DownloadFormat" type="string">
      **Returned values:** `CSV`

      The format in which the report is going to be downloaded.
    </ResponseField>

    <ResponseField name="DownloadURL" type="string | null">
      The URL at which the report file can be downloaded when the `Status` is `GENERATED`.
    </ResponseField>

    <ResponseField name="CallbackURL" type="string">
      Max. length: 255 characters

      The URL to which the notification indicating that the report is ready to be downloaded will be sent.
    </ResponseField>

    <ResponseField name="ReportType" type="string">
      The type of the report, indicating whether it lists transactions or wallets.
    </ResponseField>

    <ResponseField name="Sort" type="string">
      The sorting direction of the CreationDate column. By default, the generated report is sorted by ascending creation date.
    </ResponseField>

    <ResponseField name="Preview" type="boolean">
      Whether the report is limited to the first 10 lines (and therefore quicker to generate).
    </ResponseField>

    <ResponseField name="Filters" type="object">
      The filtering parameters to optimize the report.

      <Expandable title="properties">
        <ResponseField name="BeforeDate" type="Unix timestamp">
          The date before which the wallet was created (based on the wallet’s `CreationDate` parameter).

          **Caution:** The time range between the `BeforeDate` and the `AfterDate` cannot exceed 24 months.
        </ResponseField>

        <ResponseField name="AfterDate" type="Unix timestamp">
          The date after which the wallet was created (based on the wallet's `CreationDate` parameter).
          Caution: The time range between the `BeforeDate` and the `AfterDate` cannot exceed 24 months.
        </ResponseField>

        <ResponseField name="OwnerId" type="string">
          The unique identifier of the user owning the wallet.
        </ResponseField>

        <ResponseField name="Currency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the wallets to take into account.
        </ResponseField>

        <ResponseField name="MinBalanceAmount" type="integer">
          The balance amount above which the wallets are taken into account.
        </ResponseField>

        <ResponseField name="MinBalanceCurrency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the `MinBalanceAmount` value.
        </ResponseField>

        <ResponseField name="MaxBalanceAmount" type="integer">
          The balance amount below which the wallets are taken into account.
        </ResponseField>

        <ResponseField name="MaxBalanceCurrency" type="string">
          **Returned values:** The three-letter <a href="/api-reference/overview/data-formats" target="_blank">ISO 4217 code</a> (EUR, GBP, etc.) of a <a href="/guides/currencies" target="_blank">supported currency</a> (depends on feature, contract, and activation settings).

          The currency of the `MaxBalanceAmount` value.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="Columns" type="array">
      **Returned values:** The `Columns` listed in the <a href="/reports">Reports</a> article, which differ according to the report type.

      The information to be included in the report.
    </ResponseField>

    <ResponseField name="ResultCode" type="array">
      The transaction result codes to be taken into account.
    </ResponseField>

    <ResponseField name="ResultMessage" type="string">
      The explanation of the result code.
    </ResponseField>
  </Accordion>

  <Accordion title="400 - Max date range 24 months">
    ```json theme={null}
    {
        "Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
        "Type": "param_error",
        "Id": "23ca4f5b-6d35-45d0-8bde-c8424885a2e9",
        "Date": 1715353491.0,
        "errors": {
            "Filters.AfterDate": "This report type can only be done for a date range of a maximum of 24 months."
        }
    }
    ```
  </Accordion>
</AccordionGroup>

<ResponseExample>
  ```json 200 expandable theme={null}
  {
      "Id": "report_m_01JFA0QC7K9CJ339JX4KV08CMW",
      "CreationDate": 1734429356,
      "Tag": "Created using Mangopay API Postman Collection",
      "ReportDate": null,
      "Status": "PENDING",
      "DownloadFormat": "CSV",
      "DownloadURL": null,
      "CallbackURL": null,
      "ReportType": "WALLETS",
      "Sort": "CreationDate:ASC",
      "Preview": false,
      "Filters": {
          "BeforeDate": 1658838931,
          "AfterDate": 1656246931,
          "OwnerId": null,
          "Currency": null,
          "MinBalanceAmount": null,
          "MinBalanceCurrency": null,
          "MaxBalanceAmount": null,
          "MaxBalanceCurrency": null
      },
      "Columns": [
          "Id",
          "Tag",
          "CreationDate",
          "Owners",
          "Description",
          "BalanceAmount",
          "BalanceCurrency",
          "Currency",
          "FundsType"
      ],
      "ResultCode": null,
      "ResultMessage": null
  }
  ```
</ResponseExample>

<RequestExample>
  ```json REST expandable theme={null}
  {
      "Tag": "Created using Mangopay API Postman Collection",
      "DownloadFormat": "CSV",
      "CallbackURL": null,
      "Sort": "CreationDate:ASC",
      "Preview": false,
      "Filters": {
          "BeforeDate": 1658838931,
          "AfterDate": 1656246931,
          "OwnerId": null,
          "Currency": null,
          "MinBalanceAmount": null,
          "MinBalanceCurrency": null,
          "MaxBalanceAmount": null,
          "MaxBalanceCurrency": null
      },
      "Columns": [
          "Id",
          "Tag",
          "CreationDate",
          "Owners",
          "Description",
          "BalanceAmount",
          "BalanceCurrency",
          "Currency",
          "FundsType"
      ]
  }
  ```

  ```php PHP expandable theme={null}
  <?php 

  require_once 'vendor/autoload.php';

  use MangoPay\MangoPayApi;
  use MangoPay\Libraries\ResponseException as MGPResponseException;
  use MangoPay\Libraries\Exception as MGPException;

  $api = new MangoPayApi();

  $api->Config->ClientId = 'your-client-id';
  $api->Config->ClientPassword = 'your-api-key';
  $api->Config->TemporaryFolder = 'tmp/';

  try {
      $reportRequest = new \MangoPay\ReportRequest();
      $reportRequest->ReportType = \MangoPay\ReportType::Wallets;
      $reportRequest->CallbackURL = 'http://example.com';
      $reportRequest->Tag = 'Created using Mangopay PHP SDK';
      
      $reportRequest->Filters = [
          'Currency' => 'EUR',
          'BalanceAmount' => [
              'Min' => 1,
              'Max' => 1000000
          ],
          'BeforeDate' => 1658838931,
          'AfterDate'  => 1656246931,
          'OwnerId' => null,
          'MinBalanceAmount' => 1, 
          'MinBalanceCurrency' => 'EUR',
          'MaxBalanceAmount' => 100000000,
          'MaxBalanceCurrency' => 'EUR',
      ];

      $reportRequest->Columns = [
          'Id',
          'CreationDate',
          'Tag',
          'Owners',
          'Description',
          'BalanceAmount',
          'BalanceCurrency',
          'Currency',
          'FundsType',
      ];

      $response = $api->Reports->Create($reportRequest);

      print_r($response);
  } catch(MGPResponseException $e) {
      print_r($e);
  } catch(MGPException $e) {
      print_r($e);
  }  
  ```

  ```javascript NodeJS expandable theme={null}
  const mangopayInstance = require('mangopay4-nodejs-sdk')
  const mangopay = new mangopayInstance({
      clientId: 'your-client-id',
      clientApiKey: 'your-api-key',
  })

  let myWalletsReport = {
    ReportType: 'WALLET',
    Tag: 'Created with Mangopay NodeJs SDK',
    DownloadFormat: 'CSV',
    CallbackURL: 'http://example.com',
    Sort: 'CreationDate:ASC',
    Preview: false,
    Filters: {
      BeforeDate: 1658838931,
      AfterDate: 1656246931,
      OwnerId: null,
      Currency: 'EUR',
      MinBalanceAmount: 1,
      MinBalanceCurrency: 'EUR',
      MaxBalanceAmount: 1000000,
      MaxBalanceCurrency: 'EUR',
    },
    Columns: [
      'Id',
      'Tag',
      'CreationDate',
      'Owners',
      'Description',
      'BalanceAmount',
      'BalanceCurrency',
      'Currency',
      'FundsType',
    ],
  }

  const createWalletsReport = async (report) => {
    return await mangopay.Reports.create(report)
      .then((response) => {
        console.info(response)
        return response
      })
      .catch((err) => {
        console.log(err)
        return false
      })
  }

  createWalletsReport(myWalletsReport)  
  ```

  ```ruby Ruby expandable theme={null}
  require 'mangopay'

  MangoPay.configure do |client|
      client.preproduction = true
      client.client_id = 'your-client-id'
      client.client_apiKey = 'your-api-key'
      client.log_file = File.join(Dir.pwd, 'mangopay.log')
  end

  myReport = {
      ReportType: 'wallets',
      Tag: 'Created with Mangopay Ruby SDK',
      DownloadFormat: 'CSV',
      CallbackURL: 'http://example.com',
      Sort: 'CreationDate:ASC',
      Preview: false,
      Filters: {
        BeforeDate: 1658838931,
        AfterDate: 1656246931,
        OwnerId: nil,
        Currency: 'EUR',
        MinBalanceAmount: 1,
        MinBalanceCurrency: 'EUR',
        MaxBalanceAmount: 1000000,
        MaxBalanceCurrency: 'EUR'
      },
      Columns: [
        'Id',
        'Tag',
        'CreationDate',
        'Owners',
        'Description',
        'BalanceAmount',
        'BalanceCurrency',
        'Currency',
        'FundsType'
      ]

  }

  createWalletsReport(myReport)  
  ```

  ```python Python expandable theme={null}
  from pprint import pprint
  import mangopay

  mangopay.client_id='your-client-id'
  mangopay.apikey='your-api-key'

  from mangopay.api import APIRequest
  handler = APIRequest(sandbox=True)

  from mangopay.resources import ReportWallets
  from mangopay.utils import ReportWalletsFilters

  wallets_report = ReportWallets(
      tag = 'Created using Mangopay Python SDK',
      download_format  = 'CSV',
      callback_url = 'http://example.com',
      sort = 'CreationDate: ASC',
      preview = False,
      filters = ReportWalletsFilters(
          currency = 'GBP',
          min_balance_amount = 1,
          min_balance_currency = 'GBP',
          max_balance_amount = 100000,
          max_balance_currency = 'GBP'
      ),
      columns = [
        'Id',
        'Tag',
        'CreationDate',
        'Owners',
        'Description',
        'BalanceAmount',
        'BalanceCurrency',
        'Currency',
        'FundsType'
      ]
  )

  create_report = wallets_report.create()

  pprint(create_report._data)  
  ```

  ```csharp .NET expandable theme={null}
  using MangoPay.SDK;
  using MangoPay.SDK.Core.Enumerations;
  using MangoPay.SDK.Entities.POST;
  using Newtonsoft.Json;

  class Program
  {
      static async Task Main(string[] args)
      {
          MangoPayApi api = new MangoPayApi();

          api.Config.ClientId = "your-client-id";
          api.Config.ClientPassword = "your-api-key";

          var report = new ReportRequestPostDTO(ReportType.WALLETS) {
              Filters = {
                  MinBalanceAmount = 500,
                  MinBalanceCurrency = CurrencyIso.EUR,
                  MaxBalanceAmount = 50000,
                  MaxBalanceCurrency = CurrencyIso.EUR
              },
              Columns = [
                  "Id",
                  "CreationDate",
                  "Tag",
                  "Owners",
                  "Description",
                  "BalanceAmount",
                  "BalanceCurrency",
                  "Currency",
                  "FundsType",
              ],
              CallbackURL = "http://example.com",
              Tag = "Created using the Mangopay .NET SDK"
          };
          

          var createReport = await api.Reports.CreateAsync(report);

          string prettyPrint = JsonConvert.SerializeObject(createReport, Formatting.Indented);
          Console.WriteLine(prettyPrint);
      }
  }
  ```
</RequestExample>
