Error with params

    def get_fills(self):
        params = {
            'limit': 50,
        return self._send_message('get', '/orders/historical/fills')
        # return self._send_message('get', '/orders/historical/fills', params=params)

Without params, it works well, but with params, it gives an error with code 401. Did I miss anything?

The URL with params:

The URL without params:

Check Authenticating Messages. With Advanced Trade query part should not be included in requestPath when creating signature.

1 Like

Make sure you aren’t signing it with the params. Regardless of what your params are, the signature should always just use

But then the actual endpoint that you call should be

Idk if this helps, but here’s my code in JS using axios. It’s a little specific to my app, but it shows how I’m differentiating the urls.

async function getLimitedFillsNew(userID, limit) {
  return new Promise(async (resolve, reject) => {
    try {
      const userAPI = cache.getAPI(userID);
      const secret = userAPI.CB_SECRET;
      const key = userAPI.CB_ACCESS_KEY;

      const method = 'GET';
      const path = "/api/v3/brokerage/orders/historical/fills";
      const body = "";

      function sign(str, apiSecret) {
        const hash = CryptoJS.HmacSHA256(str, apiSecret);
        return hash.toString();
      const timestamp = Math.floor( / 1000).toString();
      const str = timestamp + method + path + body
      const sig = sign(str, secret)

      const options = {
        method: 'GET',
        timeout: 10000,
        url: ``,
        headers: {
          Accept: 'application/json',
          'CB-ACCESS-KEY': key,
          'CB-ACCESS-SIGN': sig,
          'CB-ACCESS-TIMESTAMP': timestamp

      let response = await axios.request(options);
    } catch (err) {

@muktupavels Thank you! This solves the issue.

@jmicko Thank you for your reply.