Skip to content

QueryReport

Generates a query report now and returns its rows as JSON, or the report file in the report’s format. Another system uses it to fetch report data when it needs it, instead of receiving the report by email, FTP or API post. For a subscription of an advanced report, use AdvReport.

Only a report with API Access set to Yes can be fetched. The report’s page shows the setting; TrakIT Support sets it. To set a report up for the API, see Fetch a report through the API.

How to send the key and read the response: API keys, Responses.

GET /api/public/QueryReport?APIKey=your-api-key&RepID=your-report-id&Params=2026-10-01;2026-10-31&AsFile=false

Send the key in the APIKey query string parameter. The key must be allowed to get query reports (qrep.getreport); TrakIT Support sets this up. URL-encode every value. The key is part of the address, so keep these URLs out of logs you share.

Parameter Required Meaning
APIKey Yes The API key.
RepID Yes The report’s ID, in the coded form TrakIT uses in its addresses: the part after qrep- in the address of the report’s page. TrakIT Support can also give it to you with the key. The coded ID looks different each time the page opens; any of them works.
Params No New values for the report’s parameters, separated by ;: one value for each parameter, in the order of the report’s Parameters tab. Leave it out to run the report with the values it already has.
AsFile No true to get the report file, false to get the rows as JSON. The default is false.

APIKey and RepID must be in the query string: without one, TrakIT answers HTTP 404.

When you send Params, TrakIT checks each value against its parameter, saves the values that changed as the report’s parameter values, then generates the report. Each value must suit the parameter, as on the report’s Parameters tab:

  • a number parameter takes a number of up to 18 characters;
  • a date parameter takes a date: send it as yyyy-MM-dd (see Dates and times);
  • a parameter with a list takes one of the list’s items, written exactly as in the list;
  • any value has up to 500 characters, with no text that looks like HTML.
Rule Info when it fails
APIKey is not empty. API Key is missing
The key is active and allowed to get query reports. Key is disabled, not recognized or permission denied
RepID is not empty. RepID is missing
RepID is a report ID. Invalid RepID
The report exists. Empty, with Code 0
The report has API Access. Report not enabled for API access
Params has one value for each of the report’s parameters. Parameters passed do not match the number of parameters in the report
A number parameter gets a number of up to 18 characters. Params ... must be numeric, Params ... value too big, with the parameter’s position, for example Params 2 must be numeric
A date parameter gets a date. Params ... is invalid Date
A parameter with a list gets one of its items. Params ... value does not belongs to the allowed list
A value has up to 500 characters and no text that looks like HTML. Query Parameters followed by Value cannot exceed 500 characters or Value contains possible html tags or disallowed text
The report is not being generated already, by a user, a scheduled send or another call. Report generation is already in progress (started ...). Please try again shortly.
The report’s query returns rows, or the report has Generate Empty Report on. Nothing to export

If the report’s query fails, Code is -1.

The response depends on AsFile. In both cases, a refused or failed request gets the usual JSON envelope, with Code 0 or -1 and the reason in Info.

Without AsFile, or with AsFile=false, a successful response is not the envelope: it is the list of rows itself, one object per row, named by the report’s columns. Test whether the response is a list or an object before you read it.

[
{
"JobRef": "EXL-2610-0042",
"Customer": "Example Shipping Co",
"Containers": 3,
"LastEventDate": "2026-10-19T14:20:00"
},
{
"JobRef": "EXL-2610-0043",
"Customer": "Example Logistics Ltd",
"Containers": 1,
"LastEventDate": null
}
]
  • The columns and their names are those of the report: ask whoever set the report up.
  • Values come as the query returns them, without the number and date formats of the report’s file. Dates have no time zone: see Dates and times.
  • A report with several tables returns its first table only. Use AsFile=true to get them all.
  • With Generate Empty Report on and no rows, the list is empty.

With AsFile=true, a successful response is the report file, generated the same way as the report’s Preview. A refusal is JSON, so tell them apart by the Content-Type:

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="Open jobs_2610201430.xlsx"

The file name is the report’s title, then the date and time in UTC as yyMMddHHmm, then the extension of the report’s Report Type:

Report Type File
Comma Separated Values (.csv) .csv
HTML File (.html), HTML In Email .htm, the report as an HTML page
Excel Spreadsheet (.xlsx) .xlsx
Text File (.txt) .txt, with the same content as the CSV file
JSON File (.json) .json: the list of rows, or for a report with several tables, one object per table, with its title and its rows
  • Each call that gets as far as generating the report is listed in the report queue, with API Call as its delivery.
  • The call returns once the report is generated, which takes as long as a preview of the report. Allow for it in your client’s timeout.
  • A report can’t be generated twice at the same time. If your calls may overlap with each other, with a preview or with a scheduled send of the same report, retry after a short wait when you get Report generation is already in progress.