Hi @TKucur , happy to try and help here. In your original message's error response I am seeing it state "INVALID_AUTHENTICATION". Since you're using the hapikey in your URL request, this is referring to that key being invalid. I would first recommend following the instructions in this developer documentation to migrate your script away from using hapikeys, and instead use Private Apps. HubSpot is sunsetting the ability to use hapikeys as authentication at the end of this month.
Once you've replaced the authentication method, double check that you've also included a JSON Body with your HTTP request, stating the association type and definition