---
title: "Preview Alert"
method: POST
path: "/api/alerts/preview"
tags: ["Vehicle Alerts"]
---

# Preview Alert

`POST /api/alerts/preview`

## Request

- Base URL: `https://pegarex.com.br` (the document declares no server; this is the origin it was published from)
- URL: `https://pegarex.com.br/api/alerts/preview`
- Auth: HTTP bearer

How many active listings an unsaved alert draft matches right now.

Lets the form answer "is this alert too narrow?" before it is saved, instead
of leaving someone to find out days later from an inbox that stayed empty.
Deliberately NOT routed through /api/search: that endpoint has its own
location and sort semantics and burns the daily anti-scraping quota, and a
preview that disagrees with the alert is worse than no preview.

A count needs a model — brand-only spans ~200k rows and turns a
keystroke-debounced preview into a multi-second query.

## Request body

- VehicleAlertRequest
  - `brand` string, nullable
  - `model` string, nullable
  - `version` string, nullable
  - `brand_id` integer, nullable
  - `model_id` integer, nullable
  - `version_id` integer, nullable
  - `min_year` integer, nullable
  - `max_year` integer, nullable
  - `min_price` number, nullable
  - `max_price` number, nullable
  - `fuel_type` union
    - string
    - string[]
  - `transmission` union
    - string
    - string[]
  - `mileage_min` integer, nullable
  - `mileage_max` integer, nullable
  - `location` string, nullable
  - `category` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/pegarex/apis/pegarex-api.md) · [All operations](https://skmtc.dev/pegarex/apis/pegarex-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pegarex/apis/pegarex-api/revisions/8c789c9bd72d?raw)
