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

API: Create Journal

The purpose of this API is to create new journal.

Request

URL https://your_account.modulus.biz/api/bk/v1/CreateJournal?token=YOUR_TOKEN
API Name CreateJournal
Method POST
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
date Yes Date Date format must be ISO 8601 (Example: “2020-01-10”)
Has to be in an open fiscal period.
financial_book_id No Number Refers to the financial book to which this journal will be posted.
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 Detials

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 No 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 No text Used in case of foreign currency transaction.

Responses

HTTP Status result title message object
Success Responses
200 OK true Success New journal crated successfully.
{
    "created_journal_id": xxx,
    "created_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 POST 'https://your_account.modulus.biz/api/bk/v1/CreateJournal?token=YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "date": "2020-01-02",
    "financial_book_id":null,
    "journal_notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    "reference_number": "AJ-23-mn",
    "journal_entries": [
        {
            "account_code": "1.3",
            "cost_center_id": null,
            "journal_entry_notes": "Ut labore et dolore magna aliqua.",
            "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": "Sed do eiusmod tempor incididunt.",
            "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": ""
        }
    ]
}'
200 OK
{
"result": true,
"title": "Success",
"message": "New journal created successfully.",
"object": {
        "created_journal_id": 3439,
        "created_date_time": "2021-01-14 19:59:22"
    }
}

Example 2

Request
curl --request POST 'https://your_account.modulus.biz/api/bk/v1/CreateJournal?token=ddd871b104153e1da4c10713ec691d77' \
--header 'Content-Type: application/json' \
--data-raw '{
    "date": "2020-10-02",
    "financial_book_id":null,
    "journal_notes": "Sit amet nisl suscipit adipiscing bibendum.",
    "reference_number": "AJ-23-mn-87",
    "journal_entries": [
        {
            "cost_center_id": null,
            "journal_entry_notes": "Nulla facilisi etiam dignissim diam quis.",
            "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": "Sed velit dignissim sodales ut eu sem integer.",
            "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": ""
        }
    ]
}'
400 Bad Request
{
    "result": false,
    "title": "Bad Request",
    "message": "Failed to create new journal. Missing account code for journal entry.",
    "object": {
        "error_code": 1241
    }
}