Theoretically speaking, if I know programming (C,C++,C# etc.) can I write my own mining pool software/server using only Bitcoin API or I need more information than that?
You can, of course! But you may start from some existing programs that do what you say, most are open source and well documented. And ask someone, it's very hard to do it on your own!
https://github.com/CoiniumServ/CoiniumServ is an open source c# pool implementation which could be a good starting point.