Today it is possible to create Supplier Invoices with the connected Purchase Receipt lines via API. However, if the Purchase Receipt line was already attached to another invoice the API will return an error like "The PO Receipt Line with order number 005092 and line number 136 doesn't exist in the look-up table".
This problem does not exist in the client because you add Purchase Receipt lines to the invoices via the look-up table view and only Purchase Receipt lines that are possible to use are shown there.
There is no way to make such look-up via API.
Either to expose the look-up table in the API or perhaps to introduce a new field on the Purchase Receipt lines like "Non Invoice Quantity" or similar so it is possible to see that the Purchase Receipt line is already used anywhere else or not.