Skip to main content

HubSpot API written in python

Project description


HubSpot API wrapper written in Python.


pip install hubspot-python


- requests


Client instantiation

from hubspot.client import Client


Create a new calendar task

data = {
  "eventDate": 1425760557000,
  "category": "BLOG_POST",
  "state": "TODO",
  "campaignGuid": "f43fe9fd-4082-4a45-93d8-cb8a88f01654",
  "name": "Test Blog Task With topics 3",
  "description": "Cool Post with Topics",
  "ownerId": 13316,
  "topicIds": [
  "contentGroupId": 343029322
response = client.calendar.create_task(data)


Get all companies

response = client.companies.get_companies(data)

Create a Company

data = {
    "name": "A company name",
    "description": "A company description"
response = client.companies.create_company(data)

Delete a Company

response = client.companies.delete_company(COMPANY_ID)

Get Recently Created Companies

response = client.companies.get_recently_created_companies()

Get a Company

response = client.companies.get_company(COMPANY_ID)

Contact Lists

Get contact lists

response = client.contact_lists.get_contact_lists()

Create a new contact list

data = {
    "name": "tweeters",
    "dynamic": true,
    "portalId": 62515,
            "operator": "EQ",
            "value": "@hubspot",
            "property": "twitterhandle",
            "type": "string"
response = client.contact_lists.create_contact_list(data)

Delete a contact list

response = client.contact_lists.delete_contact_list(CONTACT_LIST_ID)

Get recently added contacts from a list

response = client.contact_lists.get_recently_added_contacts_in_a_list()

Get a contact list by its unique ID

response = client.contact_lists.get_contact_list(CONTACT_LIST_ID)

Add existing contacts to a list

data = {
  "vids": [
  "emails": [
response = client.contact_lists.add_contact_to_list(CONTACT_LIST_ID, data)


Get all contacts

response = client.contacts.get_contacts()

Create a new contact

data = {
    "email": "",
    "firstname": "Adrian",
    "lastname": "Mott",
    "website": "",
    "company": "HubSpot",
    "phone": "555-122-2323",
    "address": "25 First Street",
    "city": "Cambridge",
    "state": "MA",
    "zip": "02139",
response = client.contacts.create_contact(data)

Delete a contact

response = client.contacts.delete_contact(CONTACT_ID)

Get recently created contacts

response = client.contacts.get_recently_created_contacts()

Get a contact list by its unique ID

response = client.contacts.get_contact(CONTACT_ID)


Get all deals

response =

Create a Deal

data = {
    "dealname": "Tim's Newer Deal",
    "dealstage": "appointmentscheduled",
    "pipeline": "default",
    "hubspot_owner_id": "24",
    "closedate": 1409443200000,
    "amount": "60000",
    "dealtype": "newbusiness",
response =

Delete a Deal

response =

Get Recently Created Deals

response =

Get a contact list by its unique ID

response =

Fields (Properties)

Get all fields

response = client.fields.get_fields(MODULE)


Get all fields

response = client.integrations.get_account_details()

Get all fields

response = client.integrations.get_daily_api_usage()


Viewing Settings

response = client.webhooks.get_settings()

Updating Settings

data = {
    "webhookUrl": "", 
    "maxConcurrentRequests": 25

response = client.webhooks.update_settings(data)

Get Subscriptions

response = client.webhooks.get_subscriptions()

Create a New Subscription

data = { 
    "subscriptionDetails" : {
        "subscriptionType" : "company.propertyChange", 
        "propertyName" : "companyname" 
    "enabled": False

response = client.webhooks.create_subscription(data)

Update a Subscription

data = { 
    "enabled": False

response = client.webhooks.create_subscription(SUBSCRIPTION_ID, data)

Delete a Subscription

response = client.webhooks.delete_subscription(SUBSCRIPTION_ID)


Get workflows

response = client.workflows.get_workflows()

Get workflow

response = client.workflows.get_workflow(WORKFLOW_ID)

Create a workflow

data = {
    "name": "Test Workflow",
    "type": "DRIP_DELAY",
    "onlyEnrollsManually": true,
    "actions": [
            "type": "DELAY",
            "delayMillis": 3600000
            "newValue": "HubSpot",
            "propertyName": "company",
            "type": "SET_CONTACT_PROPERTY"
            "type": "WEBHOOK",
            "url": "",
            "method": "POST",
            "authCreds": {
                "user": "user",
                "password": "password"
response = client.workflows.create_workflow(data)

Delete a Deal

response = client.workflows.delete_workflow(WORKFLOW_ID)

Enroll a contact into a workflow

response = client.workflows.enroll_a_contact_into_workflow(WORKFLOW_ID, EMAIL)

Unenroll a contact from a workflow

response = client.workflows.unenroll_a_contact_into_workflow(WORKFLOW_ID, EMAIL)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hubspot-python, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size hubspot-python-1.0.0.tar.gz (9.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page