Scope requirements
Scope requirements
Create leads
To create new leads, make aPOST request to /crm/v3/objects/leads.
In the request body, include any details about the lead in a properties object. Your new lead:
- Must have a lead name, specified using the
hs_lead_nameproperty. - Must be associated with an existing contact.
- Should only be assigned to a user with a seat. (Leads can only be worked via the workspace).
Properties
Lead details are stored in lead properties. There are default HubSpot lead properties, but you can also create custom lead properties. To view all available properties, you can retrieve a list of your account’s lead properties by making aGET request to /crm/v3/properties/leads.
See the table below for some common properties for leads:
Associations
When creating a new lead you must associate the lead with existing records in an associations object provided in the request body. In the associations object, you should include the following:
For example, to create a warm lead named “Jane Doe” who has a type of New Business, your request body would resemble the following:
Retrieve leads
You can retrieve leads individually or in batches.- To retrieve an individual lead, make a
GETrequest to/crm/v3/objects/leads/{leadsId}. - To request a list of all leads, make a
GETrequest to/crm/v3/objects/leads.
- To retrieve a batch of specific leads by ID, make a
POSTrequest tocrm/v3/objects/leads/batch/read. The batch endpoint can’t retrieve associations. Learn how to batch read associations with the associations API.
Property parameter to retrieve leads by leadID or a custom unique identifier property. By default, the id values in the request refer to the record ID (hs_object_id), so the idProperty parameter isn’t required when retrieving by record ID. If you’re using a custom unique value property to retrieve leads, you must include the idProperty parameter.
Update leads
You can update leads individually or in batches. For existing leads, the leads ID is a unique value, so you can useleadsId to update leads via the API.
To update an individual lead by its lead ID, make a PATCH request to /crm/v3/objects/leads/{leadsId}, and include the data you want to update in the request body.
Associate existing leads with records
To associate a lead with other CRM records or an activity, make aPUT request to /crm/v3/objects/leads/{leadsId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}.
To retrieve the
associationTypeId value, refer to this list of default values, or make a GET request to /crm/v4/associations/{fromObjectType}/{toObjectType}/labels.Remove an association
To remove an association between a lead and a record or activity, make aDELETE request to the following URL: /crm/v3/objects/leads/{leadId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}.
If you remove all primary associations to the lead, the lead will automatically be deleted.
Delete leads
You can delete leads individually or in batches, which will add the lead to the recycling bin in HubSpot. You can later restore the lead within HubSpot. To delete an individual lead by its ID, make aDELETE request to /crm/v3/objects/leads/{leadId}.
Learn more about deleting leads in the reference documentation.