# Warehouse Transfer

> Base URL: `https://pos.pages.fm/api/v1`. Authenticate with the `api_key` query parameter.

## List of warehouse transfers

`GET /shops/{SHOP_ID}/transfers`

Get list of warehouse transfers

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Shop ID |
| `page` | query | integer |  | Page number |
| `page_size` | query | integer |  | Page size |
| `status` | query | integer |  | Status Values: `0` Waiting for pick up, `1` Shipping, `2` Completed. |
| `startDate` | query | integer |  | Start date |
| `endDate` | query | integer |  | End date |

### Responses

- `200` Success (object)

```json
{
  "success": true,
  "data": [
    {
      "id": "5c9ef4a6-2411-4d5f-9a91-1bc22dbb7eb1",
      "display_id": 309,
      "status": 0,
      "from_warehouse_id": "c52e67ad-d9d0-4276-abe4-e0c9f1f7d2da",
      "from_warehouse_name": "Kho HCM",
      "to_warehouse_id": "229102e4-39c3-4523-bd57-4ed0a45a85ba",
      "to_warehouse_name": "Cho tao cơm",
      "total_quantity": 1,
      "shipping_fee": 30000,
      "note": "Chuyển kho bán hàng",
      "items": [
        {
          "id": "f80bdc16-a000-4bf1-a979-c3fd4033f551",
          "variation_id": "3b11fb7b-9081-42c0-9546-dfac62b9c9ca",
          "quantity": 3,
          "product_display_id": "áo nam",
          "product_name": "áo nam",
          "variation_display_id": "XANH-M",
          "variation_fields": [
            {
              "id": "beb75502-5a50-48d6-bed8-89ea8ddc9a66",
              "name": "màu",
              "value": "xanh dương",
              "keyValue": "xanh dương"
            },
            {
              "id": "8eee6f85-0a76-46da-9dd7-6668bc6d8729",
              "name": "size",
              "value": "M",
              "keyValue": "M"
            }
          ]
        }
      ],
      "images": [
        "https://content.pancake.vn/user-content-dev2.pancake.vn/2022/7/7/eb376f0bf90f47d25396d49e4d547700f182981b.jpg"
      ],
      "shop_id": 20,
      "creator_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "inserted_at": "2023-09-13T09:34:37Z",
      "updated_status_at": "2023-09-13T09:34:37Z"
    }
  ]
}
```

## Create warehouse transfer

`POST /shops/{SHOP_ID}/transfers/multi`

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Shop ID |

### Request body

Request body containing warehouse transfer information to create

- `transfer` (object, required): 
  - `from_warehouse_id` (string, required): From warehouse ID
  - `to_warehouse_ids` (string[], required): To warehouse IDs
  - `shipping_fee` (integer): Shipping fee
  - `note` (string): Note
  - `images` (string (uri)[]): Transfer images
  - `inserted_at` (string (date-time)): Inserted at
  - `items` (object[], required): List of products

```json
{
  "transfer": {
    "from_warehouse_id": "c52e67ad-d9d0-4276-abe4-e0c9f1f7d2da",
    "to_warehouse_ids": [
      "229102e4-39c3-4523-bd57-4ed0a45a85ba"
    ],
    "shipping_fee": 20000,
    "items": [
      {
        "quantity": 1,
        "variation_id": "20e7d183-c70c-445e-8ce2-4d7e3a378e34"
      }
    ],
    "note": "đây là ghi chú",
    "images": [
      "https://content.pancake.vn/user-content-dev2.pancake.vn/2022/5/27/ee3be79d1574735ed35539ca48f7f6e9d7137706.jpg"
    ],
    "inserted_at": "2025-03-11T09:24:42"
  }
}
```

### Responses

- `200` Success (object)

```json
{
  "success": true
}
```

## Get warehouse transfer

`GET /shops/{SHOP_ID}/transfers/{TRANSFER_ID}`

Get one warehouse transfer by ID or display ID, in the same shape as an item of the warehouse transfer list. A transfer is visible when the caller can view transfers in its source or destination warehouse; otherwise it is reported as not found.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Shop ID |
| `TRANSFER_ID` | path | string | yes | Warehouse transfer ID (UUID) or display ID |

### Responses

- `200` Success (object)
- `404` The warehouse transfer does not exist or is not visible to the caller (ErrorResponse)

```json
{
  "success": true,
  "data": {
    "id": "5c9ef4a6-2411-4d5f-9a91-1bc22dbb7eb1",
    "display_id": 309,
    "status": 0,
    "from_warehouse_id": "c52e67ad-d9d0-4276-abe4-e0c9f1f7d2da",
    "from_warehouse_name": "Kho HCM",
    "to_warehouse_id": "229102e4-39c3-4523-bd57-4ed0a45a85ba",
    "to_warehouse_name": "Cho tao cơm",
    "total_quantity": 1,
    "shipping_fee": 30000,
    "note": "Chuyển kho bán hàng",
    "items": [
      {
        "id": "f80bdc16-a000-4bf1-a979-c3fd4033f551",
        "variation_id": "3b11fb7b-9081-42c0-9546-dfac62b9c9ca",
        "quantity": 3,
        "product_display_id": "áo nam",
        "product_name": "áo nam",
        "variation_display_id": "XANH-M",
        "variation_fields": [
          {
            "id": "beb75502-5a50-48d6-bed8-89ea8ddc9a66",
            "name": "màu",
            "value": "xanh dương",
            "keyValue": "xanh dương"
          },
          {
            "id": "8eee6f85-0a76-46da-9dd7-6668bc6d8729",
            "name": "size",
            "value": "M",
            "keyValue": "M"
          }
        ]
      }
    ],
    "images": [
      "https://content.pancake.vn/user-content-dev2.pancake.vn/2022/7/7/eb376f0bf90f47d25396d49e4d547700f182981b.jpg"
    ],
    "shop_id": 20,
    "creator_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "inserted_at": "2023-09-13T09:34:37Z",
    "updated_status_at": "2023-09-13T09:34:37Z"
  }
}
```

## Update warehouse transfer

`PUT /shops/{SHOP_ID}/transfers/{TRANSFER_ID}`

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Shop ID |
| `TRANSFER_ID` | path | string | yes | Transfer ID |

### Request body

Request body containing warehouse transfer information to update

- `transfer` (object, required): 
  - `status` (integer, required): Status Values: `0` Waiting for pick up, `1` Shipping, `2` Completed.
  - `from_warehouse_id` (string, required): From warehouse ID
  - `shipping_fee` (integer): Shipping fee
  - `note` (string): Note
  - `images` (string (uri)[]): Transfer images
  - `inserted_at` (string (date-time)): Inserted at
  - `change_inserted_at` (boolean): Change creation time
  - `items` (object[]): List of products

```json
{
  "transfer": {
    "status": 1,
    "from_warehouse_id": "c52e67ad-d9d0-4276-abe4-e0c9f1f7d2da",
    "shipping_fee": 10000,
    "items": [
      {
        "variation_id": "51bb0bb7-77e9-407e-9f57-5072a0236cb4",
        "quantity": 1
      }
    ],
    "note": "Chuyển kho bán hàng",
    "images": [
      "https://content.pancake.vn/user-content-dev2.pancake.vn/2024/8/30/7886ccd76d3629808d21fa3e59849c8e79a28162.png"
    ],
    "inserted_at": "2025-03-11T09:24:42",
    "change_inserted_at": true
  }
}
```

### Responses

- `200` Success (object)

```json
{
  "success": true
}
```

## History of warehouse transfer status updates

`GET /shops/{SHOP_ID}/transfers/get_status_history/{TRANSFER_ID}`

Get history of warehouse transfer status updates

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Shop ID |
| `TRANSFER_ID` | path | string | yes | Transfer ID |

### Responses

- `200` Success (object)

```json
{
  "success": true,
  "data": [
    {
      "id": "4c961f28-9a1c-11f0-9d68-0242ac1a000a",
      "old_status": 0,
      "status": 1,
      "transfer_id": "ed386c72-ba0c-4b2a-85dd-c8b1903badc2",
      "updated_at": "2025-09-25T14:31:18Z",
      "user_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "user": {
        "avatar_url": null,
        "fb_id": "377936050731194",
        "name": "Vũ Sơn"
      }
    }
  ]
}
```
