---
search:
  tags:
    - Returns
    - POST
seo:
  description: >-
    Any signed in user. Restocks units, records the RETURN movement, and raises
    the credit… Reference for the POST /api/v1/returns endpoint in the
    PharmaFlow API.
sidebar:
  label: Create a return
  badge: POST
title: Create a return
type: openapi-operation
---
Any signed in user. Restocks units, records the RETURN movement, and raises the credit note. A sale from another branch gets 403, and returning more units than a line has left gets 400.

`POST /api/v1/returns`

**Request body** (`application/json`, required)

- `sale_id` (string, required)
- `items` (object[], required)
- `reason` (string)
- `client_mutation_id` (string)
- `device_id` (string | null)

Request body example:

```json
{
  "sale_id": "string",
  "items": [
    {
      "sale_item_id": "string",
      "quantity": 0,
      "restockable": true,
      "reason": "string"
    }
  ],
  "reason": "string",
  "client_mutation_id": "string",
  "device_id": "string"
}
```

**Responses**

- `201` — Return processed
- `400` — sale\_id is missing, no items were supplied, a line is not on this sale, a line quantity is not positive, or a line asks for more than its returnable quantity
- `401` — Not authenticated
- `403` — Sale belongs to a different branch
- `404` — Sale not found

Response example, 201:

```json
{
  "return_id": "string",
  "credit_note_number": "string",
  "total_refund": "string",
  "items_returned": -9007199254740991,
  "created_at": "string"
}
```
