Productos

Endpoints para listar y obtener productos de tu tienda via la API REST de Karrito.

4 min de lecturaapi, rest, productos, endpointsActualizado: 18 de marzo de 2026

Listar productos

GET /api/v1/products

Devuelve una lista paginada de los productos activos de tu tienda.

Parametros de query

Parametro Tipo Default Descripcion
limit number 50 Resultados por pagina (max 100)
offset number 0 Resultados a saltar

Ejemplo con curl

curl "https://karrito.shop/api/v1/products?limit=10&offset=0" \
  -H "Authorization: Bearer krt_live_a1b2c3d4e5f6g7h8i9j0"

Ejemplo con JavaScript

const response = await fetch("https://karrito.shop/api/v1/products?limit=10", {
  headers: {
    "Authorization": "Bearer krt_live_a1b2c3d4e5f6g7h8i9j0"
  }
});

const { data, total, limit, offset } = await response.json();

Respuesta

{
  "data": [
    {
      "id": "clx1a2b3c4d5e6f7g8h9i0",
      "name": "Camisa azul clasica",
      "slug": "camisa-azul-clasica",
      "description": "Camisa de algodon 100%, corte regular. Disponible en varias tallas.",
      "price": 25.00,
      "comparePrice": 35.00,
      "imageUrl": "https://cdn.karrito.shop/stores/mi-tienda/products/camisa-azul.webp",
      "isActive": true,
      "categoryId": "clx9z8y7w6v5u4t3s2r1q0",
      "variants": [],
      "createdAt": "2026-03-10T14:30:00.000Z",
      "updatedAt": "2026-03-15T09:15:00.000Z"
    },
    {
      "id": "clx2b3c4d5e6f7g8h9i0j1",
      "name": "Pantalon negro slim",
      "slug": "pantalon-negro-slim",
      "description": "Pantalon de vestir, corte slim fit. Tela con elastano para mayor comodidad.",
      "price": 40.00,
      "comparePrice": null,
      "imageUrl": "https://cdn.karrito.shop/stores/mi-tienda/products/pantalon-negro.webp",
      "isActive": true,
      "categoryId": "clx8y7w6v5u4t3s2r1q0p9",
      "variants": [
        {
          "id": "clxv1a2b3c4d5e6f7g8h9",
          "name": "Talla M",
          "price": 40.00,
          "isActive": true
        },
        {
          "id": "clxv2b3c4d5e6f7g8h9i0",
          "name": "Talla L",
          "price": 42.00,
          "isActive": true
        }
      ],
      "createdAt": "2026-03-11T10:00:00.000Z",
      "updatedAt": "2026-03-16T11:45:00.000Z"
    }
  ],
  "total": 47,
  "limit": 10,
  "offset": 0
}

Obtener un producto

GET /api/v1/products/:id

Devuelve un producto individual con todas sus variantes activas.

Parametros de ruta

Parametro Tipo Descripcion
id string ID del producto

Ejemplo con curl

curl "https://karrito.shop/api/v1/products/clx1a2b3c4d5e6f7g8h9i0" \
  -H "Authorization: Bearer krt_live_a1b2c3d4e5f6g7h8i9j0"

Ejemplo con JavaScript

const productId = "clx1a2b3c4d5e6f7g8h9i0";

const response = await fetch(`https://karrito.shop/api/v1/products/${productId}`, {
  headers: {
    "Authorization": "Bearer krt_live_a1b2c3d4e5f6g7h8i9j0"
  }
});

const { data } = await response.json();
console.log(data.name); // "Camisa azul clasica"

Respuesta

{
  "data": {
    "id": "clx1a2b3c4d5e6f7g8h9i0",
    "name": "Camisa azul clasica",
    "slug": "camisa-azul-clasica",
    "description": "Camisa de algodon 100%, corte regular. Disponible en varias tallas.",
    "price": 25.00,
    "comparePrice": 35.00,
    "imageUrl": "https://cdn.karrito.shop/stores/mi-tienda/products/camisa-azul.webp",
    "isActive": true,
    "categoryId": "clx9z8y7w6v5u4t3s2r1q0",
    "variants": [
      {
        "id": "clxv3c4d5e6f7g8h9i0j1",
        "name": "Talla S",
        "price": 25.00,
        "isActive": true
      },
      {
        "id": "clxv4d5e6f7g8h9i0j1k2",
        "name": "Talla M",
        "price": 25.00,
        "isActive": true
      },
      {
        "id": "clxv5e6f7g8h9i0j1k2l3",
        "name": "Talla L",
        "price": 27.00,
        "isActive": true
      }
    ],
    "createdAt": "2026-03-10T14:30:00.000Z",
    "updatedAt": "2026-03-15T09:15:00.000Z"
  }
}

Si el producto no existe, recibes un 404 Not Found:

{
  "error": "Producto no encontrado",
  "code": "NOT_FOUND"
}

Schema del producto

Campo Tipo Descripcion
id string Identificador unico (CUID)
name string Nombre del producto
slug string URL-friendly del nombre
description string | null Descripcion del producto
price number Precio principal en la moneda de la tienda
comparePrice number | null Precio anterior (para mostrar descuento)
imageUrl string | null URL de la imagen principal
isActive boolean Si el producto esta visible en el catalogo
categoryId string | null ID de la categoria asignada
variants Variant[] Lista de variantes activas
createdAt string Fecha de creacion (ISO 8601)
updatedAt string Fecha de ultima modificacion (ISO 8601)

Schema de variante

Campo Tipo Descripcion
id string Identificador unico (CUID)
name string Nombre de la variante (ej: "Talla M", "Color rojo")
price number Precio de esta variante
isActive boolean Si la variante esta disponible

Scope requerido

  • products:read para ambos endpoints

Siguiente paso

Consulta las categorias de tu tienda para filtrar productos.