Build minutes not reflected accurately in API

I want to use the API to look up how many build minutes I have used on my account. I wrote this code:

const NetlifyAPI = require('netlify');

async function main() {
    const netlifyClient = new NetlifyAPI(process.env.NETLIFY_AUTH_TOKEN);
    let account = await netlifyClient.getAccount({account_id: process.env.NETLIFY_ACCOUNT_ID});
    console.log(`Account slug: ${account.slug}`);
    console.log(`Build minutes used: ${account.capabilities.build_minutes.used} of ${account.capabilities.build_minutes.included}`);
}

main();

This is the output:

Account slug: williamjacksn
Build minutes used: 0 of 300

But the website tells a different story:

Why does the data from the API not match the website?

Hey William :wave:

We recently updated the team builds status endpoint to account for hourly updates (this is what the builds page is using) :point_right: https://api.netlify.com/api/v1/williamjacksn/builds/status

At that endpoint, you’ll be able to get your current total minutes used in minutes.current and your included minutes at minutes.included_minutes

Unfortunately this is not part of the Netlify API JS client at this time. We hope to add it at some point and will follow up here.

Best,
Jonathan

1 Like