# Link Sales Order to PO (Crossdock)

## Overview

This endpoint can be used to link a sales order to a new or existing purchase order as part of the Dropshipping (Crossdock) workflow.

To consume the endpoint, you must:

- Be an authenticated user.

For information on how you can authenticate, see [Authentication](https://developer.sellercloud.com/dev-article/authentication/).

After you authenticate and receive a valid token, you must pass it to service calls.

## Endpoint

An example of this endpoint for XX server is:

- https://XX.api.sellercloud.com/rest/api/Orders/{orderID}/LinkToPo

For your server, the endpoint will be:

- https://{your_server_id}.api.sellercloud.com/rest/api/Orders/{orderID}/LinkToPo

## Request

- **Method Type:** HttpPost  
- **Authorization:** Use **Bearer Token** + token received from token authentication  
- **Header info:** **Content-Type: application/json**  
- **Path:** valid **ID** of an existing **Sales Order**.

## Request Body

| **Parameter**           | **Data Type**                           | **Description**                                                         | **Required**                          |
|-------------------------|-----------------------------------------|-------------------------------------------------------------------------|--------------------------------------|
| NewPo                   | CompanyID<br>VendorID                 | Determines whether a New PO should be created to link.                 | –                                    |
| CompanyID               | integer                                 | Company of the PO being created.                                       | yes – if creating a new PO          |
| VendorID                | integer                                 | Vendor for the PO being created.                                       | yes – if creating a new PO          |
| ExistingPo              | PoID                                   | Determines whether you are linking the order to an existing PO.       | –                                    |
| PoID                    | integer                                 | The ID of the existing PO you are linking the order to.               | yes – if linking to an existing PO   |
| Items                   | OrderItemID<br>QtyForPo<br>BundleItems| Determines which items are being linked (purchased).                 | –                                    |
| OrderItemID            | integer                                 | Specific order item IDs to link. Provide “null” to link whole PO.    | yes – if linking specific items only. |
| QtyForPo               | integer                                 | Provide quantity to link.                                              | yes – if linking specific items only. |
| BundleItems             | ProductID<br>QtyForPo                  | Use when linking Kit Products.                                         | –                                    |
| ProductID              | string                                  | Product ID of the Kit.                                               | yes – if linking kit items.         |
| QtyForPo               | integer                                 | Quantity to link.                                                    | yes – if linking kit items.         |

The request body should be formatted as follows:

```json
{
  "NewPo": {
    "CompanyID": 0,
    "VendorID": 0
  },
  "ExistingPo": {
    "PoID": 0
  },
  "Items": [
    {
      "OrderItemID": 0,
      "QtyForPo": 0,
      "BundleItems": [
        {
          "ProductID": "string",
          "QtyForPo": 0
        }
      ]
    }
  ]
}
```

## Response

- If the user is authenticated and the request is successful, the response is **Status Code 200 => OK**  
- If the user is not authenticated, the response is **Status Code 401 => Invalid Token**  
- In case of an error, the response is **Status Code 500 => Internal Server Error**  
- In case of an incorrect request, the response is **Status Code 400 => Bad Request**
