Creating Custom Widgets
Build beautiful, embeddable widgets to display metal prices on your website.
8 min read
Last updated: 2025-06-13
Widget Overview
MetalAPI widgets allow you to display real-time metal prices on your website without writing any backend code.
Creating Your First Widget
1. Go to the Widget Builder in your dashboard
2. Select the metals you want to display
3. Choose a layout (table, cards, or ticker)
4. Customize colors and styling
5. Generate the embed code
2. Select the metals you want to display
3. Choose a layout (table, cards, or ticker)
4. Customize colors and styling
5. Generate the embed code
Embedding the Widget
Copy and paste this code into your website:
<iframe
src="https://metalapi.com/widget/YOUR_WIDGET_ID"
width="100%"
height="400"
frameborder="0">
</iframe>
Widget API
You can also fetch widget data programmatically:
fetch('https://metalapi.com/api/widget/data/YOUR_WIDGET_ID')
.then(response => response.json())
.then(data => {
console.log(data.rates);
});
Domain Restrictions
For security, widgets can be restricted to specific domains. Configure allowed domains in your widget settings.