added functions to api.go