# POST /api/v1/bills/payment-suggestions/trigger

> Trigger bill payment matching

- **Tag:** bills
- **Operation ID:** `trigger_bill_payment_matching_api_v1_bills_payment_suggestions_trigger_post`

## Description

Run the AP matching engine to find bank transactions that match open bills.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `TriggerBillMatchingRequest`

- `min_confidence` (number) — Minimum confidence threshold (0.0–1.0)
- `auto_match` (boolean) — If true, automatically accept high-confidence matches (>= 0.85)
- `bill_ids` (array · string) — Limit matching to specific bill UUIDs

## Responses

### 201 — Successful Response

Schema: `TriggerBillMatchingResponse`

- `suggestions_created` (integer) — New suggestions created
- `auto_linked` (integer) — Auto-accepted high-confidence matches
- `total_candidates` (integer) — Total candidates evaluated

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/bills/payment-suggestions/trigger' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "min_confidence": 0,
  "auto_match": false,
  "bill_ids": []
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/bills/payment-suggestions/trigger', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "min_confidence": 0,
  "auto_match": false,
  "bill_ids": []
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "min_confidence": 0,
  "auto_match": false,
  "bill_ids": []
}

response = httpx.post("https://api.ondayzero.com/api/v1/bills/payment-suggestions/trigger", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/bills/trigger-bill-payment-matching
- OpenAPI slice: https://www.ondayzero.com/docs/reference/bills/trigger-bill-payment-matching/openapi.json
- Other endpoints in **bills**: https://www.ondayzero.com/docs/reference/bills
