Check elgg loggedin user by API

How can be checked if user already logged in from another site?

The elgg is located on subdomain, I need to know on the main domain if user already loggedin to redirect him, if I make the api request the functions like 

elgg_is_logged_in()

doesn't work, it's always empty result.