---
search:
  tags:
    - Purchases
    - PUT
seo:
  description: >-
    Admin or pharmacist. Zeroes a batch and records a WRITE_OFF… Reference for
    the PUT /api/v1/purchases/{batchId}/write-off endpoint in the PharmaFlow
    API.
sidebar:
  label: Write off a batch
  badge: PUT
title: Write off a batch
type: openapi-operation
---
Admin or pharmacist. Zeroes a batch and records a WRITE_OFF movement for the units removed. An unknown batch gets 404, and the rest leaves the medicine stock in the same transaction.

`PUT /api/v1/purchases/{batchId}/write-off`

**Responses**

- `200` — Batch written off
- `401` — Not authenticated
- `403` — Access forbidden for this role
- `404` — Batch not found

Response example, 200:

```json
{
  "status": "string",
  "batch_id": "string"
}
```
