Basic
Una plantilla simple y limpia para imágenes OG.
Dimensiones: 1024x630
Template ID: basic
Propiedades
| Propiedad | Tipo | Requerido | Long. Máxima | Validación |
|---|---|---|---|---|
titleTítulo o nombre principal | string | Sí | 50 | maxLength(50) |
emailDirección de correo electrónico | string | Sí | - | email |
telNúmero de teléfono | string | Sí | 12 | maxLength(12) |
imageUrlURL de la imagen (solo HTTPS) | string (URL) | Sí | - | url (HTTPS only) |
primaryColorColor de fondo | string (hex) | Sí | - | color (hex) |
textColorColor del texto | string (hex) | Sí | - | color (hex) |
Ejemplo
{
"template": "basic",
"title": "John Doe",
"email": "[email protected]",
"tel": "+12345678900",
"imageUrl": "https://example.com/image.jpg",
"primaryColor": "#8b5cff",
"textColor": "#000000"
}Ejemplos de código
const response = await fetch("https://assets.qbacode.com/api/v1/generate-asset", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"template": "basic",
"title": "John Doe",
"email": "[email protected]",
"tel": "+12345678900",
"imageUrl": "https://example.com/image.jpg",
"primaryColor": "#8b5cff",
"textColor": "#000000"
})
});
if (response.ok) {
const blob = await response.blob();
const imageUrl = URL.createObjectURL(blob);
document.getElementById("preview").src = imageUrl;
} else {
const error = await response.json();
console.error("Error:", error);
}