Create report

POST {{baseUrl}}/reports

Creates a new report. Reports are scheduled jobs that provide data from the system as downloadable files. Multiple formats are supported.

Scheduled reports

Scheduled reports are configured once and are generated continuously (e.g. every night) for download.

Example: Configuring a nightly balances report every night at 1.15am: ```http-client POST https://api.tangany.com/settlement/reports

{ id: clb_nightly, type: account_balances_v1, parameters: { ledgerId: prod-ledger-1 }, format: csv, schedule: { mode: daily, hour: 1, minute: 15 } } `` Such a report will result in a new file generated every night, which can be then downloaded through theresults` collection.

Results are identified by their scheduled date & time.

GET https://api.tangany.com/settlement/reports/clb_nighlty/results/2022-10-10T01:15Z

200 OK
Content-Type: text/csv
...

accountId,assetId,bookingBalance,availableBalance
109669cc-7c9c-431e,BTC,4.58989506,4.58989506
109669cc-7c9c-431e,ETH,0.00743964,0.00743964
506abd94-75b9-490e,BTC,4.58989506,0
490e-baf5-33cacc5d,DOGE,0.29421583,0.29421583

Reports are generated asynchronously and take some time to generate.

A report won't be available for download until it has completed processing. Therefore it is necessary need to wait up to 15 minutes after the scheduled date for the report completion.

If a report is still in progress, the response will be a 409 Conflict status.

Properties lastCompletedAt lastStartedAt and nextScheduledAt can be used to check the status of a report job.

Non-scheduled reports

It is also possible to run a report without a schedule. In this case the report will be generated just once. You will need to use the returned nextScheduledAt property to identify and download the result.

Example: Creating a balance report: ```http-client POST https://api.tangany.com/settlement/reports

{ id: clb_report-174f46af-eaf0, type: account_balances_v1, parameters: { ledgerId: prod-ledger-1 }, format: json } ```

GET https://api.tangany.com/settlement/reports/clb_report-174f46af-eaf0/results/2023-10-10T12:20Z

200 OK
Content-Type: application/json
...

[
  {
    "accountId": "109669cc-7c9c-431e",
    "balances": {
      "BTC": {
        "availableBalance": "4.58989506",
        "bookedBalance": "4.58989506"
      },
      "ETH": {
        "availableBalance": "0.00743964",
        "bookedBalance": "0.00743964"
      }
    }
  },
  {
    "accountId": "506abd94-75b9-490e",
    "balances": {
      "BTC": {
        "availableBalance": "0",
        "bookedBalance": "4.58989506"
      }
    }
  },
...
]

Available reports:

accountbalancesv1:

  • This report returns the asset balances of all accounts in a ledger at the time of report generation.
  • Required parameters: ledgerId
  • Supported formats: json, csv

Allowed roles: EDITOR

Request Body

{"id"=>"{{$guid}}", "type"=>"account_balances_v1", "parameters"=>{"ledgerId"=>"prod-ledger-1", "date"=>"todayT12:00:00Z"}, "format"=>"csv", "schedule"=>{"mode"=>"daily", "hour"=>1, "minute"=>15}}

HEADERS

KeyDatatypeRequiredDescription
tangany-versionnumber(Required) API version
Content-Typestring
Acceptstring

RESPONSES

status: OK

{"format":"csv","id":"clb_nightly","lastCompletedAt":null,"lastStartedAt":null,"nextScheduledAt":"2023-10-10T01:15:00Z","parameters":{"ledgerId":"prod-ledger-1","date":"todayT12:00:00Z"},"type":"account_balances_v1","schedule":{"mode":"daily","hour":1,"minute":15}}