# DELETE /api/v1/transactions/by-date-range

> Delete transactions by date range

- **Tag:** transactions
- **Operation ID:** `delete_transactions_by_date_range_api_v1_transactions_by_date_range_delete`

## Description

Permanently delete every transaction for the current business whose date falls between ``start_date`` and ``end_date`` (inclusive). Journal entries that become orphaned are deleted along with their line entries, and for businesses still backed by the legacy Teal engine the matching Teal transactions and journal entries are removed remotely as well. This action is irreversible.

## Authentication

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

## Parameters

- `start_date` (query, string · date, required) — Inclusive start date (YYYY-MM-DD). Transactions on or after this date are deleted.
- `end_date` (query, string · date, required) — Inclusive end date (YYYY-MM-DD). Transactions on or before this date are deleted.
- `ledger_id` (query, string, optional) — Optional ledger ID to restrict the deletion to a single bank account.

## Responses

### 200 — Successful Response

Schema: `SuccessEnvelope_TransactionDateRangeDeleteResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (TransactionDateRangeDeleteResponse)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 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 DELETE 'https://api.ondayzero.com/api/v1/transactions/by-date-range' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/transactions/by-date-range', {
  method: 'DELETE',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
  },
});
const data = await response.json();
```

### Python

```python
import httpx

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

response = httpx.delete("https://api.ondayzero.com/api/v1/transactions/by-date-range", headers=headers)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/transactions/delete-transactions-by-date-range
- OpenAPI slice: https://www.ondayzero.com/docs/reference/transactions/delete-transactions-by-date-range/openapi.json
- Other endpoints in **transactions**: https://www.ondayzero.com/docs/reference/transactions
