Ejemplos
El flujo de integración en curl, Python y JavaScript. Reemplaza bxk_tu_llave por la que creaste en la consola.
Autenticar y verificar
Toda llamada lleva tu API key como Bearer token. Empieza confirmando que funciona con GET /v1/me.
curl -s https://bruxel.ai/api/public/v1/me \
-H "Authorization: Bearer bxk_tu_llave"import httpx
BASE = "https://bruxel.ai/api/public/v1"
h = {"Authorization": "Bearer bxk_tu_llave"}
r = httpx.get(f"{BASE}/me", headers=h)
r.raise_for_status()
print(r.json()) # { tenant, key: { scopes, ... } }const BASE = "https://bruxel.ai/api/public/v1";
const h = { Authorization: "Bearer bxk_tu_llave" };
const res = await fetch(BASE + "/me", { headers: h });
console.log(await res.json()); // { tenant, key: { scopes, ... } }Empujar tu catálogo
Sube o actualiza productos por SKU (upsert masivo, hasta 500 por request).
curl -s -X POST https://bruxel.ai/api/public/v1/products \
-H "Authorization: Bearer bxk_tu_llave" \
-H "Content-Type: application/json" \
-d '{"products":[{"sku":"CAMISA-001","name":"Camisa de lino","brand":"Acme"}]}'r = httpx.post(f"{BASE}/products", headers=h, json={
"products": [
{"sku": "CAMISA-001", "name": "Camisa de lino", "brand": "Acme"},
],
})
print(r.json()) # { total, created, updated, skipped }const res = await fetch(BASE + "/products", {
method: "POST",
headers: { ...h, "Content-Type": "application/json" },
body: JSON.stringify({
products: [{ sku: "CAMISA-001", name: "Camisa de lino", brand: "Acme" }],
}),
});
console.log(await res.json()); // { total, created, updated, skipped }Generar una descripción
Generación síncrona: cobra al éxito. El Idempotency-Key es recomendado para reintentos seguros.
curl -s -X POST https://bruxel.ai/api/public/v1/generations \
-H "Authorization: Bearer bxk_tu_llave" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: gen-camisa-001-v1" \
-d '{"product_id":"prod_8f2","languages":["es","en"]}'r = httpx.post(
f"{BASE}/generations",
headers={**h, "Idempotency-Key": "gen-camisa-001-v1"},
json={"product_id": "prod_8f2", "languages": ["es", "en"]},
)
data = r.json() # { results, total_credits_charged, balance }const res = await fetch(BASE + "/generations", {
method: "POST",
headers: {
...h,
"Content-Type": "application/json",
"Idempotency-Key": "gen-camisa-001-v1",
},
body: JSON.stringify({ product_id: "prod_8f2", languages: ["es", "en"] }),
});
const data = await res.json(); // { results, total_credits_charged, balance }Generar en lote
Para volumen: reserva créditos con Idempotency-Key obligatorio y haz poll hasta que el lote termine — el poll cobra los éxitos y reembolsa el resto.
# 1) Envía el lote (Idempotency-Key OBLIGATORIO)
curl -s -X POST https://bruxel.ai/api/public/v1/batches \
-H "Authorization: Bearer bxk_tu_llave" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: batch-2026-07-23-a" \
-d '{"product_ids":["prod_8f2","prod_9a1"]}'
# 2) Poll hasta status "ended" (el GET cobra los éxitos y reembolsa el resto)
curl -s https://bruxel.ai/api/public/v1/batches/BATCH_ID \
-H "Authorization: Bearer bxk_tu_llave"import time
r = httpx.post(
f"{BASE}/batches",
headers={**h, "Idempotency-Key": "batch-2026-07-23-a"},
json={"product_ids": ["prod_8f2", "prod_9a1"]},
)
batch_id = r.json()["id"]
# Poll hasta que termine (el GET ingiere: cobra éxitos, reembolsa el resto)
while True:
b = httpx.get(f"{BASE}/batches/{batch_id}", headers=h).json()
if b["status"] == "ended":
break
time.sleep(10)const submit = await fetch(BASE + "/batches", {
method: "POST",
headers: {
...h,
"Content-Type": "application/json",
"Idempotency-Key": "batch-2026-07-23-a",
},
body: JSON.stringify({ product_ids: ["prod_8f2", "prod_9a1"] }),
});
const { id } = await submit.json();
// Poll hasta status "ended" (el GET cobra éxitos y reembolsa el resto)
let batch;
do {
await new Promise((r) => setTimeout(r, 10000));
batch = await (await fetch(BASE + "/batches/" + id, { headers: h })).json();
} while (batch.status !== "ended");Leer y exportar
Lee la descripción actual de un producto o exporta todo el catálogo timbrado a CSV.
# Descripción actual de un producto (por idioma)
curl -s "https://bruxel.ai/api/public/v1/products/prod_8f2/descriptions" \
-H "Authorization: Bearer bxk_tu_llave"
# Catálogo completo a CSV (compatible con Adobe Commerce)
curl -s "https://bruxel.ai/api/public/v1/export/catalog.csv?language=es" \
-H "Authorization: Bearer bxk_tu_llave" -o catalogo.csv# Descripción actual
desc = httpx.get(f"{BASE}/products/prod_8f2/descriptions", headers=h).json()
# Export a CSV
csv = httpx.get(f"{BASE}/export/catalog.csv", headers=h, params={"language": "es"})
open("catalogo.csv", "wb").write(csv.content)// Descripción actual
const desc = await (
await fetch(BASE + "/products/prod_8f2/descriptions", { headers: h })
).json();
// Export a CSV
const csv = await (
await fetch(BASE + "/export/catalog.csv?language=es", { headers: h })
).text();