How to set Cloud foundry API endpoint?

Alternatively you can use new API endpoints:

https://api.us-south.cf.cloud.ibm.com
https://api.eu-gb.cf.cloud.ibm.com
https://api.eu-de.cf.cloud.ibm.com
https://api.au-syd.cf.cloud.ibm.com

with:

cf login -a <API_ENDPOINT>

or you can use ibmcloud cli:

ibmcloud login -a 'https://cloud.ibm.com' -r 'us-south'
ibmcloud target --cf-api 'https://api.us-south.cf.cloud.ibm.com'

The API endpoint is the server your CLI program talks to to execute the commands and obtain information. For IBM Bluemix the API endpoints are documented here.

You could do cf api api.eu-de.bluemix.net to set the endpoint for Bluemix in Frankfurt, Germany. Or cf api api.ng.bluemix.net to configure Dallas, USA, as endpoint. See the above linked documentation for the full list of Bluemix Public. Bluemix Dedicated and Bluemix Local have other API endpoints.

You can also set the api endpoint and login using just one command using, e.g. for the Dallas, USA, endpoint:

cf login -a https://api.ng.bluemix.net