Authentication

At Routefusion we use bearer tokens in an Authorization header.

Please email us at [email protected]! to get an API key!

In your headers, add an Authorization header and then a string with your API key/token.

Once you have your API key, run this script below to make sure you are authenticating correctly!

const axios = require('axios');
let token = 'YOUR TOKEN'
let data = JSON.stringify({
  query: `query myUser {
    myUser {
        id
        identifier
        email
        first_name
        last_name
        admin
        organization {
            id
            identifier
            admin
            restricted
            enabled
        }
    }
}`,
  variables: {}
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://sandbox.external.routefusion.com/graphql',
  headers: {
    'Authorization': `Bearer ${token}`, 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});