Skip to main content

GET /api/userAuth/me

Returns the full profile of the currently signed-in user. The response never includes the password field.

Required Headers

HeaderValue
x-api-keyYour pk_live_… key
AuthorizationBearer <accessToken>

Response Fields

success
boolean
true when the profile was retrieved successfully.
data
object
message
string
Human-readable status message.

Code Examples

const res = await fetch('https://api.ub.bitbros.in/api/userAuth/me', {
  headers: {
    'x-api-key': 'pk_live_YOUR_KEY',
    'Authorization': `Bearer ${accessToken}`
  }
});

const { success, data, message } = await res.json();
const { user } = data;

Success Response

{
  "success": true,
  "data": {
    "user": {
      "_id": "64fd1234abcd5678ef901234",
      "email": "alice@example.com",
      "name": "Alice",
      "username": "alice_dev"
    }
  },
  "message": "User fetched successfully"
}

Errors

StatusCause
401 UnauthorizedMissing or expired Authorization token

GET /api/userAuth/public/:username

Returns a public-safe view of a user’s profile. No authentication is required.
This endpoint never returns sensitive fields such as password or email. Only fields considered safe for public display are included.

Path Parameters

username
string
required
The username of the user whose public profile you want to retrieve.

Required Header

x-api-key: your pk_live_… key.

Code Example

const res = await fetch('https://api.ub.bitbros.in/api/userAuth/public/alice_dev', {
  headers: {
    'x-api-key': 'pk_live_YOUR_KEY'
  }
});

const { data } = await res.json();
const { user } = data;

Success Response

{
  "success": true,
  "data": {
    "user": {
      "_id": "64fd1234abcd5678ef901234",
      "name": "Alice",
      "username": "alice_dev"
    }
  },
  "message": "Public profile fetched successfully"
}

Errors

StatusCause
404 Not FoundNo user found with that username