Deploy your API with public permissions or add Username and Password parameters to URLFetch:

    With[{cloudobject = FileNameJoin[{$CloudRootDirectory, "FactorIntegerAPI"}]}, 
       CloudDeploy[
          APIFunction[{"x" -> "Integer"}, FactorInteger[#x] &],
          cloudobject, Permissions -> "Public"]; 
       URLFetch[URLBuild[cloudobject, {"x" -> "1"}]]]