Goals

In HubSpot, goals are used to create user-specific quotas for their sales and services teams based on templates provided by HubSpot. The goals API allow you to retrieve goals data in your HubSpot account. 

Learn more about using goals in HubSpot.

Retrieve goals

You can retrieve an individual goal or all goals in your account.

  • To request all goals, make a GET request to /crm/v3/objects/goal_targets.
  • To retrieve an individual goal, make a GET request to /crm/v3/objects/goal_targets/{goalTargetId}/.
  • To retrieve goals that meet a specific set of criteria, you can make a POST request to the search endpoint and include filters in the request body. Learn more about searching the CRM.

For example, to retrieve a goal with an ID of 44027423340, the request URL would be the following:

https://api.hubapi.com/crm/v3/objects/goal_targets/44027423340/

The response will include a few default properties, including the create date, last modified date.

JSON
// Example response
{
 "id":"87504620389",
 "properties":{
  "hs_createdate":"2021-11-30T22:18:49.923Z",
  "hs_lastmodifieddate":"2023-12-11T19:21:32.851Z",
  "hs_object_id":"87504620389"
  },
 "createdAt":"2021-11-30T22:18:49.923Z",
 "updatedAt":"2023-12-11T19:21:32.851Z",
 "archived":false
}

To return specific properties, include a properties query parameter in the request URL along with comma-separated property names. Learn more about user properties below.

For example, making a GET request to the following URL would result in the response below:

crm/v3/objects/users?properties=hs_job_title,hs_additional_phone

JSON
// Example response
{
 "id":"87504620389",
 "properties":{
  "hs_createdate":"2021-11-30T22:18:49.923Z",
  "hs_lastmodifieddate":"2023-12-11T19:21:32.851Z",
  "hs_object_id":"87504620389"
  },
 "createdAt":"2021-11-30T22:18:49.923Z",
 "updatedAt":"2023-12-11T19:21:32.851Z",
 "archived":false
}

Goals properties

When making a GET request to the Goals API, you can also request specific goal properties:

  • hs_goal_name: This is a string that denotes the name of a goal.
  • hs_target_amount: Number that denotes the goal target value.
  • hs_start_datetime: Goal's start date as a UTC timestamp.
  • hs_end_datetime: Goal's end date as a UTC timestamp.
  • hs_created_by_user_id: HubSpot UserId of the person who created the goal, not the one assigned to a goal.

For example, if you wanted to include all properties listed above, the request URL may resemble the following:

https://api.hubapi.com/crm/v3/objects/goal_targets/44027423340?properties=hs_goal_name,hs_target_amount,hs_start_datetime,hs_end_datetime,hs_created_by_user_id

The response may look similar to the JSON excerpt below:

// Example response for GET request to /crm/v4/objects/goal_targets/{goal_target_id}/ { "id": '44027423340', "properties": { "hs_created_by_user_id": '885536', "hs_createdate": '2023-02-15T15:53:07.080Z', "hs_end_datetime": '2024-01-01T00:00:00Z', "hs_goal_name": 'Revenue Goal 2023', "hs_lastmodifieddate": '2023-02-16T10:02:21.131Z', "hs_object_id": '44027423340', "hs_start_datetime": '2023-12-01T00:00:00Z', "hs_target_amount": '2000.00' }, "createdAt": '2023-02-15T15:53:07.080Z', "updatedAt": '2023-02-16T10:02:21.131Z', "archived": false }

Was this article helpful?
This form is used for documentation feedback only. Learn how to get help with HubSpot.