If you rely on one of the available strategies, the stock line items creation and management is automatic:
If an order is not split, the stock line items correspond to all the SKUs in the order.
If the order is split, the line items are split into more than one shipment. A single line item can also be split into more than one stock line item.
Manual stock line items management
You can always create new stock items and modify or update existing ones (using an integration application), as long as the stock item quantity you choose is available for the involved product in one of the inventory stock locations belonging to the inventory model associated with the related order's market. Since the relationship with the line item is optional when creating a stock line item, you're free to create a stock line item associated with a shipment that involves a product that originally wasn't part of the order (e.g. sending an additional product as a free gift, replacing an unavailable product with another one, etc.). When you delete an existing stock line item the related stock reservation is removed and the corresponding stock is automatically released.
The available quantity validation is performed only if the stock line item is associated with a stock item (e.g. you can choose to add as free gift a do_not_trackSKU with no constraint on the stock).
When you manually manage stock line items, make sure to consistently update the related stock. To do that, you can leverage some specific trigger attributes exposed at the shipment level or (if you need more granular control on the process) on each single stock line item.
Check the related ER diagram and explore the flowchart that illustrates how the stock line item resource relates to the other API entities.
Check the related guide to learn more about the available inventory model strategies, how they work, and how stock line items are managed based on each of them.