Cancel orders error

Hallo I’m trying to cancel existing pending orders

using

“/api/v3/brokerage/orders/batch_cancel”

with payload

    payload = json.dumps({
      "order_ids": [
        id
    ]
    })

the api returns a not found html page…

api = CAuthAPI(self.api_key, self.api_secret, self.api_url, app=self)
return api.cancelOrders(market, open_order)

with

def cancelOrders(self, market: str = “”, id = “”) → pd.DataFrame:
“”“Cancels an order”“”
print(" api cancel orders")

    payload = json.dumps({
      "order_ids": [
        id
    ]
    })
    print(payload)
	
    return self.auth_api("POST", "/api/v3/brokerage/orders/batch_cancel", payload)

where is the problem ?

thank you

Hi there,

Thank you for using Coinbase forum.

It looks like you are trying to use the Coinbase Prime API to cancel existing pending orders. The endpoint you are using is “/api/v3/brokerage/orders/batch_cancel” and you are passing the order ID in the payload. However, it looks like you are not passing the correct parameters in the payload. The correct payload should be in the following format: payload = json.dumps({ “order_ids”: [ { “market”: market, “order_id”: id } ] }) Make sure you are passing the correct parameters in the payload and that the order ID is valid. If you are still having issues, please contact Coinbase Prime support for further assistance.

Hope this helps.

I’m not from Coinbase btw but it works for me. I’m NOT setting “market”: market, “ , that is not even part of the documentation on Cancel Orders | Coinbase Cloud so I don’t know what @Sandy is on about.

But what might be the issue: are you setting the header (correctly)?

Thank you Darrow

if it works for you is already a good information…
I will double check the headers… I used same structure as all other APIs
that are working …

solve…

stupid error…

I had a double slash “/” at the end of URL and at the beginning of the request…