'Request failed with status code 403 - magiceden api with axios

Please help me, I'm so stuck on this problem: I'm making a request magiceden.io API with Axios on Javascript and the request is not working (Request failed with status code 403).

My URL request: https://api-mainnet.magiceden.io/new_collections

My code:

axios.get("https://api-mainnet.magiceden.io/new_collections", {
    headers: {
        "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
        "User-Agent": "Mozilla/5.0",
    },
}).then((res) => {
     console.log(res.data);
}).catch((err) => {
     console.log(err.message);
});


Solution 1:[1]

Status 403 means that the request is a forbidden access. It is probably because MagicEden now uses Cloudflare protection which restricts access. You can try changing your request headers which can bypass the cloudflare protection.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Basu Dev Tyagi