JavaScript Example
Fetch MM2 item values in the browser or Node.js with the v2 API.
const API_KEY = 'your_key_here';
const BASE_URL = 'https://api.rblxvalue.com/v2';
async function api(path) {
const res = await fetch(BASE_URL + path, { headers: { 'X-Api-Key': API_KEY } });
return res.json();
}
Item lookup (slug or acronym)
async function getItem(ident) {
const data = await api(`/items/${encodeURIComponent(ident)}`);
return data.item || null;
}
const item = await getItem('corrupt'); // also works: 'CORR', 'Corrupt'
console.log(`${item.name}: ${item.value.toLocaleString()} (demand: ${item.demand}/10)`);
console.log(`MM2Values ${item.value_source_a} · Supreme ${item.value_source_b}`);
Search items
async function searchItems(query) {
const data = await api(`/items?search=${encodeURIComponent(query)}&limit=5`);
return data.items || [];
}
(await searchItems('chroma')).forEach(i => console.log(i.name, i.value));
Set lookup (by name or by an item in the set)
async function getSet(ident) {
const data = await api(`/sets/${encodeURIComponent(ident)}`);
return data.set || null;
}
const set = await getSet('celestial'); // 'constellation' returns the same set
console.log(`${set.name}: ${set.total_value.toLocaleString()} total`);
set.items.forEach(i => console.log(` - ${i.name}: ${i.value}`));
Value history
async function getHistory(ident, period = '1Y') {
const data = await api(`/history/${encodeURIComponent(ident)}?period=${period}`);
return data.history || [];
}
for (const point of await getHistory('corrupt', 'ALL')) {
console.log(point.date, point.source, point.value);
}
Trade calculator
async function calcTrade(yourItems, theirItems) {
const val = async (ident) => (await getItem(ident))?.value ?? 0;
const [yours, theirs] = await Promise.all([
Promise.all(yourItems.map(val)),
Promise.all(theirItems.map(val)),
]);
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,
};
}
console.log(await calcTrade(['corrupt'], ['luger']));