Create Invoice API Validation Error

Hi community,

I’m trying to create HubSpot Invoices through API. The Goal is to migrate external invoices to HubSpot. Currently, I’m currently testing the endpoints to confirm this is feasible.

I hit a blocker, for the API Endpoint requires a Line Item to be associated with the Invoice. So I tried add Line Items to the “associations” object in the payload, but I still get the “VALIDATION_ERROR”
Here’s my payload:

{
 "associations": [
 {
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 409 // Invoice to Line Item
 }
 ],
 "to": {
 "id": "36271415992" // Line Item ID
 }
 },
 {
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 179 // Invoice to Company
 }
 ],
 "to": {
 "id": "36650790515" // Company ID
 }
 }
 ],
 "properties": {
 "subject": "Consolidated Services",
 "hs_invoice_date": "2024-04-12T11:36:31.000Z",
 "hs_invoice_status": "paid",
 "hs_number": "INV-88071",
 "wrs_id": "string",
 "hs_currency": "USD",
 "exported_qbgl": "true",
 "hs_net_payment_term": "0",
 "hs_payment_date": "2024-04-12T15:36:31.000Z"
 }
}

I tried using a Line Item associated with a Deal, creating a loose Line Item and using it’s ID, but nothing seems to meet the requirement of associated Line Items.
The error I get is always the one below:

{
 "status": "error",
 "message": "Validation Error",
 "correlationId": "59c5c02e-13b5-43fc-aa14-df18fca7dee3",
 "errors": [
 {
 "subCategory": "INVALID_NUMBER_OF_ASSOCIATIONS_FOR_FINALIZE",
 "message": "Invoice with 'portalId' of XXXXXXXX failed create validation. Please correct the errors and then re-submit. : Do not have the proper amount of associations of type INVOICE_TO_LINE_ITEM to finalize this invoice. Number needed: must be > 0",
 "context": {
 "numberNeeded": [
 "must be > 0"
 ],
 "portalId": [
 "XXXXXXXXX"
 ],
 "associationType": [
 "INVOICE_TO_LINE_ITEM"
 ]
 }
 }
 ],
 "category": "VALIDATION_ERROR"
}

Anyone have had this same problem and can point a direction to solve this?

Hi @matheusjiran1

Hey, I just tried this API and was able to create the invoice in the instance. For your reference I am sharing the CURL -

curl --request POST \
 --url https://api.hubapi.com/crm/v3/objects/invoices \
 --header 'authorization: Bearer ' \
 --header 'content-type: application/json' \
 --data '{
 "properties": {
	"community_test": "string",
	"hs_currency": "USD"
 }
}'

You can modify or edit the property value as per your needs, and can even add associations as well.

Here is the link to the doc - Invoices - HubSpot docs

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.

Thanks!

Moderator Note: this post was reviewed for relevancy and optimized for clarity on September 30, 2026. Thank you for your contributions to the HubSpot Community!

Thank you, @GRajput ! That really helped!

I retested removing the Assocaitions and got the same Validation Error.

It happens that the error was not related to the associations, but to the Invoice Status. I managed to create the Invoice associated with the Company and the Line Item in the creation request, just by removing the “hs_invoice_status” from the payload, the invoice was created.

Call out to the HubSpot team to review the endpoint and the validation error message. I assume the ‘paid’ requires a payment record associated with the invoice.