Creates a transfer of materials or products between storage locations.

```
v1/transfers/add.php
```

## Parameters

| Field | Type | Required | Description |
|---|---|---|---|
| source_storage_id | int | Yes | Storage location items are moved from |
| target_storage_id | int | Yes | Storage location items are moved to |
| materials | array | materials or products | Materials to move: id or sku and amount |
| products | array | materials or products | Products to move: id or sku and amount |
| num | string | No | Number. Default the next one in order |
| date | string | No | Transfer date, YYYY-MM-DD. Default today |
| notes | string | No | Notes |

materials and products line:

| Field | Type | Required | Description |
|---|---|---|---|
| id | int | id or sku | Material or product ID |
| sku | string | id or sku | SKU |
| amount | float | Yes | Quantity, greater than 0 |

Lines are passed in one array only: a transfer moves either materials or products. The transfer type is determined by the filled array.

The storage locations must differ and must store items of the transferred type. A new transfer is created with the status from the **Default status for new transfers** setting.

## Example request

```
{
    "source_storage_id": 3998,
    "target_storage_id": 4001,
    "date": "2026-10-06",
    "products": [
        {
            "id": 512,
            "amount": 5
        },
        {
            "sku": "P-CHAIR-01",
            "amount": 20
        }
    ],
    "notes": "To the Main St store"
}
```

## Example response

```
{
    "success": true,
    "transfer_id": 6967,
    "num": "31",
    "status": 0
}
```

The response returns the ID, number and status code of the new transfer.

## Errors

| Error | Reason |
|---|---|
| No source_storage_id in input | A required field is missing (instead of source_storage_id, the field's name) |
| A transfer moves either materials or products. Create separate transfers | Both materials and products were passed |
| No products or materials in input | No line was passed |
| Products is not an array | products is not an array (same for materials) |
| Line 0 of products must be an object | The line is not an object (instead of 0, the line number) |
| SKU or id not set for product 0 | The line has neither id nor sku |
| Product with id 512 not found | Product not found or deleted (for a SKU: Product with SKU "P-CHAIR-01" not found) |
| Amount must be greater than 0 for product with id 512 | Quantity is not a number or not above 0 after rounding |
| Storage ID is not set | A storage location equal to 0 or empty |
| Storage ID not found | Storage location not found or deleted |
| Source and target storage locations must be different | The same storage location was passed |
| Storage location 4001 does not store products | The storage location does not store items of this type (for materials: does not store materials) |
| Date is not a valid date in format YYYY-MM-DD | Invalid date format |
