Web API - Invalid origin

Following the https://docs.sentry.io/api/, I’m trying to fetch stats for a particular team as described at https://docs.sentry.io/api/teams/get-team-stats/

On hitting the endpoint, I’m getting 400 BAD REQUEST , with the response as: Invalid origin: http://localhost:8001

Code snippet:

    fetch( fetchURL,{
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer <token>'
        },
    })

You need to configure allowed domains / origins within your token settings.