1. Home
  2. Docs
  3. Documentation
  4. Bookkeeping APIs – ...
  5. API: Update Journal

API: Update Journal

The purpose of this API is to update an existing journal.

Request

API Name UpdateJournal
URL https://your_account.modulus.biz/api/bk/v1/UpdateJournal?token=YOUR_TOKEN
Method PUT
Source Third Party Server
Recipient modulus® Server
Content Type application/json

Query String Parameters

Parameter Required Type Description
token Yes Text Your authentication token.

Payload Parameters

Parameter Required Type Description
journal_id Yes Number Has to be initially created by the same integration app, and status is either pending or review.
journal_notes No Text Journal notes if any.
reference_number No Text Journal reference number.
journal_entries Yes Array An array that contains at least two entries.
Credit amount must be equal to debit amount.
Journal entries have the structure explained here.

Journal Entry Parameter Details

Parameter Required Type Description
account_code Yes Text Has to match a non-disabled leaf account in CoA.
cost_center_id No Number An integer that can be used with revenue / expense entries to indicate the cost center to which the JV is posted.
journal_entry_notes No Text Journal entry notes if any.
base_currency_debit_amount Yes Decimal Number Has to be equal to credit amount.
foreign_currency_debit_amount Yes Decimal Number Used in case of foreign currency transaction.
In case used, has to be of same value as foreign currency credit amount.
base_currency_credit_amount Yes Decimal Number Has to be equal to debit amount.
foreign_currency_credit_amount No Decimal Number Used in case of foreign currency transaction.
In case used, has to be of same value as foreign currency debit amount.
foreign_currency_id No Number Used in case of foreign currency transaction.

Responses

HTTP Status result title message object
Success Responses
200 OK true Success New journal updated successfully
{
    "updated_journal_id": xxx,
    "updated_date_time": "yyy-mm-dd hh:MM:ss"
}
Failure Responses
400 Bad Request false Bad Request Error message as elaborated here.
{
    "error_code": xxx
}

Error code as elaborated here.

500 Internal Server Error false Internal Server Error Error message as elaborated here.
{
    "error_code": xxx
}

Error code as elaborated here.

Example 1

Request
curl --request PUT 'https://your_account.modulus.biz/api/bk/v1/UpdateJournal?token=YOUR_TOKEN' \--header 'Content-Type: application/json' \
--data-raw '{
    "journal_id": 3439,
    "journal_notes": "Sunt in culpa qui officia deserunt mollit anim id est laborum.",
    "reference_number": "AJ-23-mn-87",
    "journal_entries": [
        {
            "account_code": "1.3",
            "cost_center_id" : null,
            "journal_entry_notes": "Duis aute irure dolor in reprehenderit.",
            "base_currency_debit_amount": 100.00,
            "foreign_currency_debit_amount": 100.00,
            "base_currency_credit_amount": 0.00,
            "foreign_currency_credit_amount": 0.00,
            "foreign_currency": "EGP"
        },
        {
            "account_code": "1.4.2.1",
            "cost_center_id": null,
            "journal_entry_notes": "Excepteur sint occaecat.",
            "base_currency_debit_amount": 0.00,
            "foreign_currency_debit_amount": 0.00,
            "base_currency_credit_amount": 100.00,
            "foreign_currency_credit_amount": 100.00,
            "foreign_currency": "EGP"
        }
    ]
}'
200 OK
{
    "result": true,
    "title": "Success",
    "message": "Journal updated successfully.",
    "object": {
        "updated_journal_id": 3439,
        "updated_date_time": "2021-01-14 20:00:15"
    }
}
                

Example 2

Request
curl --request PUT 'https://your_account.modulus.biz/api/bk/v1/UpdateJournal?token=ddd871b104153e1da4c10713ec691d77' \
--header 'Content-Type: application/json' \
--data-raw '{
    "journal_id": null,
    "journal_notes": "Nisi scelerisque eu ultrices vitae auctor eu augue ut lectus.",
    "reference_number": "AJ-23-mn-87",
    "journal_entries": [
        {
            "account_code": "1.355",
            "cost_center_id" : 2,
            "journal_entry_notes": "Amet est placerat in egestas erat imperdiet.",
            "base_currency_debit_amount": 100.45,
            "foreign_currency_debit_amount": 100.45,
            "base_currency_credit_amount": 0.00,
            "foreign_currency_credit_amount": 0.00,
            "foreign_currency": ""
        },
        {
            "account_code": "1.4.2.1",
            "cost_center_id": null,
            "journal_entry_notes": "Sed vulputate mi sit amet mauris commodo.",
            "base_currency_debit_amount": 0.00,
            "foreign_currency_debit_amount": 0.00,
            "base_currency_credit_amount": 100.45,
            "foreign_currency_credit_amount": 100.45,
            "foreign_currency": "USD"
        }
    ]
}'
400 Bad Request
{
    "result": false,
    "title": "Bad Request",
    "message": "Failed to update journal. Invalid account code for journal entry.",
    "object": {
        "error_code": 1239
    }
}