Here is an example of SSJS I have built for this purpose, calling a 3rd party API to unsubscribe, and reactivating subscriber in All Subscribers list:
<script runat="server">
Platform.Load("Core","1.1.1");
//Authorize API Call
var authurl = 'https://example.com/authorization/oauth2/token';
var contentType = 'application/x-www-form-urlencoded';
var payload = 'grant_type=client_credentials';
var accessTokenResult = HTTP.Post(authurl,contentType,payload,["Authorization"],["Basic abcdefghijklmnopqrstuvwxyz=="]);
var accessToken = Platform.Function.ParseJSON(accessTokenResult["Response"][0]).access_token;
Write("AccToken: "+accessToken);
//Data Extension Initialisation and row retrieval + All subscriber List Initialisation
var unsubs = DataExtension.Init("List Unsubscribe Management");
var myList = List.Init("All Subscribers - 264");
var data = unsubs.Rows.Retrieve({Property:"EmailAddress_Master",SimpleOperator:"greaterThan",Value:0});
var datalength = data.length;
var LogDE = DataExtension.Init("Logging");
// Loop and API call to API using all values in 'List Unsubscribe Management'
for (var i = 0 ; i < data.length ; i ++) {
var url = "https://example.com/unsubscribe";
var EmailAddress = data[i].EmailAddress_Master;
var SubscriberKey = data[i].SubscriberKey;
var Tokenvar = data[i].Token;
myList.Subscribers.Update({EmailAddress:EmailAddress,SubscriberKey:SubscriberKey},"Active");
var contentType = 'application/json';
var payload = '{data : { type : "confirmTransaction", attributes: { transactionToken : '+Tokenvar+' }}};';
var headerNames = ["Accept","Authorization","Api-Key","Api-Version"];
var authorizationHeader ="Bearer "+accessToken;
var headerValues = ["application/json",authorizationHeader,"abcdefghijklmnopqrstuvwxyz","1"];
var result = HTTP.Post(url, contentType, payload, headerNames, headerValues, content);
LogDE.Rows.Add({Token:accessTokenvar,Status:result,url:url,contentType:datalength});
}
</script>
You must adapt the endpoints, data extension keys and list IDs - but basically this is the approach you need to take. You will of course need to populate the "List Unsubscribe Management" by querying the Unsubscribe data view, as Cameron Robert also suggests.