The Ad Management System provides two authentication endpoints for identity management.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Priyanshu471/ad-management/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/login validates an existing user’s credentials against MongoDB and returns the full user document on success. POST /api/register creates a brand-new account after verifying that the provided email address is not already in use. Both endpoints accept a JSON body and return the resulting user object directly in the response. Error responses from both endpoints are plain text strings, not JSON.
POST /api/login
Validates the provided email and password against the MongoDBusers collection. If a matching document is found, the full user object is returned with a 200 status. No session or token is issued — the caller is responsible for persisting the returned user data client-side.
Request Body
The email address associated with the user’s account.
The user’s password in plain text.
Request Example
Response 200
Error Responses
| Status | Body | Cause |
|---|---|---|
400 | Email or password is incorrect | No user document matched the provided credentials |
500 | Raw error message string | Unexpected server or database error |
Error responses from this endpoint are plain text strings, not JSON objects. Do not attempt to parse them with
res.json().cURL Example
POST /api/register
Creates a new user account. The handler first checks whether a document with the provided email already exists in MongoDB. If the email is taken, it returns a400 plain text error immediately. Otherwise it creates and saves a new User document and returns it in the response body.
Request Body
The display name for the new user account.
The email address for the account. Must be unique across all registered users.
The account password in plain text.
The user’s role in the system (e.g.
advertiser, creator, or admin). This field accepts any string — no server-side validation of the value is performed.Request Example
Response 200
Error Responses
| Status | Body | Cause |
|---|---|---|
400 | Email is already in use | A user with the provided email already exists |
500 | Raw error message string | Unexpected server or database error |
Error responses from this endpoint are plain text strings, not JSON objects. Do not attempt to parse them with
res.json().