heremyapp is in invite-only beta. Only invited GitHub accounts can sign up. Request an invite

Authentication

View as Markdown

Every API call needs Authorization: Bearer <token>. Tokens start with hma_. People sign up and sign in with GitHub at https://app.heremyapp.com; new accounts start on the Free plan (Plans and billing). Agents get a token through the device login below, which the user approves in the browser, or from a token the user created in the dashboard.

Where the token comes from

Agents resolve the token in this order:

  1. Environment variable HEREMYAPP_TOKEN
  2. File ~/.config/heremyapp/token
  3. Otherwise, start the device login. Never sign up, accept terms or create an account on the user's behalf; the user does that in the browser.

Never print, log or commit the token, and never put it in site files.

bash
export HEREMYAPP_TOKEN="${HEREMYAPP_TOKEN:-$(cat ~/.config/heremyapp/token 2>/dev/null)}"
API=https://api.heremyapp.com/v1
AUTH="Authorization: Bearer $HEREMYAPP_TOKEN"
curl -sS --fail-with-body "$API/me" -H "$AUTH"
json
{"account":{"id":"acc_9x2k...","username":"peter","plan":"free"},"token":{"id":"tok_4m8q...","scope":"account"},"dashboard":"https://app.heremyapp.com"}

account.username is the ACCOUNT part of every URL.

Device login (for agents without a token)

  1. Request a code. client_name is shown to the user on the approval page:
bash
API=https://api.heremyapp.com/v1
R=$(curl -sS --fail-with-body -X POST "$API/auth/device" -H "content-type: application/json" \
  -d '{"client_name":"Claude Code on my laptop"}')
DEVICE_CODE=$(printf '%s' "$R" | sed -n 's/.*"device_code":"\([^"]*\)".*/\1/p')
printf '%s' "$R" | sed -n 's/.*"verification_uri_complete":"\([^"]*\)".*/\1/p'
  1. Give the user the printed link, for example https://app.heremyapp.com/device?code=BCDF-GHJK, and the user_code. They sign in with GitHub (the first sign-in creates their account and asks them to accept the terms), check that the code matches, and click Approve.
  2. Poll until approved, then save the token without printing it:
bash
mkdir -p ~/.config/heremyapp && chmod 700 ~/.config/heremyapp
for i in $(seq 1 36); do
  sleep 5
  T=$(curl -sS -X POST "$API/auth/token" -H "content-type: application/json" -d "{\"device_code\":\"$DEVICE_CODE\"}")
  case "$T" in
    *'"token":"hma_'*)
      printf '%s' "$T" | sed -n 's/.*"token":"\(hma_[^"]*\)".*/\1/p' > ~/.config/heremyapp/token
      chmod 600 ~/.config/heremyapp/token; echo "approved"; break ;;
    *authorization_pending*|*slow_down*) [ "$i" = 36 ] && echo "still waiting" ;;
    *) echo "$T"; break ;;
  esac
done
export HEREMYAPP_TOKEN="$(cat ~/.config/heremyapp/token 2>/dev/null)"

If it prints still waiting, run the same loop again: the code is valid for 15 minutes (expires_in). Errors: expired_token (start again), access_denied (the user said no; ask them before trying again), invalid_device_code (wrong or already used code). The token is an account token named after client_name.

If the response's signups is invite_only, only existing accounts can approve; tell the user.

To store a token the user copied from the dashboard instead:

bash
mkdir -p ~/.config/heremyapp && chmod 700 ~/.config/heremyapp
pbpaste > ~/.config/heremyapp/token && chmod 600 ~/.config/heremyapp/token   # macOS, token copied to clipboard

Scopes

Scope Can do
account Create and delete spaces, deploy and roll back any space, upload installers, create and revoke tokens
space For one space only: view it, deploy and roll back, upload and delete installers

A space token gets 403 forbidden for any other space, and for creating spaces or managing tokens. If /me reports "scope":"space", run GET $API/spaces: it returns the one space the token is for. If the user wants a different space, ask them for an account token.

Creating and revoking tokens

People can create and revoke tokens in the dashboard under API tokens. With an account token, an agent can create a token limited to one space (for CI or a single project's agent):

bash
curl -sS --fail-with-body -X POST "$API/tokens" -H "$AUTH" -H "content-type: application/json" \
  -d '{"name":"my-app agent","space":"my-app"}'

The response contains token once; it cannot be shown again. List tokens with GET $API/tokens and revoke one with DELETE $API/tokens/TOKEN_ID. Revoked tokens stop working immediately.

All docs in one Markdown file: /llms-full.txt