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 sales endpoints give administrators visibility into all purchase orders and the ability to advance orders through the fulfillment workflow. Read endpoints are accessible to both admin and demo roles; the status-update operation is restricted to full admin accounts.

GET /admin/ventas

Returns every order in the system, ordered by date descending, with a nested summary of the purchasing customer.
PropertyValue
MethodGET
Path/admin/ventas
AuthJWT — admin or demo role

Request parameters

No query parameters or request body required.

Response

Returns an array of venta (sale) objects.
id_venta
integer
Unique identifier for the order.
id_cliente
integer
Foreign key referencing the purchasing user’s id_usuario.
total
number
Total order value in the store’s currency, calculated server-side at checkout time.
estado
string
Current fulfillment status of the order. One of pendiente, pagada, enviada, entregada, cancelada.
fecha
datetime
ISO 8601 timestamp of when the order was placed.
cliente
object
Nested summary of the customer who placed the order.

Example request

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

Example response

[
  {
    "id_venta": 42,
    "id_cliente": 7,
    "total": "89.97",
    "estado": "enviada",
    "fecha": "2025-01-10T18:34:00.000Z",
    "cliente": {
      "id_usuario": 7,
      "nombre": "crate_digger"
    }
  }
]

Error responses

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

GET /admin/ventas/:id

Returns the complete record for a single order, including all line items and the full shipping address.
PropertyValue
MethodGET
Path/admin/ventas/:id
AuthJWT — admin or demo role

Path parameters

id
integer
required
The unique identifier (id_venta) of the order to retrieve.

Response

Returns the full venta object, including top-level fields from GET /admin/ventas plus the expanded lineas and envio relationships.
lineas
array
Ordered line items included in this purchase.
envio
object
Full shipping address recorded at checkout.

Example request

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

Example response

{
  "id_venta": 42,
  "id_cliente": 7,
  "total": "89.97",
  "estado": "enviada",
  "fecha": "2025-01-10T18:34:00.000Z",
  "cliente": {
    "id_usuario": 7,
    "nombre": "crate_digger"
  },
  "lineas": [
    {
      "id_linea": 101,
      "discogs_id": "1234567",
      "titulo": "The Dark Side of the Moon",
      "artista": "Pink Floyd",
      "cantidad": 1,
      "p_unitario": "34.99",
      "subtotal": "34.99"
    },
    {
      "id_linea": 102,
      "discogs_id": "7654321",
      "titulo": "Rumours",
      "artista": "Fleetwood Mac",
      "cantidad": 2,
      "p_unitario": "27.49",
      "subtotal": "54.98"
    }
  ],
  "envio": {
    "nombre_receptor": "Valentina Ríos",
    "calle": "Av. Insurgentes Sur",
    "numero_ext": "1602",
    "numero_int": "4B",
    "colonia": "Crédito Constructor",
    "ciudad": "Ciudad de México",
    "estado": "CDMX",
    "codigo_postal": "03940",
    "referencias": "Edificio azul frente a la farmacia"
  }
}

Error responses

StatusDescription
401Missing or invalid JWT token.
403Authenticated user does not have admin or demo role.
404No order found with the given id_venta.
500Internal server error while querying the database.

PUT /admin/ventas/:id/estado

Updates the fulfillment status of an existing order.
PropertyValue
MethodPUT
Path/admin/ventas/:id/estado
AuthJWT — admin role only

Path parameters

id
integer
required
The unique identifier (id_venta) of the order to update.

Body parameters

estado
string
required
The new fulfillment status. Must be one of pendiente, pagada, enviada, entregada, cancelada.

Valid states

EstadoDescription
pendienteOrder created; payment not yet confirmed.
pagadaPayment confirmed. This is the initial state assigned at checkout.
enviadaOrder has been dispatched to the carrier.
entregadaOrder received by the customer.
canceladaOrder was cancelled.
Orders created through /checkout always start in the pagada state because payment is assumed confirmed at submission time. Use pendiente only when manually creating or re-opening an order outside the normal checkout flow.

Response

{
  "mensaje": "Estado actualizado a \"enviada\"."
}

Example request

curl -X PUT https://api.vinylvibes.example/admin/ventas/42/estado \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{"estado": "enviada"}'

Error responses

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

Build docs developers (and LLMs) love