I'm new to node-red. So, as we wanted to build gateway sdk can we build that by using node-red.
To answer that question requires you to provide more information on what you are trying to achieve. How are you proposing to communicate with the device and what sort of API do you mean? Where will node red run?
node red will run on gateway and aggregates the data and transforms it and sends to iothub. It has to connect to devices which will have different protocol like mqtt,coap,bacnet etc.
In principle then the answer is yes. What aspect did you think node red might not be able to do?
Node-RED can connect to a MQTT-broker which other devices can also connect to.