Bill error: required key bill_items not found on bill

I am using the v2 bills API with the following code:

const credentials = { freeagentRoot: 'api.sandbox' };
const data = {
  contact: `https://${credentials.freeagentRoot}`,
  reference: 'TEST001',
  dated_on: '2021-11-29',
  due_on: '2021-12-29',
  bill_items: [
      category: `https://${credentials.freeagentRoot}`,
      description: 'Test',
      total_value: '123.45',
      quantity: '1.0',
const { data: bill } = await`https://${credentials.freeagentRoot}`, data, {
  headers: {
    Authorization: `Bearer ${auth.access_token}`,

I get the error as mentioned above: required key bill_items not found on bill - I don’t understand how this can be since I’m sending that array through, it’s just not being picked up.

Any ideas? Thanks!

Scrap that. Worked out it needs to be data = { bill: { foo: 'bar' } }; - missed off a nested bill object

Can I suggest to the devs that the error message body be a bit more descriptive and not try the bill_items validation first? It’s not very helpful as it stands! Thanks

Hey! Thanks for spotting that - we’ve made a note of the issue with the error message and will look into it.