Every Debuta user has a profile wall where they can share posts — text, an image, or both. These endpoints cover the full lifecycle of a post: creation (with optional Cloudinary image upload), fetching your own or another user’s timeline, toggling likes, and deletion. All five routes require a valid JWT in theDocumentation 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.
Authorization header.
The Post Object
Every endpoint that returns a post (or array of posts) uses the following shape:A single post document.
Endpoints
POST /api/posts
Create a new post with optional image upload.
GET /api/posts/me
Fetch the current user’s own posts.
GET /api/posts/user/:id
Fetch posts by another user’s ID.
POST /api/posts/:id/like
Toggle a like on a post.
DELETE /api/posts/:id
Delete a post you own.
POST /api/posts
Creates a new post. The request body must contain at least a non-emptytext field or a photo attachment — sending neither returns 400. When a file is included, it is uploaded to Cloudinary before the post is saved.
Authentication: Bearer JWT required.
Content-Type: multipart/form-data (when attaching a file) or application/json (text-only).
Request body
The text content of the post. Maximum 500 characters. Required if no
photo is supplied.Optional image file. Sent as a multipart field named
photo. Accepted types: JPEG, PNG, WebP, HEIC. Maximum 10 MB. Uploaded to Cloudinary automatically.Response 201
Error responses
| Status | Condition |
|---|---|
400 | Neither text nor photo was provided. |
401 | Missing or invalid JWT. |
500 | Cloudinary upload failed or internal server error. |
curl example
GET /api/posts/me
Returns a paginated list of posts created by the currently authenticated user, sorted newest first. Authentication: Bearer JWT required.Query parameters
Page number for pagination.
Number of posts per page. Maximum enforced by the client; server default is 20.
Response 200
curl example
GET /api/posts/user/:id
Returns a paginated list of posts for any user by their MongoDB ObjectId. Used when viewing another user’s profile wall. Authentication: Bearer JWT required.Path parameters
MongoDB ObjectId of the target user. Returns
400 if the ID format is invalid.Query parameters
Page number.
Posts per page.
Response 200
Error responses
| Status | Condition |
|---|---|
400 | :id is not a valid MongoDB ObjectId. |
401 | Missing or invalid JWT. |
curl example
POST /api/posts/:id/like
Toggles a like on a post. If the authenticated user has not previously liked the post their ID is added to thelikes array; if they have already liked it, their ID is removed. This is idempotent — calling it twice returns the post to its original state.
Authentication: Bearer JWT required.
Path parameters
MongoDB ObjectId of the post to like or unlike.
Response 200
Total number of likes on the post after the toggle.
true if the current user’s action was a like; false if it was an unlike.Error responses
| Status | Condition |
|---|---|
404 | Post not found. |
401 | Missing or invalid JWT. |
curl example
DELETE /api/posts/:id
Permanently deletes a post. Only the post’s author can delete it — any other authenticated user receives403. If the post has an attached Cloudinary image, it is also deleted from Cloudinary before the document is removed.
Authentication: Bearer JWT required.
Path parameters
MongoDB ObjectId of the post to delete.
Response 200
Error responses
| Status | Condition |
|---|---|
403 | Authenticated user is not the post author. |
404 | Post not found. |
401 | Missing or invalid JWT. |