I do not think you should do this as an API page. It will be easier with a codeunit that you publish as web service through the web service page.
That codeunit can take two or more parameters where parameter one can be the action you want to execute and the second one a list of companies you want to execute the action for.
I created a very simple example here. You could feed this codeunit with a json dataset with all the companies you want to process and it can return a json dataset with all the company registration numbers.
I did not put in the json pharsing, So you can't use it directly.
codeunit 50100 MyApi
{
procedure preformaction(ActionType : Integer;CompanyList :Text) myText: Text[1024];
var
CompanyInfo : Record "Company Information";
begin
foreach companyName in companylist do begin
//loop through all the companies in the company list
CompanyInfo.ChangeCompany('CompanyName');
CompanyInfo.findset(false,false);
myText = CompanyInfo."Registration No.";
end;
end;
}