I’m having trouble with the HubSpot CRM API when trying to create new deals. Even though I’m sending all the required data in my POST request, the API keeps creating completely empty deals with no properties set.
Here’s my current implementation:
import json
import requests
api_token = "YOUR_API_TOKEN"
endpoint = 'https://api.hubapi.com/crm/v3/objects/deals?hapikey={}'.format(api_token)
request_headers = {"Content-Type": "application/json"}
deal_data = {
'deal_amount': "2500.00",
'close_date': '2021-06-15T10:30:00.000Z',
'deal_title': 'Website redesign project',
'stage': 'negotiation',
'owner_id': "1234567890",
'deal_pipeline': 'sales'
}
api_response = requests.post(endpoint, headers=request_headers, data=json.dumps(deal_data))
print(api_response.text)
The API call executes successfully and returns a 200 status code, but when I check the created deal in HubSpot, all the fields are blank. What could be causing this issue with the data not being properly saved?