Posting more than one journal set through the API


#1

Hi,

I am wondering that is it is possible to post more than one journal using the journal_set API? If yes, what is the format of the data we should post in the body.

Thank you,
Kunal Khivensara


#2

Hi Kunal,

Ewa here from the Engineering Team at FreeAgent — thanks for your message on our forum and I’ll do my best to help out.

Although you can only create one journal set in a single POST request, you can include as many journal entries in it as required, as long as they balance. You can do that by passing the journal entries you wish to create in the journal_entries array, as in the example below:

{
  "journal_set":{
    "dated_on":"2020-05-28",
    "description":"An example journal set",
    "journal_entries":[
      {
        "category":"https://api.freeagent.com/v2/categories/001",
        "description":"A Sales Correction",
        "debit_value":"-123.45"
      },
      {
        "category":"https://api.freeagent.com/v2/categories/901",
        "user":"https://api.freeagent.com/v2/users/1",
        "description":"Director's Capital Introduced",
        "debit_value":"123.45"
      }
    ]
  }
}

(For more information, see https://dev.freeagent.com/docs/journal_sets#create-a-journal-set)

I hope this helps!

Best wishes,

Ewa