Authentication
Use one Legba API key for the skill, MCP, and HTTP API.
Get your API key
Create an account, then open API keys in the dashboard. Copy your key into your local environment.
export LEGBA_API_KEY='YOUR_LEGBA_API_KEY'Replace the placeholder with your own key. Legba keys use the lk_ prefix. Keep this value out of source control.
Authenticate HTTP requests
Send the key in the Authorization header. JSON requests also need the Content-Type header.
curl --fail-with-body --silent --show-error \
"https://skill.legba.xyz/api/v1/sessions/current" \
-H "Authorization: Bearer $LEGBA_API_KEY"This request only inspects the current session. Its response contains a session object or null.
How the skill finds your key
The Node client checks credentials in this order:
LEGBA_API_KEY, then the legacyLEGBA_PROXY_API_KEY.- The saved key file, if present.
- An interactive prompt, when a terminal is available.
The default file is ~/.config/legba/api-key. Set LEGBA_API_KEY_FILE to override it. The legacy LEGBA_PROXY_API_KEY_FILE is also accepted.
The client saves prompted keys with permissions 600. Automated jobs should supply the key before running.
For an existing environment key, save it locally:
mkdir -p "$HOME/.config/legba"
(umask 077; printf '%s\n' "$LEGBA_API_KEY" > "$HOME/.config/legba/api-key")
chmod 600 "$HOME/.config/legba/api-key"The resolver is defined in apikey.mjs.
Authenticate MCP separately
Your MCP client needs its own Authorization header. The saved skill key file does not configure MCP.
# URL: https://skill.legba.xyz/mcp
# Header: Authorization: Bearer <your key>
claude mcp add --scope user --transport http legba https://skill.legba.xyz/mcp \
--header "Authorization: Bearer $LEGBA_API_KEY"This command stores the key in local Claude configuration. See the MCP quickstart for the tool workflow.
Keep credentials scoped
Use the API key for Legba requests only. A session's view_url carries separate access credentials. Share it only with the person taking over.
Hand website sign-in steps to that person. Do not put passwords or verification codes in automation examples. End the session after the task finishes.
If your key leaks, rotate it through the dashboard. See API key management.