Skip to main content
The LaraCopilot API uses server-side session authentication. Send credentials to the login endpoint to establish a session, then include the session cookie on all subsequent requests. Endpoints that require authentication return 401 Unauthorized when no valid session exists. The logout endpoint destroys the session, and GET /api/admin/me lets you inspect the currently authenticated user at any time.

POST /api/admin/login

Validates the provided credentials and creates a new admin session. Returns the authenticated user’s name, email, and role on success, or a 422 error when credentials do not match.
string
required
The email address of the admin account. Must be a valid email format.
string
required
The plaintext password for the account.
string
A human-readable status message. Value is "Login successful." on success.
object
The authenticated user object.
Error responses

POST /api/admin/logout

Destroys the current admin session. No request body is required. The endpoint always returns 200 regardless of whether a session was active.
string
Confirmation string. Value is "Logged out successfully.".

GET /api/admin/me

Returns the user data stored in the current session. Use this endpoint to verify that a session cookie is still valid or to retrieve the logged-in user’s identity without re-authenticating.
string
A human-readable status message. Value is "Authenticated user loaded." on success.
object
Session user data.
Error responses