In case you're using API, it's not possible to add a surcharge, it can only be done if you're using a plugin.
In particular, it's necessary to add the surcharge on your own rates shown after making the Get Rates API call (therefore, in the Get Rates response).