Journal Entries
What are Journal Entries?
Before jumping into the journal entries endpoint, it's a good idea to give our article on "What are Journal Entries?" a read.
Request Details
Like most requests, you'll need the <accountId> for the FreshBooks account that you'll be querying. To find out what accounts the user using your app has access to, it's good to make a query related to the identity model
Before creating a journal entry you will need to query the "Get accounts" endpoint. This will return an array of accounts. The "sub_accountid" will be used when adding a journal entry. New entries must include the sub_accountid, and the debit or credit amounts.
Add Journal Entry
Request: POST https://api.freshbooks.com/accounting/account/<accountId>/journal_entries/journal_entries
{
"journal_entry": {
"details": [
{
"sub_accountid": "635974",
"debit": "200"
},
{
"sub_accountid": "635976",
"credit": "200"
}
],
"currency_code": "USD",
"description": "Here is a basic description of the journal entry made.",
"name": "JournalEntry",
"user_entered_date": "2019-04-20"
}
}
Response:
{
"response": {
"result": {
"journal_entry": {
"currency_code": "USD",
"description": "Here is a basic description of the journal entry made.",
"details": [
{
"credit": null,
"currency_code": "USD",
"debit": "200",
"description": "Here is a basic description of the journal entry made.",
"detailid": 2004224,
"id": 2004224,
"name": "JournalEntry",
"sub_accountid": 635974,
"user_entered_date": "2019-04-20"
},
{
"credit": "200",
"currency_code": "USD",
"debit": null,
"description": "Here is a basic description of the journal entry made.",
"detailid": 2004226,
"id": 2004226,
"name": "JournalEntry",
"sub_accountid": 635976,
"user_entered_date": "2019-04-20"
}
],
"entryid": 941370,
"id": 941370,
"name": "JournalEntry",
"user_entered_date": "2019-04-20"
}
}
}
}
Get Journal Entry Details
curl –location –request GET “https://api.freshbooks.com/accounting/account/{{accountId}}/journal_entries/journal_entry_details?”
Get Accounts
curl –location –request GET “https://api.freshbooks.com/accounting/account/{{accountId}}/journal_entry_accounts/journal_entry_accounts”