Creating invoice gives {"errors":{"error":{}}}

I’m trying to create an invoice after successfully having got contact creation working.

I’m trying to send the following:

  "invoice" : {
    "url" : null,
    "contact" : "",
    "dated_on" : 1514798880000,
    "payment_terms_in_days" : 0,
    "total_value" : 40.99,
    "invoice_items" : [
        "description" : "Nice stuff",
        "item_type" : "Products",
        "quantity" : 1.0,
        "price" : 35.99

And get back a response status 400 Bad Request, with a body of just


Happening in box sandbox and prod

Unless I’ve misread the docs I’m providing all the required fields for invoice and invoice item.

Can anyone shed any light on what’s wrong?

I haven’t actually tested this, but sending a url of null looks odd. Does it work if you leave that out?

Hi Andrew

Thanks for the reply. It doesn’t make a difference whether you leave the field out or set it as null. For Contacts I set it null and everything works great. Incidentally I’m sending it as null because the JSON library I’m using in Scala - it’s just easier.

So this works for contacts:

  "contact" : {
    "url" : null,
    "first_name" : "John",
    "last_name" : "Doe",
    "organisation_name" : null,
    "email" : "",
    "phone_number" : "01234567891",
    "address1" : "44 Some Road",
    "address2" : "",
    "address3" : null,
    "town" : "Freetown",
    "region" : "England",
    "postcode" : "F42 1AA",
    "country" : "United Kingdom",
    "created_at" : null

I guess for invoices there are other fields that are mandatory but where the docs don’t mark them as such. I’ll try adding fields and see if hit the magic one at some point. This API seems a little flaky from what I’ve seen and read in the forums so far. It’s a little disappointing it doesn’t work better than it does.


Hi, Rich. Sorry for the delay in responding.

I’m still looking into why you’re getting a blank error because I can’t reproduce it using your inputs (with my own contact and with a fixed dated_on - see below).

Your dated_on value is in the incorrect format. According to the docs it needs to be of the format “YYYY-MM-DD”.

I can also confirm that the three variables listed as required in the docs are the only three that are required by the API.

Incidentally, if I use your dated_on format I get a non-blank error message.

Hi Pat

Thanks for your help. I added a bunch more fields to the post last night and got a success response. I don’t know exactly which field fixed it. I corrected the dated_on to be string rather than a unix timestamp (as you pointed out). Maybe that was the issue.

Anyway I can now progress. Yay!

Thanks again