# POST /api/v1/bills/{bill_id}/resolve-approval

> Force-resolve a stuck pending-approval bill

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

## Description

Manually drive a bill that is wedged in 'pending_approval' to a terminal state when the normal Approve/Reject card is unavailable (the approval run never started, crashed before suspending, or suspended on a gate with no approvers). Cancels any in-flight approval run for the bill, then either approves it to 'received' (posting the journal entry) or rejects it to 'canceled'.

## Authentication

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

## Parameters

- `bill_id` (path, string, required)

## Request body

Schema: `ResolvePendingApprovalRequest`

- `action` (string · required) (one of: approve, reject) — 'approve' posts the bill to 'received'; 'reject' moves it to 'canceled'.
- `ledger_id` (string) — Expense ledger to debit when approving. Required unless the bill carries a persisted multi-account split. Ignored for 'reject'.
- `reason` (string) — Optional reason captured in the audit trail when rejecting.

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_BillResponse_`

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

### 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 POST 'https://api.ondayzero.com/api/v1/bills/{bill_id}/resolve-approval' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "action": "approve"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/bills/{bill_id}/resolve-approval', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "action": "approve"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "action": "approve"
}

response = httpx.post("https://api.ondayzero.com/api/v1/bills/{bill_id}/resolve-approval", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/bills/resolve-pending-approval
- OpenAPI slice: https://www.ondayzero.com/docs/reference/bills/resolve-pending-approval/openapi.json
- Other endpoints in **bills**: https://www.ondayzero.com/docs/reference/bills
