Basic
OG image template optimized for SEO and social sharing.
Dimensions: 1200x630
Template ID: basic
Properties
| Property | Type | Required | Max Length | Validation |
|---|---|---|---|---|
titlePage or article title | string | Yes | 80 | maxLength(80) |
descriptionShort content description | string | Yes | 160 | maxLength(160) |
siteNameSite or domain name | string | Yes | 40 | maxLength(40) |
imageUrlRepresentative image URL | string (URL) | Yes | - | url (HTTPS only) |
primaryColorBackground color | string (hex) | Yes | - | color (hex) |
accentColorAccent color | string (hex) | Yes | - | color (hex) |
Example
{
"template": "basic",
"title": "How to Build Modern Web Applications",
"description": "A comprehensive guide to building fast, scalable, and maintainable web applications.",
"siteName": "blog.example.com",
"imageUrl": "https://example.com/image.jpg",
"primaryColor": "#0F172A",
"accentColor": "#06B6D4"
}Code examples
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": "How to Build Modern Web Applications",
"description": "A comprehensive guide to building fast, scalable, and maintainable web applications.",
"siteName": "blog.example.com",
"imageUrl": "https://example.com/image.jpg",
"primaryColor": "#0F172A",
"accentColor": "#06B6D4"
})
});
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);
}