Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
how do i get the discord role data from a guild using an API call

i have this code in JS however it always returns a 403 error when i run it in my website. I have tried to run the same request with python and in postman and it gave me the data i wanted so the API is definitly not the problem. it also gave me a CORS error which i resolved by getting a chrome extension but i am not sure if that is the problem

const url="https://discord.com/api/v9/guilds/792895591255769098/members/search"

function callAPI() {
  var xhttp = new XMLHttpRequest();
  xhttp.open('GET', url);
  xhttp.setRequestHeader('Authorization', 'Bot <my bots token>');
  xhttp.send();
  console.log("sent request")
  console.log(xhttp)
}
callAPI.call() 

I also tried this code too but it returns the same result

async function getGuildRoles(){
  const response = await fetch('https://discord.com/api/guilds/792895591255769098/members',{
    method:'GET',
    headers: {
      Authorization: 'Bot <my bots token>'

    }
  });
  console.log(response.text());
  return response;
}
getGuildRoles.call()
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!