Where do i get the accountId to liquidate?

does it not work outside of market hours? Or is there a specific id like the orders i have to fetch for?

It will not work outside of market hours - you’re placing an order technically (to zero out your position) so it needs to be during market hours. If it’s still giving you trouble, make sure you use the ID of one of your trading accounts. You can find the accounts associated with your user (typically one single account but some people like to trade multiple accounts) by calling the /account/list endpoint. It will return an array of at least one account for you to choose from. Make sure that you match the base URLs up - if you’re trying to liquidate on LIVE, use the LIVE endpoint for /account/list (and vice versa for simulation mode)