Scope requirements
Scope requirements
Create fees
Fees can be created individually or in batches:- To create one fee, make a
POSTrequest to/crm/v3/objects/fees. - To create multiple fees, make a
POSTrequest to/crm/v3/objects/fees/batch/create.
properties object. You can also add an associations object to associate the fee with existing objects (e.g., invoices, quotes).
For batch create actions, you can enable multi-status errors which tell you which records were successfully created and which were not. Learn more about setting up multi-status error handling.
Create fees with property values
When creating a fee, you must include a set of fee properties to store the fee’s details. For example, to create a new fee, your request may look similar to the following:| Parameter | Type | Description |
|---|---|---|
hs_label Required | String | The label of the fee, displayed in HubSpot. |
hs_type Required | String | The type of the fee (either PERCENT or FIXED). |
hs_value Required | Number | The value of the fee. For a percentage-based fee, the value should be a number between 0 and 100. For a fixed fee, the value should be a number. |
Create fees with associations
To associate a fee with another object at the time of creation, you can include anassociations array in the request body. In the associations array, include an object for each association you want to create, which will specify the type of object you want to associate the fee with and the type of association.
You can also associate fees with other objects at a later time by updating the fee’s associations.
The following request body would create a fee and associate it with a quote (ID of 123456):
| Parameter | Type | Description |
|---|---|---|
to Required | Object | The object you want to associate the fee with, specified by its ID. |
types Required | Array | The type of association between the fee and the object. This array contains the following fields: associationCategory (the type of association, either HUBSPOT_DEFINED or USER_DEFINED) and associationTypeId (a unique identifier to indicate the association type between the fee and the other object). |
Create a batch of fees
To create multiple fees with one request, make aPOST request to /crm/v3/objects/fees/batch/create.
In the request body, include an inputs array with each fee’s properties and associations. For example, the following request body would batch create two fees, one fixed fee of $25 and one percentage-based fee of 5%:
Retrieve fees
The fees API provides endpoints for retrieving individual fees, all fees, and batches of fees. You can also search for fees that meet a specific set of criteria. When retrieving fees, you can include the parameters below in the request. When retrieving all fees or individual fees, include them as query parameters in the request URL. When retrieving batches of fees, include them in the request body.| Parameter | Description |
|---|---|
properties | A comma separated list of the properties to be returned in the response. If a requested property isn’t defined, it won’t be included in the response. If a requested property is defined but a fee doesn’t have a value, it will be returned as null. |
propertiesWithHistory | A comma separated list of the current and historical properties to be returned in the response. If a requested property isn’t defined, it won’t be included in the response. If a requested property is defined but a fee doesn’t have a value, it will be returned as null. |
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. |
Retrieve a single fee
To retrieve an individual fee, make aGET request to /crm/v3/objects/fees/{feeId}, where {feeId} is the ID of the fee you want to retrieve.
The response will include a set of default properties, including the create date and last modified date.
properties query parameter in the request URL along with comma-separated property names. For example:
/crm/v3/objects/fees/512?properties=hs_label,hs_type,hs_value
Retrieve all fees
To retrieve all fees, make aGET request to /crm/v3/objects/fees.
You can retrieve up to 100 fees in one request.
- To retrieve a specific amount under 100, add a value to the
limitparameter (e.g.,?limit=50). - To retrieve additional fees in subsequent requests (i.e. the fees after the limit was reached in your request), include the
afterparameter with theaftervalue returned from the previous request (e.g.,?after=123456).
GET /crm/v3/objects/fees?limit=50. In your response, under the paging object below the list of returned fees, the after value is the id of the next fee that would’ve been returned. To request 50 more fees, starting with the next returned value, make a GET request to /crm/v3/objects/fees?limit=50&after={id}.
Retrieve a batch of fees
To retrieve multiple fees by their IDs, make aPOST request to /crm/v3/objects/fees/batch/read.
In the request body, include the IDs of the fees you want to retrieve along with the properties you want returned:
Search for fees
You can use the search endpoint to retrieve fees that meet a specific set of filter criteria. Make aPOST request to /crm/v3/objects/fees/search and include your filter criteria in the request body.
For example, to search for all percentage-based fees:
Update fees
You can update fees individually or in batches.Update a single fee
To update an individual fee, make aPATCH request to /crm/v3/objects/fees/{feeId}. In the request body, include a properties object containing the properties that you want to update.
Note that you cannot update the fee’s associations using this endpoint. Instead, you’ll need to use the associations API to update the fee’s associations.
For example, to update a fee’s value:
Update a batch of fees
To update multiple fees at once, make aPOST request to /crm/v3/objects/fees/batch/update.
In the request body, include an inputs array with the ID and updated properties for each fee:
Associate existing fees
To associate an existing fee with other objects, you can set the association via the associations API by making aPUT request to:
/crm/v4/objects/fees/{feeId}/associations/default/{toObjectType}/{toObjectId}/
| Parameter | Description |
|---|---|
feeId | The ID of the fee you want to associate. |
toObjectType | The type of object that you want to associate the fee with (e.g., quote). |
toObjectId | The ID of the individual object that you want to associate the fee with. |
/crm/v4/objects/fees//associations/default/quote/
The response will return the details of the association, including the association details of each direction (quote-to-fee and fee-to-quote).
Remove an association
To remove an association between a fee and another object, make aDELETE request to /crm/v3/objects/fees/{feeId}/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///labels.
| Parameter | Description |
|---|---|
feeId | The ID of the fee you want to remove the association from. |
toObjectType | The type of object that you want to remove the association from (e.g., quote). |
toObjectId | The ID of the individual object that you want to remove the association from. |
associationTypeId | The ID of the association type you want to remove. |
Delete fees
To delete a fee, make aDELETE request to /crm/v3/objects/fees/{feeId}.
A successful request returns a 204 response with no body.
Delete a batch of fees
To delete multiple fees with one request, make aPOST request to /crm/v3/objects/fees/batch/archive.
In the request body, include an inputs array with the IDs of the fees you want to delete:
204 response with no body.