Create new invoice error

I’m trying to create a new invoice. All "get"s work so my connection is correct but no posts work. I’ve tried to simplify as much as possible. Help!

This returns
errors : {
error : {
message : “‘invoice’ parameter does not match expected type ‘object’”

This is the code

header_data = {“Accept”:“application/json”,“Content-Type”:“application/json”};
invoice_data = {
“invoice”: {
“contact”: “Accounting software you'll love - FreeAgent”,
“dated_on”: “2020-09-06”,
“payment_terms_in_days”: 0,
“status”: “Draft”,
“invoice_items”: {
“description”: “test product”,
“quantity”: “1”,
“price”: “29.99”

response = invokeurl
url :“
type :POST

Hi Richard :wave:

Welcome to the API Forum! Thank you for posting your question, I’ll do what I can to help you out with this one :slight_smile:

There are a couple of things I’ve noticed in your POST request that could be causing the error you’re experiencing here.

First of all, the URL you’re using for the contact is the url to use the main app rather than an API URL. The format of the URL you need to pass to the “contact” parameter should be “<contact_id>”

Secondly, for your invoice items, this needs to be an Array of Hashes, currently you have a Hash inside of a Hash.

I hope this helps and please let me know if this doesn’t resolve the issue for you!

Kind regards,

Thanks for the prompt reply Katie. It appears that my compiler is changing the array to an object just by itself. Never had that happen or would have spotted that as it happens when I save the code which also minified it. Will have to check with support at the other end. Will update this when solved.