The Users API covers the full lifecycle of a Debuta profile: initial registration, the swipe discovery feed, profile text and location updates, and all Cloudinary-backed photo operations. All endpoints exceptDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/desarrolladorandres2026-gif/Native-tailwind/llms.txt
Use this file to discover all available pages before exploring further.
POST /api/users/register require a valid JWT in the Authorization header.
Photo uploads use multipart/form-data and are handled by an upload middleware that buffers the file before passing it to Cloudinary. The gallery is capped at 6 photos. Profile picture, cover photo, and gallery photos each have dedicated upload and delete endpoints so the client can manage them independently.
POST /api/users/register
Creates a new local Debuta account. Optionally accepts a base64-encoded facial photo (facePhoto) that is uploaded to Cloudinary and stored as the profile picture; if the upload succeeds the account is also marked is_verified: true.
Auth required: No
Request body
First name. Stored as
first_name. Used as the base for auto-generating username.Last name. Stored as
last_name. Optional.Email address. Must be unique. Normalised to lowercase.
Phone number. Must be 7–15 digits.
Plaintext password. Minimum 6 characters. Hashed with bcrypt (cost 12) before storage.
Gender. One of:
masculino, femenino, no_binario, otro, prefiero_no_decir.Date of birth in any format parseable by
new Date(). Example: "1998-04-12".City name.
Country name.
Profile bio. Max 500 characters.
Array of interest objects or plain strings. Strings are normalised to
{ name, icon: '' } automatically. Example: [{ "name": "Senderismo", "icon": "🥾" }] or ["Senderismo"].What the user is looking for:
amistad, citas, serio, casual, no_lo_se, or empty string.Optional base64-encoded image (with or without the
data:image/...;base64, prefix). When provided, it is uploaded to Cloudinary as the profile picture and the account is set to is_verified: true.Response — 201 Created
Error responses
| Status | Condition |
|---|---|
400 | One or more required fields are missing (returns an errores array) |
400 | password is shorter than 6 characters |
400 | Email is already registered |
400 | MongoDB duplicate key on correo or username |
500 | Internal server error |
curl example
GET /api/users/discover
Returns a paginated list of profiles for the swipe feed. Results are filtered by the authenticated user’s settings (distance, age range, gender preference, advanced filters) and sorted by a computed affinity score. Users who have already been interacted with (liked or disliked) are excluded. Auth required: Yes —Authorization: Bearer <token>
Query parameters
Page number (1-based). Default:
1.Maximum profiles to return per page. Default:
10.Active filters (from user settings)
| Setting | Effect |
|---|---|
show_me | Filter by gender (M → masculino, F → femenino, ALL → no filter) |
min_age / max_age | Filter by birth_date range |
max_distance | Geospatial $geoWithin $centerSphere filter using the authenticated user’s latitude/longitude. Users with no location set are always included. |
verified_only | Only return is_verified: true profiles |
has_bio_only | Only return profiles with a non-empty bio |
min_photos | Only return profiles with at least this many gallery photos |
looking_for | Filter by buscando field (skipped when ALL or empty) |
interests_filter | Return profiles that share at least one of the listed interest names |
activo: false, rol != 'user', or settings.profile_visible: false are always excluded.
Response — 200 OK
Array of user profile objects, sorted descending by
afinidad.score.Affinity breakdown for the current user vs. this profile.
score— composite score:amigosFB × 3 + interesesComun × 2 + ciudadComun ? 2 : 0 + edadSimilar ? 1 : 0amigosFB— mutual Facebook friends registered in DebutainteresesComun— number of shared interest namesciudadComun— both users share the same city (boolean)edadSimilar— age difference ≤ 5 years (boolean)resumen— ready-to-display summary string, ornull
curl example
GET /api/users/me/stats
Returns activity statistics for the authenticated user. Auth required: Yes —Authorization: Bearer <token>
Response — 200 OK
Total number of completed matches (both parties gave a like).
Total number of likes the authenticated user has sent.
curl example
PUT /api/users/profile
Updates text and location fields on the authenticated user’s profile. Does not handle photo uploads — use the dedicated photo endpoints for those. Only fields present in the request body are updated; all others are left unchanged. Auth required: Yes —Authorization: Bearer <token>
Updatable fields
Profile bio. Max 500 characters.
First name.
Last name.
Full replacement of the interests array:
[{ name: string, icon: string }].GPS latitude. Updating this also syncs the GeoJSON
location field automatically via a pre-save hook.GPS longitude.
City name.
Country name.
Human-readable location label (e.g.
"CDMX, México").Job title. Max 100 characters.
Employer name. Max 100 characters.
Educational institution. Max 150 characters.
One of:
single, in_relationship, married, complicated, prefer_not_say, or empty string.Personal website URL. Max 200 characters.
Looking for:
amistad, citas, serio, casual, no_lo_se, or empty string.Religion (free-text).
Zodiac sign (free-text).
Smoking habit:
si, no, socialmente, ocasionalmente, or empty string.Drinking habit:
si, no, socialmente, ocasionalmente, or empty string.Array of language name strings.
Height in centimetres.
Exercise frequency:
siempre, a_veces, nunca, or empty string.Partial settings update. Deep-merged with the existing settings. The
privacy sub-object is also deep-merged if provided.Response — 200 OK
curl example
Photo management endpoints
All photo endpoints usemultipart/form-data for uploads. Images are stored in Cloudinary; the database holds only the { url, public_id } pair.
Profile Picture
POST
DELETE
/api/users/profile/avatar — upload or replaceDELETE
/api/users/profile/avatar — removeCover Photo
POST
DELETE
/api/users/profile/cover — upload or replaceDELETE
/api/users/profile/cover — removePOST /api/users/profile/avatar
Uploads a new profile picture. If a previous one exists, it is deleted from Cloudinary first. Auth required: Yes —Authorization: Bearer <token>Content-Type:
multipart/form-data
The image file. Field name must be
file. Any image format supported by Cloudinary.Response — 200 OK
curl example
DELETE /api/users/profile/avatar
Removes the profile picture from Cloudinary and clearsprofile_picture to null.
Auth required: Yes — Authorization: Bearer <token>
Response — 200 OK
curl example
POST /api/users/profile/cover
Uploads a new cover photo. If a previous cover photo exists, it is deleted from Cloudinary first. Auth required: Yes —Authorization: Bearer <token>Content-Type:
multipart/form-data
The image file. Field name must be
file.Response — 200 OK
curl example
DELETE /api/users/profile/cover
Removes the cover photo from Cloudinary and clearscover_photo to null.
Auth required: Yes — Authorization: Bearer <token>
Response — 200 OK
curl example
POST /api/users/profile/photos
Adds one or more images to the gallery. The gallery has a hard cap of 6 photos. If the user already has some photos, only enough new ones are accepted to reach 6 total — the rest are silently ignored. Auth required: Yes —Authorization: Bearer <token>Content-Type:
multipart/form-data
One or more image files. Field name must be
files. Accepts multiple files in a single request.Response — 200 OK
Error responses
| Status | Condition |
|---|---|
400 | No files received |
400 | Gallery already has 6 photos |
curl example
DELETE /api/users/profile/photos/:encodedId
Removes a single photo from the gallery by its Cloudinarypublic_id. Because public_id values contain slashes, the client must base64url-encode the public_id before placing it in the URL path.
Auth required: Yes — Authorization: Bearer <token>
The Cloudinary
public_id encoded with Base64url (Buffer.from(publicId).toString('base64url') in Node.js). Example: public_id = "gallery/abc123" → encodedId = "Z2FsbGVyeS9hYmMxMjM".Response — 200 OK
Error responses
| Status | Condition |
|---|---|
404 | No photo with the decoded public_id found in the user’s gallery |
curl example
GET /api/users/:id
Retrieves the public-facing profile of another user. Returns a subset of fields safe to display to other users. Auth required: Yes —Authorization: Bearer <token>
MongoDB ObjectId of the target user.
Response — 200 OK
Error responses
| Status | Condition |
|---|---|
400 | id is not a valid MongoDB ObjectId |
404 | User not found |
curl example
DELETE /api/users/me
Permanently and irreversibly deletes the authenticated user’s account and all associated Cloudinary assets (profile picture, cover photo, and all gallery photos). This action cannot be undone. Auth required: Yes —Authorization: Bearer <token>