# Create Invoice API Validation Error

**URL:** <https://community.hubspot.com/t/create-invoice-api-validation-error/136762>\
**Category:** APIs & Integrations\
**Tags:** developer-tools\
**Created:** [July 23, 2025, 7:44pm UTC](https://community.hubspot.com/t/create-invoice-api-validation-error/136762 "2025-07-23T19:44:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matheusjiran1](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@matheusjiran1](https://community.hubspot.com/u/matheusjiran1)\
**Post date:** [July 23, 2025, 7:44pm UTC](https://community.hubspot.com/t/create-invoice-api-validation-error/136762/1 "2025-07-23T19:44:33Z")

</div>

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:

```lia-code-sample
{
 "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:

```lia-code-sample
{
 "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?

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [July 24, 2025, 11:06am UTC](https://community.hubspot.com/t/create-invoice-api-validation-error/136762/2 "2025-07-24T11:06:39Z")

</div>

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 -

```lia-code-sample
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](https://developers.hubspot.com/docs/api-reference/legacy/crm/objects/invoices/guide)

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!_

---

<div class="post-metadata">

**Author:** ![matheusjiran1](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@matheusjiran1](https://community.hubspot.com/u/matheusjiran1)\
**Post date:** [July 24, 2025, 12:58pm UTC](https://community.hubspot.com/t/create-invoice-api-validation-error/136762/3 "2025-07-24T12:58:01Z")

</div>

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.
