Deploy your API with public permissions or add Username and Password parametersoptions to URLFetch:
With[{cloudobject = FileNameJoin[{$CloudRootDirectory, "FactorIntegerAPI"}]},
CloudDeploy[
APIFunction[{"x" -> "Integer"}, FactorInteger[#x] &],
cloudobject, Permissions -> "Public"];
URLFetch[URLBuild[cloudobject, {"x" -> "1"}]]]