There are a number of ways to create pages that act as an API and either accept or return data.
The first method is to use the parameter mode=DATA when calling a page, as described in Page Parameters.
A more elegant solution is to call a page using the extension .json, .csv, .xml or .txt
Calling a page using one of the above extensions will cause the relevant headers to be applied to the page before it is returned.
e.g. /page_1234.txt will return the page as a text file download.
You can also add a Friendly Name to the page starting with the word "live", such as "live-data", and call it with /live-data.txt.
By preceding the friendly name with the word live, UDB knows that it is not a static json, csv, xml or txt file that you want to download.
When you use this method, it is your responsibility to ensure the returned data is formatted correctly. So if you are creating the content to be returned as a csv file then you need to construct the lines and columns yourself within the page. UDB will simply return the page with the correct MIME headers.