> For the complete documentation index, see [llms.txt](https://documentation.connexica.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.connexica.com/api/03.-method-reference.md).

# 03. Method Reference

Parameter details for each `api/v1` method. All calls are `POST /api/v1` with a JSON-RPC 2.0 envelope.

## QUERIES.EXECUTE

Executes a search query and returns paginated rows.

| Field           | Type      | Required    | Description                                                                           |
| --------------- | --------- | ----------- | ------------------------------------------------------------------------------------- |
| `index`         | string    | Yes         | Index (query engine) name                                                             |
| `query`         | string    | Yes         | Query text; blank defaults to `""`                                                    |
| `page`          | integer   | No          | Page number, >= 1 (default 1)                                                         |
| `pageSize`      | integer   | No          | 1–1000 (default 25)                                                                   |
| `displayFields` | string\[] | No          | Accepted but currently not applied — the index's default display-field layout is used |
| `sort`          | object\[] | No          | `{field, direction}` entries; `direction` is `asc` or `desc`                          |
| `saveReport`    | boolean   | No          | Save as a Query report (requires `reports:write`)                                     |
| `reportName`    | string    | When saving | Non-blank report name                                                                 |
| `folder`        | string    | No          | Folder GUID or unique folder name                                                     |
| `overwrite`     | boolean   | No          | Replace a same-name report in the folder                                              |

Result: `data.hits`, `data.headers`, `data.rows`; `meta.page`, `meta.pageSize`. When saved, `data.savedReport` contains `guid`, `name`, `type`, `folderGuid`, `overwritten`.

## INDEXES.FIND

Searches the indexes (query engines) available to the user, ordered by display name.

| Field        | Type   | Required | Description                                                                       |
| ------------ | ------ | -------- | --------------------------------------------------------------------------------- |
| `searchText` | string | No       | Free-text filter over index names/descriptions                                    |
| `cursor`     | string | No       | Continuation cursor from `meta.nextCursor`; reuse only with the same `searchText` |

Result: `data.indexes[]` with:

* `indexGuid` — the index name used in `QUERIES.EXECUTE` / `CROSSTAB.EXECUTE`
* `displayName`, `description`
* `displayFields[]` — `name`, `display` (label), `type` (`STRING`, `INTEGER`, `DECIMAL`, `TIME`, `DATE`, `DATETIME`), optional `format`
* `searchEngines[]`
* `dynamicViews[]` — the distinct-count views available on the index. `"Records"` is always present and is the default record count; the remaining names are dynamic views configured on the index. Pass one as `totals[].dynamicView` in `CROSSTAB.EXECUTE` to report a distinct count.

`meta.total` is the matching count; `meta.pageSize` is the server's configured rows-per-page. Follow `meta.nextCursor` for more; its absence means the list is complete.

## CROSSTAB.EXECUTE

Executes a crosstab query. Returns an HTML table by default, or a base64-encoded PNG chart when `chartType` is supplied.

| Field                                                                                                                                                                                                                                           | Type      | Required | Description                                                    |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------- | -------------------------------------------------------------- |
| `index`                                                                                                                                                                                                                                         | string    | Yes      | Index name                                                     |
| `query`                                                                                                                                                                                                                                         | string    | Yes      | Query text; blank defaults to `""`                             |
| `rows`                                                                                                                                                                                                                                          | array     | No       | Display-field names, or saved-query/placeholder objects        |
| `columns`                                                                                                                                                                                                                                       | array     | No       | As for `rows`                                                  |
| `totals`                                                                                                                                                                                                                                        | object\[] | No       | Aggregation definitions (default `Count`); supports `RowTotal` |
| `chartType`                                                                                                                                                                                                                                     | string    | No       | FusionCharts type name — returns a chart image                 |
| `width` / `height`                                                                                                                                                                                                                              | integer   | No       | Chart size in pixels (800 × 600)                               |
| `page` / `pageSize`                                                                                                                                                                                                                             | integer   | No       | Pagination (1 / 25, max 1000)                                  |
| `saveReport` / `reportName` / `folder` / `overwrite`                                                                                                                                                                                            | —         | No       | Save as a Crosstab report (requires `reports:write`)           |
| `styleDescription`                                                                                                                                                                                                                              | string    | No       | Free-text description applied to the crosstab/chart style      |
| `styles`                                                                                                                                                                                                                                        | object    | No       | Structured per-component style overrides                       |
| `showRowLabels`, `showColumnLabels`, `rowTotalPosition`, `columnTotalPosition`, `subtotalRows`, `forceSubTotals`, `showHiddenSubTotals`, `showRowNumbers`, `showBorders`, `showOuterBorder`, `hideColumnHeadings`, `wrapHeaders`, `shrinkToFit` | —         | No       | Crosstab display options                                       |

### Row and column objects

Each `rows`/`columns` entry is a display-field name or an object supporting `field`, `queries[]` (saved queries/placeholders; `savedQueries` and `placeholders` are accepted aliases), `reverse`, `label`, `locked`, `collapseToDropList` (rows only), `useDescription`, `evaluateCalc`, `alwaysOpen`. A `queries` entry takes `guid`, `name`, and `placeholder`.

### Totals

`totals[].aggregationType`: `Count`, `Sum`, `Average`, `Minimum`, `Maximum`, `Median`, `LowerQuartile`, `UpperQuartile`, `Mode`, `StdDev`, `StringCalculation`, `Calculation` (cell calculation), or `RowTotal`.

* `field` is required except for `Count`, `Calculation` and `RowTotal`; `__CALCULATION__` aggregates an `expression`'s value.
* `expression` is required for `Calculation` and `__CALCULATION__` fields.
* `dynamicView` selects a distinct-count dynamic view for the total; omit or leave blank for the default `Records` count. Valid names come from `INDEXES.FIND` `dynamicViews[]`; an unrecognised name fails with `Unknown distinctCount`.
* Optional presentation fields: `name`, `format`, `display`, `prefix`, `suffix`, `tooltip`, `showNullAs`, `hideRowTotal`, `hideTotalInTable`, `suppressRowTotal`, `suppressColumnTotal`, `rowSort`, `columnSort`, `filter`, `threshold`, `thresholds`, `conditionalFormatting`.
* `RowTotal` totals take `rowTotals[]` entries with `row` (label or `"*"`), `expression`, and optional `format`, `display`, `prefix`, `suffix`, `tooltip`, `threshold`, `conditionalFormatting`.

### `styles` object

Keys are style component names (e.g. `TABLE`, `HEADER`, `FOOTER`, `CELLEVEN`, `CELLODD`, `EVENROWS`, `ODDROWS`, `COLUMNHEADING`, `ROWHEADING`, `TOTALS`, `SUBTOTALS`, `GRANDTOTAL`, `CHART`, `CHARTVALUES`). Values support `backgroundColour`, `colour`, `borderColour`, `font`, `textAlign`, `chartTheme`, `fontSize`, `size`, `bold`, `italic`, `underline`, `useDefaultColours`, and `datasets` (chart only).

Result: `data.contentType` (`text/html;charset=<charset>` or `image/png`) and `data.data` (HTML string or base64 PNG); `data.savedReport` when saved.

## REPORTS.FIND

Searches saved reports accessible to the user.

| Field    | Type      | Required | Description                                                                                |
| -------- | --------- | -------- | ------------------------------------------------------------------------------------------ |
| `search` | string    | No       | Free-text search over report names/descriptions                                            |
| `types`  | string\[] | No       | Report types to include: `query`, `crosstab`, `pages`; intersected with the user's licence |
| `cursor` | string    | No       | Accepted but not used                                                                      |

Result: `data.reports[]` — a flat list with `id`, `name`, `folder` (relative folder path), `description`, `type`.

## REPORTS.METADATA

Loads a saved report's executable metadata by GUID — enough to reconstruct an equivalent `QUERIES.EXECUTE` or `CROSSTAB.EXECUTE` request. Reports in the Recycle Bin, or reports the user cannot read, are returned as errors.

| Field  | Type   | Required | Description       |
| ------ | ------ | -------- | ----------------- |
| `guid` | string | Yes      | Saved report GUID |

Result `data` always contains `query` and `queryengine`, plus:

* `formfields[]` when the report has active form fields — `guid`, `caption`, `type` (`text`, `droplist`, `check`, `daterange`, …) and `value`, `values`, or `low`/`high`
* `query` reports: `displayFields[]`, `sort` (`[{displayField, direction}]`)
* `crosstab` reports: `rows`, `columns` (`[{field, reverse}]`), `totals` (`[{aggregationType, field, expression, name}]`), and `chartType`, `width`, `height` when the report renders as a chart
