> For the complete documentation index, see [llms.txt](https://docs.xorosoft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xorosoft.com/developers-api/purchase-order-management/create-sales-order-purchase-order-links.md).

# Create Sales Order-Purchase Order Links

The Link Orders API is used to create, update, or delete links between Sales Orders (SO) and Purchase Orders (PO).

* **To create or update** a link: send SO/PO line IDs with a non-zero quantity.
* **To delete** a link: set the quantity to 0.

| Field      | Data Type | Default Value | Description                                    |
| ---------- | --------- | ------------- | ---------------------------------------------- |
| `SoNumber` | string    | NA            | Sales Order number to be linked..              |
| `PoNumber` | string    | NA            | Purchase Order number to be linked..           |
| `Lines`    | array     | \[]           | List of SO and PO line link mappings.          |
| `SoLineId` | integer   | NA            | Line ID of the Sales Order to be linked.       |
| `PoLineId` | integer   | NA            | Line ID of the Purchase Order to be linked.    |
| `Qty`      | decimal   | 0             | Quantity being linked between SO and PO lines. |

```json
{"openapi":"3.0.3","info":{"title":"Xorosoft ERP Public API","version":"2026.07"},"tags":[{"name":"Purchase Order Management","description":"Use Purchase Order Management APIs to create, import, release, close, link, and retrieve purchase orders. These endpoints support vendor purchasing, dropship workflows, incoming delivery visibility, transfer purchase orders, and sales-order-to-purchase-order linking. They are useful for procurement, supplier portals, 3PL coordination, and integrations that need to keep inbound supply synchronized with Xorosoft ERP."}],"servers":[{"url":"https://res.xorosoft.io","description":"Xorosoft ERP API server"}],"security":[{"basic":[]}],"components":{"securitySchemes":{"basic":{"scheme":"basic","type":"http"}}},"paths":{"/api/xerp/purchaseorder/createsopoorderlinking":{"post":{"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"Data":{"properties":{"ErrorList":{"items":{},"type":"array"},"SuccessList":{"items":{"properties":{"OrderLinkingArr":{"items":{"properties":{"CreateDttm":{"type":"string"},"CreateSource":{"type":"string"},"Id":{"type":"number"},"IsDropshipFlag":{"type":"boolean"},"IsThirdPartyLinking":{"type":"boolean"},"ItemId":{"type":"number"},"ItemNumber":{"type":"string"},"ItemTypeId":{"type":"number"},"LinkedPONumber":{"type":"string"},"LinkedPOQty":{"type":"number"},"LinkedSONumber":{"type":"string"},"LinkedSOQty":{"type":"number"},"PoId":{"type":"number"},"PoLineId":{"type":"number"},"PoOrderedQty":{"type":"number"},"Qty":{"type":"number"},"SoId":{"type":"number"},"SoLineId":{"type":"number"},"SoOrderedQty":{"type":"number"},"SoQtyShipped":{"type":"number"},"StoreId":{"type":"number"},"UomId":{"type":"number","nullable":true}},"type":"object"},"type":"array"},"PoNumber":{"type":"string"},"SoNumber":{"type":"string"}},"type":"object"},"type":"array"}},"type":"object"},"IsForwardRequest":{"type":"boolean"},"Message":{"type":"string"},"MessageTitle":{"type":"string","nullable":true},"Result":{"type":"boolean"}},"type":"object"}}},"description":"OK","headers":{}}},"tags":["Purchase Order Management"],"description":"The Link Orders API is used to create, update, or delete links between Sales Orders (SO) and Purchase Orders (PO).\n\n<ul>\n  <li><strong>To create or update</strong> a link: send SO/PO line IDs with a non-zero quantity.</li>\n  <li><strong>To delete</strong> a link: set the quantity to 0.</li>   \n</ul>\n\nField               |Data Type          |Default Value          |Description\n-------------------|-------------------|-------------------|--------------\n``SoNumber``|string|NA|Sales Order number to be linked..\n``PoNumber``|string|NA|Purchase Order number to be linked..\n``Lines``|array|[]|List of SO and PO line link mappings.\n``SoLineId``|integer|NA|Line ID of the Sales Order to be linked.\n``PoLineId``|integer|NA|Line ID of the Purchase Order to be linked.\n``Qty``|decimal|0|Quantity being linked between SO and PO lines.","operationId":"post_purchaseorder_createsopoorderlinking","requestBody":{"content":{"application/json":{"schema":{"items":{"properties":{"Lines":{"items":{"properties":{"PoLineId":{"type":"number"},"Qty":{"type":"number"},"SoLineId":{"type":"number"}},"type":"object"},"type":"array"},"PoNumber":{"type":"string"},"SoNumber":{"type":"string"}},"type":"object"},"type":"array"}}}},"summary":"Create Sales Order-Purchase Order Links"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.xorosoft.com/developers-api/purchase-order-management/create-sales-order-purchase-order-links.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
