How to sell an option against a long one in the account?

To sell an option against a long option already in a margin type account simply create a sell order and if the account has enough available funds to meet any change in the account's margin requirements the order is accepted. The short option will automatically be margined with other options on the same underlying. 

In terms of selling the same option contract IBKR does not allow clients to simultaneously maintain both a long and short position in a given instrument in the same account and all positions are netted.

Powered by IBot
How do I sell a stock short?
Is it possible to disable naked short selling as a precaution?
Where do I mark my order as a Sell to Close?