External Reference change using API

Please help me on how to change the external reference using API