Leads API Methods

Update a Lead

PUT  /leads/v1/lead/:lead_guid

For a given portal, update information for a specific lead.

With this PUT request you're making to update a lead, in the request body, you'll need to place JSON string(s) containing the elements you wish to update, along with the lead GUID, which is required. Note that this does not have to be all elements and in fact should just be those which you wish to change. Please note that as mentioned above, you MUST include in the lead GUID in the request body, as well as the request URL.

You can update one or more fields in each request. We recommend bundling your updates into as few requests as possible to help stay under the rate limits.

For instance, with this method, you can close leads as customers (by adding a timestamp to the "closedAt" field), delete leads using the "isDeleted" field, etc...

Please Note  The Content-type for your PUT request must be not be "application/www-form-encoded", it should be "application/json", otherwise your update will not be properly parsed by the API servers and will cause no updates to be applied.

Required Parameters How to use Description
HubSpot OAuth Access Token access_token=X - Used in the request URL The HubSpot API key for the portal that you're making the call for.
Lead GUID Used in the request URL and the request body - required in both places. Unique identifier for a particular lead.
Optional Parameters How to use Description
Any Field to Update Used in the request body

The field that you want to update, in JSON format. For an example, please see the JSON object below. You can update any field as long as it's editable. Most fields are editable and you can view a full list of fields in the Search Leads method. There are also certain fields and objects on lead records that are not editable or writable at all, as listed below. All other fields are editable at this time (See the Search Leads method for explanation of all leads).

The lead fields in HubSpot that are not editable are the following:

  • "guid" - Unique identifier for a lead.
  • "id" - The ID of the lead.
  • "leadId" - Internal ID of a lead.
  • "isCustomer" - Marking whether a lead has been closed as a customer. To change this field, you should add a timestamp in the "closedAt" field.
  • "lastConvertedAt" - The time at which a lead last converted.
  • "lastModifiedAt" - The time at which the lead was last modified in any way.
  • "leadJsonLink" - This link can be used to access the lead's JSON object
  • "leadLink" - The link where you can view the lead in the HubSpot Leads application.
  • "LeadNurturingActive" - Boolean value letting you know whether the lead is enrolled in a lead nurturing campaign or not.
  • "numConversionEvents" - The number of times a lead has converted.
  • "portalId" - The HubSpot Hub ID or portal ID that you're working in.
  • "publicLeadLink" - A public link that let's anyone view lead details.
  • "sourceValueModifiedAt" - The timestamp at which the source of the lead was modified.
  • "analyticsDetails" - All fields in this object are not editable. These fields represent certain analytics within the lead object that we collect.
  • "crmDetails" - All fields in this object are not editable. These are certain CRM detail fields that we collect on each lead. These will change if a portal is integrated with Salesforce.com.
  • "leadConversionEvents" - Fields in the leadConversionEvents objects are form fields from forms that have been submitted by leads and are not editable on the lead object. You can add new fields here, by submitting another conversion event.

Example URL:  https://api.hubapi.com/leads/v1/lead/8a41f2f22906b93a012906b9438f0008?access_token=demooooo-oooo-oooo-oooo-oooooooooooo

Example request body. This request will update the city and state of the lead, as well as close it at the time specified in the closeedAt timestamp:

        {
            "city": "Cambridge",
            "state": "Massachusetts",
            "closedAt": "1323293954000",
            "guid": "8a41f2f22906b93a012906b9438f0008"
        }
    

The response from this API call are standard REST-style HTTP response codes that mark success or failure, with meta information about the call that was made. There will be no data in the response body.

  • 200 for a successful lead update.
  • 404 when an the lead you're trying to update wasn't found.
  • 500 when an internal server error occurs.