llms.txt
Compare with other sites' llms.txt files →# LoginLlama
> LoginLlama is a suspicious-login detection API. Send a login attempt and get a
> real-time risk score (0-10) plus risk codes (Tor, VPN, impossible travel, new
> device, new location, known bot, and more) so you can block, step-up (MFA), or
> allow. It is designed to be installed by a coding agent in a single prompt.
Base URL: https://loginllama.app
Docs (human): https://loginllama.app/docs
Sign up (100 free checks to start): https://loginllama.app/signup
Manage API keys: https://loginllama.app/account/api
## Install in one prompt
Paste this prompt into Claude Code, Cursor, Codex, or any coding agent:
```
Integrate LoginLlama (suspicious login detection) into this project.
1. Detect the language/framework and install the official SDK:
- Better Auth (any framework): npm install better-auth-loginllama,
then add loginLlama() to plugins
- Clerk: npm install clerk-loginllama,
then export POST = loginLlamaWebhook()
from a session.created webhook route
- Auth.js (NextAuth) Credentials: npm install authjs-loginllama,
then wrap authorize in withLoginLlama()
- Node.js / Next.js / Express: npm install loginllama
- Python / Django / Flask: pip install loginllama
- PHP / Laravel: composer require joshghent/loginllama
2. Read the live API reference at https://loginllama.app/docs.
3. Add a LOGINLLAMA_API_KEY environment variable. If I don't have a key yet, tell
me to grab one at https://loginllama.app/account/api and paste it. Never
hard-code the key.
4. After my auth step succeeds, call LoginLlama with the user's identity_key,
email, IP address and user agent. If risk_score > 5, require MFA or block;
otherwise allow. Always FAIL OPEN: if LoginLlama errors, log it and let the
user in.
5. Show me how to test it locally.
```
## API: check a login
POST https://loginllama.app/api/v1/login/check
Header: `X-API-KEY: <your key>` (production keys start with `llama_prod_`,
test keys start with `llama_test_`, older ones `llama_stage_`)
Content-Type: application/json
Request body (only `identity_key` is required; more fields = better accuracy):
```json
{
"identity_key": "user@example.com",
"email_address": "user@example.com",
"ip_address": "203.0.113.42",
"user_agent": "Mozilla/5.0 ...",
"authentication_outcome": "success"
}
```
Response:
```json
{
"data": {
"type": "login_check",
"attributes": {
"status": "pass",
"risk_score": 2,
"risk_codes": ["ip_address_not_used_before", "device_fingerprint_not_used_before"],
"message": "Login check passed"
}
},
"meta": { "environment": "production" }
}
```
Recommended thresholds: 0-2 allow, 3-5 monitor, 6-7 step-up (MFA), 8+ block.
Rate limit: 100 req/min (live keys), 60 req/min (test keys).
## SDKs
- Node.js: `npm install loginllama` — https://www.npmjs.com/package/loginllama
- Better Auth plugin: `npm install better-auth-loginllama` — https://www.npmjs.com/package/better-auth-loginllama
- Clerk webhook handler: `npm install clerk-loginllama` — https://www.npmjs.com/package/clerk-loginllama
- Auth.js (NextAuth) Credentials wrapper: `npm install authjs-loginllama` — https://www.npmjs.com/package/authjs-loginllama
- Python: `pip install loginllama` — https://pypi.org/project/loginllama
- PHP: `composer require joshghent/loginllama` — https://packagist.org/packages/joshghent/loginllama
## MCP server (ask your analytics in natural language)
LoginLlama exposes a Model Context Protocol server so an agent can query your
login analytics. Transport: HTTP. URL: https://loginllama.app/api/v1/mcp.
Authenticate with the `X-API-KEY` header. All tools are read-only and scoped to
your team.
Add to Claude Code:
```
claude mcp add --transport http loginllama https://loginllama.app/api/v1/mcp --header "X-API-KEY: YOUR_LOGINLLAMA_API_KEY"
```
Add to any MCP client (.mcp.json):
```json
{
"mcpServers": {
"loginllama": {
"type": "http",
"url": "https://loginllama.app/api/v1/mcp",
"headers": { "X-API-KEY": "YOUR_LOGINLLAMA_API_KEY" }
}
}
}
```
Tools:
- get_login_stats — totals, average risk, high-risk count, bot/Tor/VPN counts
- get_average_risk_score — average risk score, filterable by browser/os/country/device/user
- get_login_breakdown — group by browser, os, device, country, or status
- get_recent_logins — latest checks with risk, location, device
- get_account_usage — remaining API credits and plan
Example questions: "What is my average login risk score for the chrome
browser?", "Which country has the highest-risk logins this month?", "Show me the
10 most recent high-risk logins."
## Agent authorization (device flow)
Agents can obtain a scoped API key without the user pasting one, using an OAuth 2.0
Device Authorization Grant (RFC 8628).
1. POST https://loginllama.app/api/v1/oauth/device
body (JSON or form): { "client_name": "<your agent>", "scope": "check_login analytics" }
→ { device_code, user_code, verification_uri, verification_uri_complete, expires_in, interval }
2. Tell the user to open verification_uri (https://loginllama.app/connect) and enter
user_code (or open verification_uri_complete, which pre-fills it), then approve.
3. Poll POST https://loginllama.app/api/v1/oauth/token
body: { "grant_type": "urn:ietf:params:oauth:grant-type:device_code", "device_code": "<device_code>" }
→ while pending: { "error": "authorization_pending" } (respect `interval` seconds)
→ on approval: { "access_token": "<api key>", "api_key": "<api key>", "team_id", "team_name", "scope", "environment" }
The issued key is scoped to the approver's team. To disconnect, POST { "token": "<api key>" }
to https://loginllama.app/api/v1/oauth/revoke (RFC 7009), or revoke it from the dashboard.
## Notes
- Always fail open: never block users if LoginLlama is unavailable.
- Load the API key from the environment (`LOGINLLAMA_API_KEY`); never commit it.
- Use test keys (`llama_test_`) in development and tests. They are free, ignore real signals, and return the result named by tags in the email: `ada+risk_9@example.com` scores 9, `ada+known_tor_exit_node@example.com` returns that code. Responses carry `meta.test: true`. In an identity provider's test tenant (Auth0, Clerk), put the test key in the integration and create test users with tagged emails such as `you+risk_9@yourco.com`.