APG PayAPG Paydocs

Reporting

Create report exports

POST/report-exports

Export a question's whole answer. The answer is the file, and nothing is stored.

Permissions

Required permission
reports:query

Requires the `query` action on `reports` for the supplied runtime context

Request body

This body is a tagged shape: type is always "RexpCmdRun". Send it; more variants can be added, and a caller that switches on it keeps working when they are.

Discriminated by type
type = "RexpCmdRun"

Ask a dataset a question. With measures, the answer is one row per combination of the dimensions and time buckets; with none, it is one row per record, in the dataset's row columns.

curl -X POST https://api.tst.au.apgpay.dev/report-exports \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "RexpCmdRun",
  "question": {
    "type": "RqryCmdRun",
    "reportDatasetId": "string",
    "measures": [
      "string"
    ],
    "dimensions": [
      "string"
    ],
    "time": {
      "type": "RqryTimeSliceAttributes",
      "grain": "string",
      "range": {
        "type": "RqryRangeBetween",
        "from": "2026-08-19",
        "to": "2026-08-19"
      },
      "compare": "PreviousPeriod"
    },
    "filters": [
      {
        "type": "RqryFilterAbove",
        "dimension": "string",
        "value": "string"
      }
    ],
    "sort": [
      {
        "type": "RqrySortDimension",
        "dimension": "string",
        "ascending": true
      }
    ],
    "limit": 25,
    "page": "string",
    "segments": [
      "string"
    ],
    "measureFilters": [
      {
        "type": "RqryMeasureFilterAbove",
        "measure": "string",
        "value": "string"
      }
    ],
    "top": {
      "type": "RqryTopAttributes",
      "dimension": "string",
      "count": 42,
      "measure": "string"
    },
    "narrowTo": {
      "type": "RqryNarrowCustomers",
      "customerIds": [
        "cust_9f2Kd8QpLzXw"
      ]
    },
    "asAt": "2026-08-19T04:21:07Z",
    "pivot": {
      "type": "RqryPivotAttributes",
      "rows": [
        "string"
      ],
      "columns": [
        "string"
      ],
      "subtotals": true
    },
    "timezone": "string"
  }
}'

Responses

The response is a tagged shape: type is always "RexpCreateRspAttributes". Switch on it; subtypes can be added, and a client that already reads it will not break.

Discriminated by type
type = "RexpCreateRspAttributes"

The resource that was created.

Example
{
  "type": "RexpCreateRspAttributes",
  "created": {
    "type": "RexpAttributes",
    "reportDatasetId": "string",
    "columns": [
      {
        "type": "RqryColumnAttributes",
        "role": "Time",
        "name": "Ada Lovelace",
        "grain": "string",
        "axis": "Rows"
      }
    ],
    "rowCount": 42,
    "asOf": "2026-08-19T04:21:07Z",
    "timezone": "string",
    "csv": "string"
  }
}

Error responses