Meridian uses cookie-based authentication. When you log in, the API sets a secure session cookie in your browser — you don’t manage tokens manually. Every subsequent request your browser makes automatically includes that cookie, so you stay logged in until you explicitly log out or the session expires.Documentation Index
Fetch the complete documentation index at: https://help.the-meridian.ai/llms.txt
Use this file to discover all available pages before exploring further.
Logging in
Send aPOST request to /auth/login with your email and password:
auth-token HttpOnly cookie in your browser. You don’t need to store or forward this token yourself — the browser handles it automatically.
Two-factor authentication
If your account has two-factor authentication (2FA) enabled, the login response looks different:requires_2fa: true, prompt for the 6-digit code from your authenticator app and send it to /auth/2fa/verify:
How sessions work
Theauth-token cookie is set with the following properties:
- HttpOnly — JavaScript cannot read the cookie, which protects against cross-site scripting (XSS) attacks.
- Secure — the cookie is only sent over HTTPS connections.
- SameSite=None — allows the cookie to be sent on cross-origin requests, which is required when your frontend and API run on different domains.
- Expires in 30 days — after 30 days of inactivity, the session expires and you’ll need to log in again.
Checking if you’re logged in
To verify the current session and retrieve the authenticated user’s details, callGET /auth/me:
active_organization field tells you which workspace is currently selected. If it’s null, navigate to the organization switcher to select a workspace.
Logging out
Send aPOST request to /auth/logout to end the session:
auth-token cookie and invalidates the session. After logging out, any protected request will return a 401 Unauthorized response.
API base URL
All Meridian API endpoints live under the/app prefix. For example, the login endpoint is /app/auth/login. When making API calls directly, construct your request URLs relative to the base domain provided in your Meridian workspace settings.
The base path prefix is
/app. If your requests are returning 404s, verify that you are including this prefix — e.g., https://api.meridian.app/app/auth/login.Handling 401 errors
A401 Unauthorized response means the request was made without a valid session, or the session has expired. This happens when:
- You’re not logged in yet.
- Your 30-day session has expired.
- The session cookie was cleared (for example, by logging out or clearing browser data).
401, redirect the user to the login page. After they log in, the session cookie is refreshed and subsequent requests will succeed.
Troubleshooting
Cookies are not being saved after login
If you log in successfully but the session cookie doesn’t appear in your browser:- Confirm both your frontend and API use HTTPS. The
auth-tokencookie has theSecureflag, which means browsers refuse to store it over plain HTTP. - Check the CORS headers on the API response. The response must include
Access-Control-Allow-Credentials: trueandAccess-Control-Allow-Originset to your exact frontend URL — wildcards (*) do not work with credentialed requests. - Open browser DevTools → Application → Cookies and verify that
auth-tokenappears under your API domain after login. - Confirm your HTTP client sends credentials. If you’re making requests programmatically, set
withCredentials: true(Axios) orcredentials: 'include'(Fetch).
Requests return 401 even though I’m logged in
- Open browser DevTools → Network, click the failing request, and check the Request Headers tab. Confirm the
Cookieheader is present and containsauth-token. - If the cookie is missing from the request, see the steps above — the cookie likely wasn’t saved correctly at login.
- If the cookie is present but you still get a
401, the session may have expired. Log in again to get a fresh session.
CORS errors in the browser console
CORS errors during login or authenticated requests almost always mean the API’sAccess-Control-Allow-Origin header doesn’t match your frontend’s exact origin. Ensure the API is configured to allow your frontend domain (including the protocol and port). Wildcards are not compatible with Access-Control-Allow-Credentials: true.