Available Shares

Is there a way to query the number of shares a specific position which are available to sell (i.e. not already covered by a separate sell order)? If I try to sell shares which are already covered by a sell limit order, than I get an insufficient quantity error and it states the number of shares “available”, but I would like to be able to query that value instead. Thanks,