Skip to content

Instantly share code, notes, and snippets.

@nkelner
Last active July 22, 2019 20:34
Show Gist options
  • Save nkelner/a1c4a6e8dfc18cac52451de8689323e8 to your computer and use it in GitHub Desktop.
Save nkelner/a1c4a6e8dfc18cac52451de8689323e8 to your computer and use it in GitHub Desktop.
Hubspot <> Datawarehouse API Instructions

Hubspot <> Datawarehouse API Instructions

Authentication

Please use the api key that I've shared out of band. From here on out the api key will be referenced at {key}

Request

To update a contact's last purchase date make a POST resquest to https://api.hubapi.com/contacts/v1/contact/email/{contact_email}/profile?hapikey={key} where {contact_email} is the email of the contact (customer) whose last purchase date we'd like to update

The Content-Type header should be set to 'application/json'

The POST request body should be JSON and the name of the property to update is last_purchase_date Example POST body below:

{
  "properties": [
    {
      "property": "last_purchase_date",
      "value": "1559102400000"
    }
  ]
}

Note that the "value" is a unix timestamp in milliseconds. The timestamp should be the desired date at 12:00:00am UTC.

Response Codes

  • 204 when a contact is updated
  • 400 if there is a problem with the data in the request body. You'll get a message in the response body detailing the issues with the data.
  • 401 when an unauthorized request is made, such as an expired access token of wrong API key.
  • 404 when there is no existing record with the email address specified in the request URL.
  • 500 when an internal server error occurs. Please alert us in the API Forum if you receive an HTTP 500 error.

More info on this endpoint here: https://developers.hubspot.com/docs/methods/contacts/update_contact-by-email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment