Bookkeeping

Definitions of the types and formats of the data used in the endpoints can be found at the bottom of the page.

Endpoints

Get Page

GET https://cubicl.io/api/v1/bookkeeping/page

Fetches current account, activities and statistics required for bookkeeping.

{
    activities : BookkeepingActivity[],
    entries : BookkeepingEntry[],
    payables : {
        total : number,
        outstanding : number,
        overdue : number,
        currency : string
    },
    receivables : {
        total : number,
        outstanding : number,
        overdue : number,
        currency : string
    }
}

Fetch Entry Activities

GET https://cubicl.io/api/v1/bookkeeping/activities

Query Parameters

BookkeepingActivity[]

Fetch Entry Details

GET https://cubicl.io/api/v1/bookkeeping/entries/{entry}

Path Parameters

BookkeepingEntry

Add Entry

POST https://cubicl.io/api/v1/bookkeeping/entries

Adds a credit or debit posting for a customer.

Request Body

{
    entry : BookkeepingEntry
    entryActivity : BookkeepingActivity,
    payment? : BookkeepingPayment // Exists if paidAmount is given
    paymentActivity? : BookkeepingActivity // Exists if paidAmount is given
}

Update Entry Details

PUT https://cubicl.io/api/v1/bookkeeping/entries/{entry}

Path Parameters

Request Body

BookkeepingEntry

Delete Entry

DELETE https://cubicl.io/api/v1/bookkeeping/entries/{entry}

All activity and payment records related to this entry is deleted.

Path Parameters

Add Payment

POST https://cubicl.io/api/v1/bookkeeping/payment/{entry}

Path Parameters

Request Body

{
    payment : BookkeepingPayment,
    activity : BookkeepingActivity
}

Delete Payment

DELETE https://cubicl.io/api/v1/bookkeeping/payments/{payment}

Path Parameters

BookkeepingActivity

Data

BookkeepingEntry

{
    org : string, // Organization id
    customer : string, // Customer id
    /* receivable: Current account credit balance. The payment received by Cubicl user from their customers in exchange for a product or service.
     * payable: Current account debit balance. The payment made by Cubicl user to a customer in return for a product or service.
     */
    type : 'receivable' | 'payable',
    amount : number, // Current account balance. It must be greater than 0
    /* Money unit. It must contain one of the following values:
     * TRY, USD, EUR, GBP, AUD, CAD, CHF, CNY, HKD, NZD, SEK,
     * KRW, SGD, NOK, MXN, INR, ZAR, RUB, BRL, JPY, TWD, DKK,
     * THB, IDR, HUF, CZK, ILS, PHP, AED, COP, SAR, MYR, RON
     */
    currency : string,
    name : string,
    desc : string | null,
    paidAmount : number,     // How much of the total is paid? It must be greater than zero and less than total amount.
    isPaid : boolean,        // Is completely paid off?
    dueAt : number | null,   // Date of last payment. Expected to be paid before this date. 
    createdBy : string,    // Id of the user who created the entry
    createdAt : number,
}

BookkeepingPayment

{
    org : string, // Organization id
    customer : string, // Customer id
    amount : number, // Current account balance. It must be greater than 0.
    entry : string, // Bookkeeping Entry id
    note : string | null, // Optional note about the payment
    createdBy : string, // Id of the user who created the entry
    createdAt : number
}

BookkeepingActivity

{
    org : string, // Organization id
    customer : string, // Customer id
    entry : string, // // Bookkeeping Entry id. Always exists
    payment? : string, // Exists if type is 'payment-received', 'payment-sent' or 'payment-deleted'
    type : 'receivable-created' | 'payable-created' | 'payment-received' | 'payment-sent' | 'payment-deleted',
    data : {
        entryName : string,
        entryDueAt? : number, // Exists if entry dueAt defined
        amount : number, // Current account balance. It must be greater than 0
        /* Money unit. It must contain one of the following values:
         * TRY, USD, EUR, GBP, AUD, CAD, CHF, CNY, HKD, NZD, SEK,
         * KRW, SGD, NOK, MXN, INR, ZAR, RUB, BRL, JPY, TWD, DKK,
         * THB, IDR, HUF, CZK, ILS, PHP, AED, COP, SAR, MYR, RON
         */
        currency : string,
        paidAmount? : number, // Exists if type is receivable/payable-created. How much of the total is paid? It must be greater than zero
    },
    createdBy : string // Id of the user who created the entry
    createdAt : number,
}

Last updated