receiving a 404 error when attempting to associate an activity record with a company in HubSpot,

receiving a 404 error when attempting to associate an activity record with a company in HubSpot,

i selected all scopes for AUTH… im in sandbox account..

postman tested, browser tested, IDE, and hubspot custom code workflow

not sure what else to check. the record id’s are correct

any help appreciated

import requestsimport jsonfrom dotenv import load_dotenvimport osload_dotenv('/home/karien/PycharmProjects/VDVTEST/secretsSandbox.env')OAUTH = os.environ["OAUTH"]# set up API key and endpointactivity_id = '33143456330'activity_type = 'EMAIL'company_id = '15337741724'endpoint = f'https://api.hubapi.com/engagements/v1/engagements/associated/{activity_type}/companies/{company_id}'payload = {'engagement': {'type': activity_type}, 'associations': {'companyIds': [int(company_id)]}}# set up headers and payloadheaders = {'Content-Type': 'application/json', 'Authorization': 'Bearer {OAUTH}'.format(OAUTH=OAUTH)}# make request to HubSpot APIresponse = requests.post(endpoint, headers=headers, data=json.dumps(payload))# check response status codeif response.status_code == 204: print("Activity record associated with company successfully.") print(response.text)else: print("Error associating activity record with company: ", response.status_code)

Error associating activity record with company: 404

Hi, @karien :waving_hand: Can you share an example request and response, along with the error, please? Without more details, it’s challenging for the community to offer suggestions or troubleshoot your issue.

Best,

Jaycee

i have included all the detials in my post, thx Jaycee