Skip to content

Authentication

The RAG API uses two authentication schemes depending on the context.

All /api/v1/* endpoints use API key authentication. Pass your key in the Authorization header:

Authorization: Bearer YOUR_API_KEY
  • Your API key is shown once at signup. Save it securely.
  • Keys are hashed at storage — we cannot recover a lost key.
  • If you lose your key, regenerate it from the dashboard. The old key is immediately invalidated.
  • One API key per account.

API keys use the format rag_live_<random> (e.g., rag_live_abc123...). The prefix helps you identify RAG API keys in your codebase.

  • Keys are hashed before storage — we never store raw API keys.
  • Always use HTTPS. The API rejects plain HTTP connections.
  • Never expose your API key in client-side code. Keep it server-side.
  • Rotate your key immediately if you suspect it has been compromised.

The dashboard web application uses email/password authentication with JWT tokens:

EndpointMethodDescription
/api/auth/signupPOSTCreate account, returns JWT + API key
/api/auth/loginPOSTLog in, returns JWT
/api/auth/meGETGet current account (requires JWT)
/api/auth/api-key/regeneratePOSTRegenerate API key (requires JWT)

JWT tokens are returned in the response body.

Terminal window
curl -X POST https://api.useragex.com/api/auth/signup \
-H "Content-Type: application/json" \
-d '{
"email": "dev@example.com",
"password": "your-secure-password",
"name": "Jane Developer"
}'

Response:

{
"data": {
"token": "eyJhbG...",
"api_key": "rag_live_abc123...",
"account": {
"id": "acc_a1b2c3d4e5",
"email": "dev@example.com",
"name": "Jane Developer",
"plan": "trial"
}
}
}
Terminal window
curl -X POST https://api.useragex.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "dev@example.com",
"password": "your-secure-password"
}'

You can also sign in to the dashboard using your GitHub or Google account. OAuth login is available at app.useragex.com/auth.

  1. Click “GitHub” or “Google” on the sign-in page.
  2. You’re redirected to the provider to authorize access.
  3. On success, you’re redirected back to the dashboard with a JWT session.
  • New user: If no account exists for your email, a new account is created automatically with a 7-day trial.
  • Existing user: If an account with the same email already exists, the OAuth identity is linked to it — no duplicate accounts.
  • Returning user: Subsequent OAuth logins match by provider identity and log you in directly.
EndpointMethodDescription
/api/auth/githubGETRedirect to GitHub authorization
/api/auth/github/callbackGETHandle GitHub callback
/api/auth/googleGETRedirect to Google authorization
/api/auth/google/callbackGETHandle Google callback
StatusCodeMeaning
401AUTHENTICATION_ERRORMissing or invalid API key / JWT
403AUTHORIZATION_ERRORValid credentials but insufficient permissions