Skip to main content
All user endpoints require authentication. Users can only access and modify their own data.

Address Management

Get Addresses

Retrieve all saved addresses for the authenticated user.

Authentication

Required. User must be authenticated via Clerk.

Response

addresses
array
required
Array of saved address objects
addresses[]._id
string
Address identifier
addresses[].label
string
Address label (e.g., “Home”, “Work”)
addresses[].fullName
string
Recipient’s full name
addresses[].streetAddress
string
Street address
addresses[].city
string
City
addresses[].phoneNumber
string
Contact phone number
addresses[].isDefault
boolean
Whether this is the default address

Example Response

{
  "addresses": [
    {
      "_id": "65f8a1b2c3d4e5f6g7h8i9j0",
      "label": "Home",
      "fullName": "Juan Pérez",
      "streetAddress": "Calle 123 #45-67",
      "city": "Bogotá",
      "phoneNumber": "+57 300 123 4567",
      "isDefault": true
    }
  ]
}

Add Address

Add a new address to the user’s address book.

Authentication

Required. User must be authenticated via Clerk.

Request Body

label
string
required
Address label (e.g., “Home”, “Work”, “Office”)
fullName
string
required
Recipient’s full name
streetAddress
string
required
Street address
city
string
required
City
phoneNumber
string
required
Contact phone number
isDefault
boolean
Set as default address (will unset other defaults)

Response

message
string
Success message
addresses
array
Updated array of all addresses

Example Request

curl -X POST https://api.donpalitojr.com/api/users/addresses \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Home",
    "fullName": "Juan Pérez",
    "streetAddress": "Calle 123 #45-67",
    "city": "Bogotá",
    "phoneNumber": "+57 300 123 4567",
    "isDefault": true
  }'

Update Address

Update an existing address. All fields are optional.

Authentication

Required. User must be authenticated via Clerk.

Path Parameters

addressId
string
required
The ID of the address to update

Request Body

label
string
Address label
fullName
string
Recipient’s full name
streetAddress
string
Street address
city
string
City
phoneNumber
string
Contact phone number
isDefault
boolean
Set as default address

Response

message
string
Success message
addresses
array
Updated array of all addresses

Delete Address

Delete an address from the user’s address book.

Authentication

Required. User must be authenticated via Clerk.

Path Parameters

addressId
string
required
The ID of the address to delete

Response

message
string
Success message
addresses
array
Updated array of remaining addresses

Wishlist Management

Get Wishlist

Retrieve the user’s wishlist with populated product details.

Authentication

Required. User must be authenticated via Clerk.

Response

wishlist
array
required
Array of product objects in the wishlist

Example Response

{
  "wishlist": [
    {
      "_id": "65f8a1b2c3d4e5f6g7h8i9j1",
      "name": "Product Name",
      "description": "Product description",
      "price": 25000,
      "images": ["https://res.cloudinary.com/..."],
      "category": "electronics",
      "stock": 50,
      "averageRating": 4.5,
      "totalReviews": 12
    }
  ]
}

Add to Wishlist

Add a product to the user’s wishlist.

Authentication

Required. User must be authenticated via Clerk.

Request Body

productId
string
required
The ID of the product to add

Response

message
string
Success message
wishlist
array
Updated wishlist with populated products

Example Request

curl -X POST https://api.donpalitojr.com/api/users/wishlist \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "productId": "65f8a1b2c3d4e5f6g7h8i9j1"
  }'

Remove from Wishlist

Remove a product from the user’s wishlist.

Authentication

Required. User must be authenticated via Clerk.

Path Parameters

productId
string
required
The ID of the product to remove

Response

message
string
Success message
wishlist
array
Updated wishlist

Profile Management

Get Profile

Get the authenticated user’s profile information.

Authentication

Required. User must be authenticated via Clerk.

Response

user
object
required
User profile object
user._id
string
User ID
user.clerkId
string
Clerk user ID
user.firstName
string
First name
user.lastName
string
Last name
user.email
string
Email address
user.phoneNumber
string
Phone number
user.documentType
string
Document type (e.g., “CC”, “CE”, “NIT”)
user.documentNumber
string
Document number
user.addresses
array
Saved addresses
user.wishlist
array
Wishlist product IDs
user.notificationPreferences
object
Notification preferences

Update Profile

Update user profile information. All fields are optional.

Authentication

Required. User must be authenticated via Clerk.

Request Body

firstName
string
First name
lastName
string
Last name
phoneNumber
string
Phone number
documentType
string
Document type (CC, CE, NIT, Passport)
documentNumber
string
Document number

Response

message
string
Success message
user
object
Updated user profile

Update Notification Preferences

Update user notification preferences for order updates, promotions, and newsletters.

Authentication

Required. User must be authenticated via Clerk.

Request Body

orderUpdates
boolean
Receive order status update notifications
promotions
boolean
Receive promotional offers
newsletter
boolean
Subscribe to newsletter

Response

message
string
Success message
notificationPreferences
object
Updated notification preferences

Example Request

curl -X PUT https://api.donpalitojr.com/api/users/notification-preferences \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "orderUpdates": true,
    "promotions": false,
    "newsletter": true
  }'

Deactivate Account

Deactivate the user’s account. This action marks the account as inactive but preserves data.

Authentication

Required. User must be authenticated via Clerk.

Response

message
string
Success message
Account deactivation will log the user out and prevent future logins until reactivation. Contact support to reactivate your account.

Error Responses

All endpoints may return the following error responses:
error
string
Error message describing what went wrong

Common Error Codes

  • 400 - Bad Request (missing or invalid parameters)
  • 401 - Unauthorized (authentication required)
  • 404 - Not Found (address or resource not found)
  • 500 - Internal Server Error

Example Error Response

{
  "error": "Missing required address fields"
}

Build docs developers (and LLMs) love