Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/akibanks/api-tienda-vinilos/llms.txt

Use this file to discover all available pages before exploring further.

The admin user endpoints let administrators inspect and manage VinylVibes user accounts. All three endpoints require at least admin or demo role; the two write operations (PUT, DELETE) are blocked for demo accounts, which are read-only by design.

GET /admin/usuarios

Returns a list of every registered user, ordered by registration date descending.
PropertyValue
MethodGET
Path/admin/usuarios
AuthJWT — admin or demo role

Request parameters

No query parameters or request body required.

Response

Returns an array of user objects.
id_usuario
integer
Unique identifier for the user.
nombre
string
The user’s username as provided at registration.
correo
string
The user’s email address. Auto-generated placeholder addresses follow the pattern <username>@vinylvibes.local.
rol
string
The user’s current role. One of cliente, vendedor, admin, or demo.
created_at
datetime
ISO 8601 timestamp of when the account was created.

Example request

curl -X GET https://api.vinylvibes.example/admin/usuarios \
  -H "Authorization: Bearer <admin_token>"

Example response

[
  {
    "id_usuario": 12,
    "nombre": "crate_digger",
    "correo": "crate_digger@vinylvibes.local",
    "rol": "cliente",
    "created_at": "2024-11-03T14:22:08.000Z"
  },
  {
    "id_usuario": 7,
    "nombre": "juan_vendedor",
    "correo": "juan_vendedor@vinylvibes.local",
    "rol": "vendedor",
    "created_at": "2024-09-15T09:01:54.000Z"
  }
]

Error responses

StatusDescription
401Missing or invalid JWT token.
403Authenticated user does not have admin or demo role.
500Internal server error while querying the database.

PUT /admin/usuarios/:id/rol

Updates the role of a specific user account.
PropertyValue
MethodPUT
Path/admin/usuarios/:id/rol
AuthJWT — admin role only
The demo role cannot be assigned via the API — only cliente, vendedor, and admin are accepted. Requests authenticated with a demo token are also rejected with 403; demo accounts are read-only.

Path parameters

id
integer
required
The unique identifier (id_usuario) of the user whose role you want to change.

Body parameters

rol
string
required
The new role to assign. Must be one of cliente, vendedor, or admin.

Response

{
  "mensaje": "Rol actualizado a \"admin\"."
}

Example request

curl -X PUT https://api.vinylvibes.example/admin/usuarios/12/rol \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{"rol": "vendedor"}'

Error responses

StatusDescription
400rol is missing or not one of cliente, vendedor, admin.
401Missing or invalid JWT token.
403Authenticated user is not admin, or is a demo account (write blocked).
500Internal server error while updating the database.

DELETE /admin/usuarios/:id

Permanently deletes a user account. An admin cannot delete their own account.
PropertyValue
MethodDELETE
Path/admin/usuarios/:id
AuthJWT — admin role only

Path parameters

id
integer
required
The unique identifier (id_usuario) of the user to delete.

Response

{
  "mensaje": "Usuario eliminado."
}

Example request

curl -X DELETE https://api.vinylvibes.example/admin/usuarios/12 \
  -H "Authorization: Bearer <admin_token>"

Error responses

StatusDescription
400The id in the path matches the currently authenticated admin’s own account — self-deletion is blocked. Returns {"error": "No puedes eliminarte a ti mismo."}.
401Missing or invalid JWT token.
403Authenticated user is not admin, or is a demo account (write blocked).
500Internal server error while deleting from the database.

Build docs developers (and LLMs) love