How do you properly request from Traffic Stats API?

Hey I’ve been trying to request data from the traffic stats api. I registered for a key and on my Dashboard it says I have access to Traffic Stats. I am following the docs, and I can’t seem to understand why my post request is returning with a 400. I am unsure of what I am doing wrong.

let res = await axios({
url: 'https://api.tomtom.com/traffic/trafficstats/maps/1?',

headers: {
  'Content-Type': 'application/json',
},
params: {
  key: 'KANYEWEST',
  geometry: {
    type: 'Polygon',
    coordinates: [
      [
        [19.433904442477314, 51.817044485417625],
        [19.407226981038946, 51.784535147052594],
        [19.42841202394746, 51.7401001934999],
        [19.471959056587565, 51.72430675993962],
        [19.500205780461073, 51.73135374291081],
        [19.500205780461073, 51.75831652893055],
        [19.493144099496106, 51.80904062983166],
        [19.44959706685603, 51.8194696155619],
        [19.433904442477314, 51.817044485417625],
      ],
    ],
  },
  dateRange: {
    from: '2019-01-01',
    to: '2020-01-31',
  },
},

method: 'POST',
timeout: 20000, }).then((res) => {
      console.log('response ' + res)
    }).catch((err) => {
      console.log('elol ' + err)
    })

On the docs, it gives an example of a sample JSON request. I thought this is something I put in my parameters? If it is not please let me know how to structure my api request.
Here are the docs: https://developer.tomtom.com/traffic-stats/traffic-stats-apis/available-maps

Thanks

Hi.

If you will move your key parameter from the JSON body to the URL, it will work fine.

Regards,
Mateusz