## Run Ad-hoc Query

**post** `/print-mail/v1/reports/samples`

Run an ad-hoc SQL query against your data lake and get a sample of the results.
This is useful for quickly testing queries without saving them as a report.
The query execution time and result size are limited.

### Body Parameters

- `sqlQuery: string`

  The SQL query to execute for the sample.

- `limit: optional number`

  Maximum number of rows to return in the sample.

- `params: optional array of string`

  Optional parameters to bind to the SQL query (e.g., for placeholders like ? or $1).

### Returns

- `ReportSample object { id, records, report }`

  Represents the result of a report sample query.

  - `id: string`

    Unique identifier for the sample query result.

  - `records: array of map[unknown]`

    The actual data records returned by the sample query.

  - `report: string`

    The ID of the report this sample was generated from, or null for ad-hoc samples.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/reports/samples \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY" \
    -d '{
          "sqlQuery": "sqlQuery"
        }'
```

#### Response

```json
{
  "id": "sample_abc",
  "report": "report_123",
  "records": [
    {
      "id": "order_1"
    },
    {
      "id": "order_2"
    }
  ]
}
```
