You can specialize a node in a specific type using the specialize-type action.
This means that after the node creation, you need to use the ActionService exposed by the Web Services API of Alfresco.
Using the ActionService you can execute an action named "specialize-type".
Notice that you can specialize only in one direction for types.
This means that if you have a type customType1 that is defined with cm:content as parent, and a customType2 that has customType1 as parent, you can only specialize in the following direction:
cm:content -> customType1 -> customType2
But you can't specialize in the opposite direction, you can't return to the parent whenever you have a node specialized, you can only specialize in the children type direction.
Hope this helps.