Invoices
Use the invoices API to fetch information about an account's invoices. This is a read-only API, so it cannot be used for creating new or managing existing invoices.
For example, use this API to fetch all currently open invoices.
Depending on the information you need, there are a few ways to retrieve invoices:
- To retrieve all invoices, make a
GET
request tocrm/v3/objects/invoices
. - To retrieve a specific invoice, make a
GET
request to the above URL and specify an invoice ID. For example:crm/v3/objects/invoices/44446244097
. - To retrieve invoices that meet a specific set of criteria, you can make a
POST
request to the search endpoint and include filters in the request body. See an example of using the search endpoint below.
The response will include a few default properties, including the create date, last modified date.
To return specific properties, include a properties
query parameter in the request URL along with comma-separated property names. For example, making a GET
request to the following URL would result in the response below:
crm/v3/objects/invoices?properties=hs_invoice_status,hs_amount_billed
To view all available invoice properties, make a GET
request to crm/v3/properties/invoices
. Learn more about using the properties API.
Below are some common invoice properties that you may want to query.
Property name | Label in UI | Description |
---|---|---|
hs_invoice_status |
The current status of the invoice. Values include:
|
|
hs_amount_billed |
The amount billed on the invoice. |
|
hs_balance_due |
The balance due on the invoice. |
|
hs_due_date |
The date the invoice is due. |
|
hs_number |
The invoice number (e.g., |
You can use the search endpoint to retrieve invoices that meet a specific set of filter criteria. This will be a POST
request that includes your filter criteria in the request body.
For example, to search for all open invoices, you would make a POST
request to crm/v3/objects/invoices/search
with the following request body:
Note that the filters
array specifies the search criteria, while the properties
array specifies which properties to return.
While you cannot set associations using this API, you can retrieve association information by making a GET request to the following URL:
crm/v3/objects/invoice/{invoiceId}/associations/{associatedObjectName}
Associated objects can include contacts, companies, deals, line items, discounts, fees, and taxes. To create associations between an invoice and these objects, you can update the invoice in HubSpot.
Below is an example of how you might use this API combined with another API to get a specific set of association information.
To retrieve an invoice and the line items associated with it, make a GET
request to:
crm/v3/objects/invoice/{invoiceId}/associations/line_items
This will return the IDs of the currently associated line items, along with meta information about the association type.
You can then use the returned IDs to request more information about the line items through the line items API. For example, you could batch retrieve line items by ID by making a POST
request to the following URL with the request body below:
crm/v3/objects/line_items/batch/read
The response would be formatted as follows:
Thank you for your feedback, it means a lot to us.