Error: Income Account None does not belong to Company When Trying To Add Sales Invoice

I was trying to add a sales invoice using the REST API and it gives me this error.

"customer": "CUSTOMER",
"series": "SINV-.YY.-",
"date": "2023-03-21",
"status": "Paid",
"items": [
{
     "item_code": "ITEM CODE",
     "qty": 5,
     "unitPrice": 5,
}
]

Setting a default income account for my company solved the problem for me.

I overcame this by adding payments as well