According to the documentation, BaseForm is interpreted by the notebook interface to display a certain way, but it does not affect evaluation. When you CloudDeploy an APIFunction, its output format is Wolfram Language by default, so you're seeing what's expected.
There are several options, depending on what you're going for:
Give the output as an image, specifying the "PNG" format as a second argument to APIFunction:
CloudDeploy[APIFunction[{"base" -> "Integer", "digits" -> "Integer"},
BaseForm[N[Pi, #digits], #base]&,"PNG"]]
Make the output text format by running BaseForm through ToString, and specifying "Text" format. The base is put on a second line to show it as a subscript:
CloudDeploy[APIFunction[{"base" -> "Integer", "digits" -> "Integer"},
ToString[BaseForm[N[Pi, #digits], #base]]&,"Text"]]
If you want to return a text response giving just the numeric value without showing the base, you could use RealDigits.
For readability, first we break out a function piDigits:
piDigits[base_, digits_] :=
RealDigits[N[Pi, digits], base] /. {
{rdigits_List, nleft_} :> StringJoin@{ToString /@ Take[rdigits, nleft], ".", ToString /@ Drop[rdigits, nleft]}
}
Then we deploy an API based on it that returns Text:
CloudDeploy[APIFunction[{"base" -> "Integer", "digits" -> "Integer"}, piDigits[#base, #digits]&, "Text"]]