Skip to main content

JavaScript Example

Fetch MM2 item values directly in the browser or Node.js.

Basic Item Lookup​

const API_KEY = 'rbx_your_key_here';

async function getItem(slug) {
const res = await fetch(`https://rblxvalue.com/api/v1/items?slug=${slug}`, {
headers: { 'X-Api-Key': API_KEY }
});
const data = await res.json();
return data.item || null;
}

async function main() {
const item = await getItem('seer');
if (!item) return console.log('Not found');

const est = Math.round(((item.value_source_a || 0) + (item.value_source_b || 0)) / 2);
console.log(`${item.name}: ${est.toLocaleString()} (demand: ${item.demand}/10)`);
}

main();

Search Items​

async function searchItems(query) {
const res = await fetch(
`https://rblxvalue.com/api/v1/items?search=${encodeURIComponent(query)}&limit=5`,
{ headers: { 'X-Api-Key': API_KEY } }
);
const data = await res.json();
return data.items || [];
}

const results = await searchItems('chroma');
results.forEach(item => console.log(item.name, item.value));

Set Lookup​

async function getSet(slug) {
const res = await fetch(`https://rblxvalue.com/api/v1/sets?slug=${slug}`, {
headers: { 'X-Api-Key': API_KEY }
});
const data = await res.json();
return data.set || null;
}

const set = await getSet('chroma-evergreen-set');
console.log(`${set.name}: ${set.total_value.toLocaleString()} total`);
set.items.forEach(i => console.log(` - ${i.name}: ${i.value}`));

Trade Calculator​

async function calcTrade(yourItems, theirItems) {
async function getVal(slug) {
const item = await getItem(slug);
if (!item) return 0;
return Math.round(((item.value_source_a || 0) + (item.value_source_b || 0)) / 2);
}

const [yours, theirs] = await Promise.all([
Promise.all(yourItems.map(getVal)),
Promise.all(theirItems.map(getVal)),
]);

const yourTotal = yours.reduce((a, b) => a + b, 0);
const theirTotal = theirs.reduce((a, b) => a + b, 0);

return {
yourTotal,
theirTotal,
difference: theirTotal - yourTotal,
fair: Math.abs(theirTotal - yourTotal) / Math.max(yourTotal, 1) < 0.1,
};
}

const result = await calcTrade(['seer', 'ginger'], ['chroma-scythe']);
console.log('Fair trade:', result.fair);
console.log('Difference:', result.difference);