Learn how to use the object API endpoints to create and manage records or activities.
objectTypeId
of an object in the endpoints. For example, to create contacts, you’d make a POST
request to crm/v3/objects/0-1
and to create courses, the request would be to crm/v3/objects/0-410
.
In this article, learn the basics of how to use the object APIs. For certain objects, you can refer to object-specific guides with examples and other details about unique functionality: Companies, Contacts, Deals, Tickets, Calls, Communications, Custom objects, Emails, Feedback submissions, Invoices, Leads, Marketing events, Meetings, Notes, Orders, Payments, Postal mail, Products, Quotes, Subscriptions, Tasks, Users.
GET
request to /crm/v3/objects/{objectTypeId}/{recordId}
.GET
request to /crm/v3/objects/{objectTypeId}
.POST
request to crm/v3/objects/{objectTypeId}/batch/read
and include the id
values of the records in the request body. The batch endpoint cannot retrieve associations. Learn how to batch read associations with the associations API.Parameter | Description |
---|---|
properties | A comma separated list of the properties to be returned in the response. If the requested record doesn’t have a value for a property, it will not appear in the response. |
propertiesWithHistory | A comma separated list of the current and historical properties to be returned in the response. If the requested record doesn’t have a value for a property, it will not appear in the response. |
associations | A comma separated list of objects to retrieve associated IDs for. Any specified associations that don’t exist will not be returned in the response. Learn more about the associations API.Note: this parameter is not supported in the batch read endpoint. |
idProperty | Indicates the unique identifier property used to identify records. You only need to use this parameter if retrieving by a custom unique identifier property. |
GET
request to /crm/v3/objects/0-47/{meetingId}?properties=hs_meeting_body,hs_timestamp
and your response would look similar to the following:
POST
request to crm/v3/objects/{objectTypeId}
.POST
request to /crm/v3/objects/{objectTypeId}/batch/create
.properties
object. You can also add an associations
object to associate your new record with existing records (e.g., companies, deals), or activities (e.g., meetings, notes).
GET
request to /crm/v3/properties/{objectTypeId}
. Learn more about the properties API and how to format property values.
The table below includes the objects for which records can be created via API and the properties required for creation.
Type ID | Object | Required properties to create |
---|---|---|
0-2 | Companies | At least one of domain (recommended) or name |
0-1 | Contacts | At least one of of email (recommended), firstname , or lastname |
0-3 | Deals | dealname , dealstage and pipeline |
0-5 | Tickets | subject (the ticket’s name), hs_pipeline_stage (the ticket’s status), and hs_pipeline |
0-421 | Appointments | hs_appointment_start |
0-48 | Calls | hs_timestamp |
0-18 | Communications | hs_timestamp and hs_communication_channel_type |
0-410 | Courses | hs_course_name |
2-XXX | Custom objects | The required properties specified in your object’s schema. |
0-49 | Emails | hs_timestamp and hs_email_direction |
0-136 | Leads | hs_associated_contact_email , hs_associated_contact_lastname , hs_lead_name , hs_associated_company_domain , hs_associated_contact_firstname , and hs_associated_company_name |
0-8 | Line items | Recommended properties |
0-420 | Listings | hs_name |
0-54 | Marketing events | hs_event_description and hs_event_name |
0-47 | Meetings | hs_timestamp |
0-46 | Notes | hs_timestamp |
0-123 | Orders | hs_order_name |
0-116 | Postal mail | hs_timestamp |
0-7 | Products | hs_sku , hs_folder , price , name , and description |
0-14 | Quotes | hs_title and hs_expiration_date |
0-162 | Services | hs_name , hs_pipeline , and hs_pipeline_stage |
0-69 | Subscriptions | hs_name |
0-27 | Tasks | hs_timestamp |
0-115 | Users | hs_internal_user_id and hs_email |
associations
object. In the associations
object, you should include the following:
Parameter | Description |
---|---|
to | The record or activity you want to associate with the record, specified by its unique id value. |
types | The type of the association between the record and the record/activity. Include the associationCategory and associationTypeId . Default association type IDs are listed here, or you can retrieve the value for custom association types (i.e. labels) via the associations API. |
idProperty
parameter with a custom unique identifier property. If you want to create and update records at the same time, learn how to upsert records.
PATCH
request to /crm/v3/objects/{objectTypeId}/{recordId}
, and include the data you want to update.POST
request to /crm/v3/objects/{objectTypeId}/batch/update
. In the request body, include an array with the identifiers for the records and the properties you want to update.hs_merged_object_ids
field to update a record using the basic update endpoint. However, these values are not supported when updating records using the batch update endpoint.email
for contacts. Following the request, if the records already exist, they’ll be updated and if the records don’t exist, they’ll be created.
To upsert records, make a POST
request to /crm/v3/objects/{objectTypeId}/batch/upsert
. In your request body, include the idProperty
parameter to identify the unique identifier property you’re using. Include that property’s value as the id
and add the other properties you want to set or update.
email
as the idProperty
for contacts. To complete a partial upsert, use a custom unique identifier property as the idProperty
instead.email
as the identifier, your request would look similar to the following:
PUT
request to /crm/v3/objects/{objectTypeId}/{fromRecordId}/associations/{toObjectTypeId}/{toRecordId}/{associationTypeId}
.DELETE
request to the following URL: /crm/v3/objects/{objectTypeId}/{fromRecordId}/associations/{toObjectTypeId}/{toRecordId}/{associationTypeId}
.associationTypeId
value, refer to this list of default values, or make a GET
request to /crm/v4/associations/{fromObjectTypeId}/{toObjectTypeId}/labels
.hs_pinned_engagement_id
field in your create, update, or upsert request. In the field, include the id
of the activity to pin, which can be retrieved by making a GET
request to /crm/v3/objects/{objectTypeId}/{recordId}
for calls, communications, emails, meetings, notes, postal mail, or tasks. You can pin one activity per record, and the activity must already be associated with the record prior to pinning.
For example, to set or update an existing deal’s pinned activity, your request could look like:
DELETE
request to /crm/v3/objects/{objectTypeId}/{recordId}
.POST
request to /crm/v3/objects/{objectTypeId}/batch/archive
and include the record ID values as the id
inputs in your request body.