Api-key on ssh headless host not working

I have cmd-line agent working fine on my local host, but I would like to use it on a headless host as well. (actually the same working host, but accessed via ssh). I have grabbed an api key, but neither:

EXPORT CURSOR_API_KEY=key_6… agent status

or

agent –api-key key_6… status

work. Both give “not logged in” errors.

From my main keyboard, now with head, I status tells me I am logged in.

How do I diagnose this?

make sure you’re use two hyphens (--) instead of the en dash () for your api key flag. if you’re copying that in it may mess it up

besides that, are you using the user API key or an admin API key? the latter won’t work for this

there’s also a known issue with remote sessions not being able to store auth tokens in keychain (of you’re on macOS). possible workaround here would be to start something like tmux or zellij locally on the Mac, auth inside that session once, and then SSH in and attach to that same session