Custom Reports

Custom Reports let you export data from saved queries in the Pay-i Dashboard. You can build a query once in the Query Builder, save it, and then call the Reports API to retrieve the results as CSV whenever you need them.

This is useful for scheduled exports, integrations with external analytics tools, and any workflow where you want to pull Pay-i data programmatically.

Creating a Report

Open the Pay-i Dashboard and navigate to the desired application.

  1. Open to the Query Builder page from the left nav pane.
    1. This page lets you configure pivots and value fields to generate raw, exportable reports for a selected period of time.
  2. In order to programmatically export a report, you need to first create a named query. Click the New Query button on the top right.
    1. Named queries are automatically saved as you make changes to the pivots and fields.
    2. You can have any number of saved queries and can modify them at any time.
  3. The saved query appears in the query panel with its UUID. Click the UUID to copy it to your clipboard. You will use this ID in your API calls.

Calling the Reports API

The Reports API returns your saved query results as CSV. Authenticate with the your Pay-i API key header and pass your Report ID in the URL path.

Endpoint

GET https://api.pay-i.com/api/v1/reports/{report_id}

Authentication

HeaderValue
xproxy-api-keyYour Pay-i API key

Query Parameters

Parameter

Required

Description

from

Yes

Start of the date range (ISO 8601 format, e.g. 2024-03-01T00:00:00Z).
The from timestamp is included in the query (all data >= that time is captured).

to

Yes

End of the date range (ISO 8601 format, e.g. 2024-04-01T00:00:00Z).
The to timestamp is excluded from the query (only data < that time is captured).

The above from:to pair would capture all of March.

Example Request

curl -s -H "xproxy-api-key: $PAYI_API_KEY" \
  "https://api.pay-i.com/api/v1/reports/01a4078d-7c98-48b4-9035-5cc3d17c06ca?from=2024-03-01T00:00:00Z&to=2024-03-31T23:59:59Z"

Example Response

The API returns CSV with the column headers determined by the pivot and value fields you selected when building the query.

Day,Category,Spend
2024-03-01T00:00:00Z,system.openai,142.87
2024-03-01T00:00:00Z,system.anthropic,89.23
2024-03-02T00:00:00Z,system.openai,156.41
2024-03-02T00:00:00Z,system.anthropic,92.10
...