## Create Saved Report

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

Create a new saved report definition. Saved reports are SQL queries that can be executed later to generate
full exports or samples.

If you just want to do ad-hoc queries, you should use the `/reports/samples` endpoint.

### Body Parameters

- `sqlQuery: string`

  The SQL query defining the report.

- `description: optional string`

  An optional user-friendly description for the report.

- `metadata: optional map[string]`

  Optional key-value metadata associated with the report.

### Returns

- `Report object { id, createdAt, live, 5 more }`

  Represents a saved Report definition.

  - `id: string`

    Unique identifier for the report.

  - `createdAt: string`

    Timestamp when the report was created.

  - `live: boolean`

    Indicates if the report is associated with the live or test environment.

  - `object: "report"`

    Always `report`.

    - `"report"`

  - `sqlQuery: string`

    The SQL query defining the report.

  - `updatedAt: string`

    Timestamp when the report was last updated.

  - `description: optional string`

    An optional user-friendly description for the report.

  - `metadata: optional map[string]`

    Optional key-value metadata associated with the report.

### Example

```http
curl https://api.postgrid.com/print-mail/v1/reports \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY" \
    -d '{
          "sqlQuery": "SELECT id, status FROM orders WHERE created_at > ?"
        }'
```

#### Response

```json
{
  "id": "report_123",
  "object": "report",
  "live": false,
  "sqlQuery": "SELECT id, status FROM orders WHERE created_at > ?",
  "description": "Recent Orders",
  "metadata": {
    "team": "Sales"
  },
  "createdAt": "2023-10-27T10:00:00Z",
  "updatedAt": "2023-10-27T10:00:00Z"
}
```
