I am trying to add a sales invoice through Sage Accounting API calls. However, I keep getting the same error and I cannot find the cause.
Request details:
Params:
{
"sales_invoice": {
    "contact_id": "2d06dde3927744f09c60557aae2d1f10",
    "date": "2019-07-01 13:14:56",
    "invoice_lines": [
        {
            "description": "Original remote control JVC RM-C3095",
            "ledger_account_id": "7ccb54ca5df741f0b6cfbb6c35791f93",
            "unit_price": "20.0000",
            "quantity": 1,
            "tax_rate_id": "ES_EXEMPT",
            "eu_goods_services_type_id": "GOODS"
        }
    ],
    "invoice_number_prefix": "INV-",
    "invoice_number": 4,
    "delivery_address": {
        "city": "xxx",
        "address_line_1": "yyy",
        "address_line_2": "zzz",
        "postal_code": "014178"
    },
    "main_address": {
        "city": "xxx",
        "address_line_1": "yyy",
        "address_line_2": "zzz",
        "postal_code": "014178"
    }
}
}
The error:
Array
(
[0] => Array
    (
        [$severity] => error
        [$dataCode] => RecordInvalid
        [$message] => is invalid
        [$source] => line_items.ledger_account
    )
)
Even though the ledger account id IS valid (as I took it directly from the ledger accounts in the app). How can I fix this?