Skip to main content

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.

The /api/users endpoint provides a single GET route that returns every user document stored in the MongoDB users collection. It is used primarily by the Admin panel to populate the advertisers and creators management tables, but it can be called by any client that needs a full list of registered accounts. No request body or query parameters are required.

GET /api/users

Fetches all user documents from MongoDB and returns them as an array under the users key. The response includes each user’s profile fields as stored in the database.

Request

No request body is required. Simply issue a GET request to the endpoint.

Response 200

{
  "users": [
    {
      "_id": "65f1a2b3c4d5e6f7a8b9c0d1",
      "name": "jane doe",
      "email": "jane@example.com",
      "password": "secret123",
      "role": "advertiser",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "updatedAt": "2024-01-15T10:30:00.000Z"
    },
    {
      "_id": "65f1a2b3c4d5e6f7a8b9c0d2",
      "name": "alex smith",
      "email": "alex@example.com",
      "password": "secret123",
      "role": "creator",
      "createdAt": "2024-01-16T09:00:00.000Z",
      "updatedAt": "2024-01-16T09:00:00.000Z"
    }
  ]
}

Error Response

StatusBodyCause
500{ "error": { ... } }Unexpected server or MongoDB error

cURL Example

curl http://localhost:3000/api/users
This endpoint currently returns all fields on every user document, which includes the password field stored in plain text. Before deploying to production, strip the password from the response by adding .select("-password") to the Mongoose query:
const users = await User.find({}).select("-password");
This ensures sensitive credentials are never exposed over the network, even on internal admin routes.

Build docs developers (and LLMs) love