osm api download data from .gpx file not file


I’m trying to load the content of a file with the osm api to display it in a web app, but I’m getting a 302 error.

TypeError: NetworkError when attempting to fetch resource. 

is it only possible to download the file and not just load the content of the file?

  let osm_server_load_gpx = function (id) {
    let n = "Bearer " + localStorage.getItem("openstreetmap_token");

    const myHeaders = new Headers({
      Authorization: n,

    return fetch("https://api.openstreetmap.org/api/0.6/gpx/" + id + "/data", {
      method: "GET",
      headers: myHeaders,
      redirect: "follow",
      .then((response) => response.text())
      .then((data) => {
        console.log("data:" + data);

      .catch((error) => {
        alert("error: " + error);

greetings perry