API v2 - CAFECA-IO/iSunFA GitHub Wiki

API code example : A011001

The initial letter 'A' indicates that the API is located in a folder whose name begins with 'A'. Following this, the first two digits '01' specify the API's position in a sequence of folders, suggesting that it is the first folder starting with 'A'. The third digit '1' denotes the API's position within a subsequence of folders inside the initial folder starting with 'A', indicating it is in the first subfolder. Lastly, the final three digits '001' represent the API's sequence number within the subfolder, meaning it is the first API listed there.

API list

BaseUrl: /api/v2

  • A010001 - POST /ask_ai - ask AI for help

  • A010002 - GET /ask_ai/[resultId] - get ai result from faith

  • A020001 - GET /company/:companyId/accounting_setting - accounting setting

  • A020002 - PUT /company/:companyId/accounting_setting - accounting setting

  • A030001 - GET /company/:companyId/account - accounting setting

  • A030002 - POST /company/:companyId/account - accounting setting

  • A030001 - GET /company/:companyId/account/:accountId - accounting setting

  • A031002 - PUT /company/:companyId/account/:accountId - accounting setting

  • A031003 - DELETE /company/:companyId/account/:accountId - accounting setting

  • A022001 - GET /company/:companyId/accounting_setting/opening_balance - accounting setting

  • A022002 - PUT /company/:companyId/accounting_setting/opening_balance - accounting setting

  • A030001 - POST /job/:jobId/application - Create an application for a job

  • A040001 - GET /company/:companyId/assets - List all assets

  • A040002 - GET /company/:companyId/assets/:assetId - Get asset by ID

  • A040003 - POST /company/:companyId/assets - Create asset

  • A040004 - PUT /company/:companyId/assets/:assetId - Update asset

  • A040005 - DELETE /company/:companyId/assets/:assetId - Delete asset

  • A040006 - GET /company/:companyId/asset/suggested_number - Get suggested asset number for reference

  • A040007 - POST /company/:companyId/asset/bulk - Create multiple assets

  • C010001 - GET /company/:companyId/counterparty - counterparty setting

  • C010002 - POST /company/:companyId/counterparty - counterparty setting

  • C011001 - GET /company/:companyId/counterparty_setting/:counterpartyId - counterparty setting

  • C011002 - PUT /company/:companyId/counterparty_setting/:counterpartyId - counterparty setting

  • C011003 - DELETE /company/:companyId/counterparty_setting/:counterpartyId - counterparty setting

  • C030001 - GET /company/certificate - get all certificate

  • C030002 - GET /company/certificate/[certificateId] -get one certificate`

  • C030003 - POST /company/certificate - post certificate

  • C030004 - DELETE /certificate/[certificateId] - Delete Certificate By id

  • C040001 - GET user/:userId/company - user normal setting, company list

  • C040002 - POST user/:userId/company - user normal setting, company list

  • C041001 - GET /company/:companyId - user normal setting, company list

  • C041002 - PUT /company/:companyId - user normal setting, company list

  • C041003 - DELETE /company/:companyId - user normal setting, company list

  • C042001 - PUT /user/:user/selected_company - ISFMK00004

  • E010001 - POST /company/:companyId/asset/export - export asset list

  • E020001 - POST /company/:companyId/trial_balance/export - export trial balance list

  • E030001 - POST /company/:companyId/ledger/export - export ledger list

  • F010001 - POST /company/:companyId/file - ISFMK00004, ISFMK00058, ISFMK00061右邊

  • F011001 - GET /company/:companyId/file/:fileId - ISFMK00058

  • F011002 - DELETE /company/:companyId/file/:fileId - ISFMK00058

  • I010001 - GET /company/:companyId/image/:imageId - ISFMK00058

  • J010001 - GET /job - List all jobs

  • J010002 - GET /job/:jobId - Get details of a specific job

  • L010001 - GET /company/:companyId/ledger - List ledger details for a specific accounting account range

  • N020001 - GET /news - list news

  • N020002 - GET /news/:newsId - get news by id

  • O010001 - GET /company/:companyId/order

  • O010002 - POST /company/:companyId/order

  • P010001 - GET /company/:companyId/payment?orderId=

  • P010002 - POST /company/:companyId/payment

  • P020001 - GET /company/:companyId/pending_task - List all pending tasks

  • P030001 - GET /user/:userId/pending_task - List all pending tasks

  • R010001 - POST user/:userId/role - create role for user

  • R010002 - GET user/:userId/role - list role for user

  • R020001 - PUT /user/:userId/selected_role - select role for user

  • R021001 - GET /company/:companyId/report - ISFMK00066

  • R031002 - GET /role

  • R040001 - POST /room - create room

  • R040002 - GET /room - list room

  • R041001 - GET /room/:roomId - get room by id

  • R041002 - DELETE /room/:roomId - delete room by id

  • S010001 - POST /sign-out [不需驗證登入]

  • S020001 - GET /session - ISFMK00001 [不需驗證登入]

  • T010001 - GET /company/:companyId/trial_balance - List all trial balance items

  • T020001 - GET /user/:userId/todo - List all todo items

  • T020002 - POST /user/:userId/todo - Create a todo item

  • T020003 - GET /todo/:todoId - Get a todo item by ID

  • T020004 - PUT /todo/:todoId - Update a todo item

  • T020005 - DELETE /todo/:todoId - Delete a todo item

  • U011001 - GET /user/:userId - user normal setting

  • U011002 - PUT /user/:userId - user normal setting

  • U011003 - DELETE /user/:userId - user normal setting

  • U011004 - GET /user/:userId/user_setting - user normal setting

  • U011005 - PUT /user/:userId/user_setting - user normal setting

  • U011007 - GET /user/:userId/user_action_log - user normal setting

  • U011008 - GET /user/:userId/agreement - login page

  • U011009 - PUT /user/:userId/deletion - normal setting page

  • V010001 - GET /company/voucher - Get all voucher

  • V010002 - GET /company/voucher/[voucherId] - GET One Voucher

  • V010003 - POST /company/voucher/readed - POST check already Read voucher

  • V010004 - POST /company/voucher - Post Voucher

  • V010005 - PUT /company/voucher/[voucherId] - Put Voucher

  • V010006 - DELETE /company/voucher/[voucherId] - Delete Voucher

-------------------- 以下是待確認 api v1 --------------------

  • A010001 - GET /audit_report - iSunFA-Landing-page-Animation10 [不需驗證登入]
  • J010001 - GET /company/:companyId/journal - ISFMK00038
  • J011001 - GET /company/:companyId/journal/:journalId - ISFMK00015 ISFMK00024
  • J011002 - DELETE /company/:companyId/journal/:journalId - ISFMK00025
  • O011001 - POST /company/:companyId/ocr
  • O011003 - GET /company/:companyId/ocr
  • O011004 - DELETE /company/:companyId/ocr/:resultId

------------------ 以上是待確認 api v1 -----------------------------------

askAi

  • description: ask AI for help

Request

Request url

POST /askAi

query

name type description required default
reason string ('certificate', 'voucher') the reason for asking AI, help is for stream chat, certificate is for analysis certificate ad return invoice json, voucher is will return voucher json true --

body

1. Certificate

name type description
fileId number the "fileId" of that certificate (because certificate has not been saved into database yet)
POST /askAi?reason=certificate

const body = {
  "targetIdList": 1001
}

2. Voucher

name type description
certificateId number the "certificateId" of certificate, when user click "Please select certificate...", than will be activate
POST /askAi?reason=voucher

const body = {
  "certificateId": 1001
}

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload result response data(AI if use "helper", result if "invoice", "voucher")

Result

name type description
reason string the reason for asking AI
resultId string resultId for pusher sub
progressStatus string the status of the progress
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": {
     "reason": "voucher",
     "resultId": "a1b2c3d4f5g6h7i8j9k0",
     "progressStatus": "processing"
    }
}

askAi with resultId

  • Description: Use this api if ai result is missing

Request

Request url

GET /askAi/:resultId

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Param

name type description required default
resultId string the resultId of 'certificate', 'voucher' true --

query

name type description required default
reason string ('help', 'certificate', 'voucher') the reason for asking AI, help is for stream chat, certificate is for analysis certificate ad return invoice json, voucher is will return voucher json true --

Request Example

GET /ask_ai/:resultId?reason=certificate

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload certificate | voucher base on helper type

certificate

  • this may not return all arguments in payload
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": {
  "inputOrOutput": "input",
  "certificateDate": 10000001, // second
  "certificateNo": "AB-12345678", // to store special number to represent certificate, ex for invoice is invoiceNo
  "currencyAlias": "TWD",
  "priceBeforeTax": 4000,
  "taxRatio": 5, // 5%, -1 for tax free
  "taxPrice": 200, // how many price to pay taxes
  "totalPrice": 4200,
  "counterPartyId": 1, // use fuzzy search
  "invoiceType": "triplicate_uniform_invoice",
  "deductible": true,
 }
}

voucher

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": {
     "voucherDate": 1000000,
  "type": "payment", // or transfer or receiving
  "note": "This is a note",
  "counterPartyId": 1001,
  "lineItemsInfo": {
   "sum": {
    "debit": true,
          "amount": 1000
      },
      "lineItems": [
       {
           "id": 1001,
           "amount": 1000,
           "description": "This is a description",
           "debit": true,
           "accountId": 1001,
       },
          {
           "id": 1002,
           "amount": 1001,
           "description": "This is a description",
           "debit": false,
           "accountId": 1002,
       }
      ]
  }
 }
}

listCounterparty

  • description: list all customers and vendors

Request

Request url

GET /company/:companyId/counterparty_setting

Parameters

name type description required default
companyId string id of the company associated with the customer or vendor true --

Request Example

GET /company/1000/counterparty_setting

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IPaginatedData<Counterparty[]> response data

IPaginatedData

name type description
data Counterparty[] The journal data
page number The page number
totalPages number The total number of pages
totalCount number The total number of items
pageSize number The number of items per page
hasNextPage boolean Indicates if there is a next page
hasPreviousPage boolean Indicates if there is a previous page
sort {sortBy: string, sortOrder: string}[] The order and field to sort by

Counterparty

name type description
id number customer's or vendor's id
companyId number id of the company associated with the customer or vendor
name string customer's or vendor's name
country string which country the tax id belongs to
taxId string customer's or vendor's tax id
type string type of the customer or vendor
note string note of the customer or vendor
createdAt number create time
updatedAt number update time
deletedAt number delete time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "List all customers and vendors successfully",
    "payload": {
        "data": [
            {
                "id": 1,
                "companyId": 1,
                "name": "Test Customer",
                "taxId": "123456",
                "type": "Customer",
                "note": "Test Note",
                "createdAt": 123456,
                "updatedAt": 123456
            },
            {
                "id": 2,
                "companyId": 1,
                "name": "Test Vendor",
                "taxId": "123456",
                "type": "Vendor",
                "note": "Test Note",
                "createdAt": 123456,
                "updatedAt": 123456
            }
        ],
        "page": 1,
        "totalPages": 5,
        "totalCount": 23,
        "pageSize": 5,
        "hasNextPage": true,
        "hasPreviousPage": false,
        "sort": [
            {
                "sortBy": "createdAt",
                "sortOrder": "desc"
            }
        ]
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

createCounterparty

  • description: create a customer or vendor

Request

Request url

POST /company/:companyId/counterparty

Parameters

name type description required default
companyId string id of the company associated with the customer or vendor true --

body

name type description
name string customer's or vendor's name
companyId number id of the company associated with the customer or vendor
country string which country the tax id belongs to
taxId string customer's or vendor's tax id
type string type of the customer or vendor
note string note of the customer or vendor

Request Example

POST /company/1000/counterparty_setting

const body = {
          "name": "cafecaWW",
          "companyId": 1000,
          "country": "Taiwan",
          "taxId": "3464",
          "type": "both",
          "note": "careful"
       }

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload Counterparty response data

Counterparty

name type description
id number customer's or vendor's id
companyId number id of the company associated with the customer or vendor
name string customer's or vendor's name
country string which country the tax id belongs to
taxId string customer's or vendor's tax id
type string type of the customer or vendor
note string note of the customer or vendor
createdAt number create time
updatedAt number update time
deletedAt number delete time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Create a customer or vendor successfully",
    "payload": 
       {
          "id": 3,
          "companyId": 1000,
          "name": "cafecaWW",
          "country": "Taiwan",
          "taxId": "3464",
          "type": "both",
          "note": "careful",
          "createdAt": 1630000000,
          "updatedAt": 1630000000,
          "deletedAt": null,
       },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getCounterpartyById

  • description: get a customer or vendor by id

Request

Request url

GET /company/:companyId/counterparty_setting/:counterpartyId

Parameters

name type description required default
companyId string id of the company associated with the customer or vendor true --
counterpartyId string id of the customer or vendor true --

Request Example

GET /company/1000/counterparty_setting/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload Counterparty response data

Counterparty

name type description
id number customer's or vendor's id
companyId number id of the company associated with the customer or vendor
name string customer's or vendor's name
country string which country the tax id belongs to
taxId string customer's or vendor's tax id
type string type of the customer or vendor
note string note of the customer or vendor
createdAt number create time
updatedAt number update time
deletedAt number delete time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get a customer or vendor successfully",
    "payload": 
       {
          "id": 1,
          "companyId": 1000,
          "name": "cafeca",
          "country": "Taiwan",
          "taxId": "1234",
          "type": "customer",
          "note": "bad one",
          "createdAt": 1630000000,
          "updatedAt": 1630000000,
          "deletedAt": null,
       },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

updateCounterpartyById

  • description: update a customer or vendor by id

Request

Request url

PUT /company/:companyId/counterparty_setting/:counterpartyId

Parameters

name type description required default
companyId string id of the company associated with the customer or vendor true --
counterpartyId string id of the customer or vendor true --

body

name type description
name string customer's or vendor's name
country string which country the tax id belongs to
taxId string customer's or vendor's tax id
type string type of the customer or vendor
note string note of the customer or vendor

Request Example

PUT /company/1000/counterparty_setting/1

const body = {
          "name": "MOon",
          "country": "Taiwan",
          "taxId": "3464",
          "type": "both",
          "note": "careful very"
       }

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload Counterparty response data

Counterparty

name type description
id number customer's or vendor's id
companyId number id of the company associated with the customer or vendor
name string customer's or vendor's name
country string which country the tax id belongs to
taxId string customer's or vendor's tax id
type string type of the customer or vendor
note string note of the customer or vendor
createdAt number create time
updatedAt number update time
deletedAt number delete time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Update a customer or vendor successfully",
    "payload": 
       {
          "id": 1,
          "companyId": 1000,
          "name": "MOon",
          "country": "Taiwan",
          "taxId": "3464",
          "type": "both",
          "note": "careful very",
          "createdAt": 1630000001,
          "updatedAt": 1630000001,
          "deletedAt": null,
       },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

deleteCounterpartyById

  • description: soft delete a customer or vendor by id through update the delete time

Request

Request url

DELETE /company/:companyId/counterparty_setting/:counterpartyId

Parameters

name type description required default
companyId string id of the company associated with the customer or vendor true --
counterpartyId string id of the customer or vendor true --

Request Example

DELETE /company/1000/counterparty_setting/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload Counterparty response data

Counterparty

name type description
id number customer's or vendor's id
companyId number id of the company associated with the customer or vendor
name string customer's or vendor's name
country string which country the tax id belongs to
taxId string customer's or vendor's tax id
type string type of the customer or vendor
note string note of the customer or vendor
createdAt number create time
updatedAt number update time
deletedAt number delete time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Delete a customer or vendor successfully",
    "payload": 
       {
          "id": 1,
          "companyId": 1000,
          "name": "MOon",
          "country": "Taiwan",
          "taxId": "3464",
          "type": "both",
          "note": "careful very",
          "createdAt": 1630000001,
          "updatedAt": 1630000001,
          "deletedAt": 1630560002,
       },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

GET All Certificate

  • Description: Get all certificate in "Uploaded Certificate"

Request

Request usrl

GET /company/certificate

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Query

name type description required
page number The page number, default is 1 no
pageSize number how many items in one page, default is 10 no
hasBeenUsed boolean(true/false) return certificate connect to something if true, return certificate connect to nothing if false, return all if undefined no
sortBy string which column to sort by (ex: "createAt") no
sortOrder string ("asc"/"desc") The order to sort by no
startDate integer(timestamp in second) item include and after startDate, default is 0 no
endDate integer(timestamp in second) item include and before startDate, default is infinity no
searchQuery string this field is to search name no

Resonse

Response Parameter

To be continue

Response Example

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Method not allowed",
    "payload": {
     "data": [
      {
       "id": 1
       "inputOrOutput": "input",
       "certificateDate": 10000001, // second
       "certificateNo": "AB-12345678", // to store special number to represent certificate, ex for invoice is invoiceNo
       "currencyAlias": "TWD",
       "priceBeforeTax": 4000,
       "taxRatio": 5, // 5%, -1 for tax free
       "taxPrice": 200, // how many price to pay taxes
       "totalPrice": 4200,
       "counterPartyId": 1,
       "invoiceType": "triplicate_uniform_invoice",
       "deductible": true,
       "connectToId": null // this can be interger or null, if null it has not been used on anything, if it has number, it will be 
       "name": "invoice001.jpg",
       "url": "/api/v2/certificate/1", // decrypedted
       "type": "invoice", // what kind f certificate is this
       "connectTotype": "voucher",
       "mimeTYpe": "image/jpeg",
       "size": "3.0 MB",
       "uploadProgress": 50, // 50 percent
       "aiResultId": "douhvjax_-1", // or null?
       "aiStatus": "success",
       "createAt": 10000000, // second
       "updateAt": 10000000, // second
      }
     ],
     "page": 1, // current page
     "totalPages": 3,
     "totalCount": 30,
     "pageSize": 10,
     "hasNextPage": true,
     "hasPreviousPage": true,
     "sort": [
      {
       "sortBy": "createAt",
       "sortOrder": "desc"
      }
     ]
    }
}

GET One Certificate

  • Description: GET one certificate

Request

Request usrl

GET /company/certificate/[certificateId]

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Parameter

name type description required
certificateId number The id of certain certificate Yes

Resonse

Response Parameter

To be continue

Response Example

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Method not allowed",
    "payload": {
  "id": 1,
  "inputOrOutput": "input",
  "certificateDate": 10000001, // second
  "certificateNo": "AB-12345678", // to store special number to represent certificate, ex for invoice is invoiceNo
  "currencyAlias": "TWD",
  "priceBeforeTax": 4000,
  "taxRatio": 5, // 5%, -1 for tax free
  "taxPrice": 200, // how many price to pay taxes
  "totalPrice": 4200,
  "counterPartyId": 1,
  "invoiceType": "triplicate_uniform_invoice",
  "deductible": true,
  "connectToId": null, // this can be interger or null, if null it has not been used on anything, if it has number, it will be 
  "name": "invoice001.jpg",
  "url": "/api/v2/certificate/1", // decrypedted
  "type": "invoice", // what kind f certificate is this
  "connectTotype": "voucher",
  "mimeType": "image/jpeg",
  "size": "3.0 MB",
  "uploadProgress": 50, // 50 percent
  "aiResultId": "douhvjax_-1", // or null?
  "aiStatus": "success",
  "createAt": 10000000, // second
  "updateAt": 10000000, // begin
 }
}

POST Certificate

  • Description : You should Post to File first, then get the file id. then post to here and get aichResultId, so that you can go to ask_ai to get ai data

Request

Request url

POST /company/certificate

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Body

name type description
inputOrOutput string input
certificateDate int certificate happened day in second
certificateNo string to store special number to represent certificate, ex for invoice is invoiceNo
currencyAlias string currency short name (alias) ex: "TWD"
priceBeforeTax number price before tax
taxRatio number if 5% please write 5, tax free be -1
taxPrice number Need to make sure it is priceBeforeTax * taxRatio
totalPrice number need to be priceBeforeTax + taxPrice
counterPartyId number id f counter body
invoiceType string triplicate_uniform_invoice
deductible boolean can this invoice be deductible?
fileId number which file id
{
 "inputOrOutput": "input",
 "certificateDate": 10000001, // second
 "certificateNo": "AB-12345678", // to store special number to represent certificate, ex for invoice is invoiceNo
 "currencyAlias": "TWD",
 "priceBeforeTax": 4000,
 "taxRatio": 5, // 5%, -1 for tax free
 "taxPrice": 200, // how many price to pay taxes
 "totalPrice": 4200,
 "counterPartyId": 1,
 "invoiceType": "triplicate_uniform_invoice",
 "deductible": true,
 "fileId": 1
}

Response

Response Parameter

To be continue

Response Example

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Method not allowed",
    "payload": {
     "aiResultId": "douhvjax_-1"
    }
}

Delete Certificate By id

  • Description : Delete certificate by id

Request

DELETE /certificate/[certificateId]

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Parameter

name type description
certificateId number certificate id to delete

Response

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Method not allowed",
    "payload": {
  "id": 1,
  "inputOrOutput": "input",
  "certificateDate": 10000001, // second
  "certificateNo": "AB-12345678", // to store special number to represent certificate, ex for invoice is invoiceNo
  "currencyAlias": "TWD",
  "priceBeforeTax": 4000,
  "taxRatio": 5, // 5%, -1 for tax free
  "taxPrice": 200, // how many price to pay taxes
  "totalPrice": 4200,
  "counterPartyId": 1,
  "invoiceType": "triplicate_uniform_invoice",
  "deductible": true,
  "connectToId": null, // this can be interger or null, if null it has not been used on anything, if it has number, it will be 
  "name": "invoice001.jpg",
  "url": "/api/v2/certificate/1", // decrypedted
  "type": "invoice", // what kind f certificate is this
  "connectTotype": "voucher",
  "mimeType": "image/jpeg",
  "size": "3.0 MB",
  "uploadProgress": 50, // 50 percent
  "aiResultId": "douhvjax_-1", // or null?
  "aiStatus": "success",
  "createAt": 10000000, // second
  "updateAt": 10000000, // begin
 }
}

getUserSetting

  • description: get the normal setting of the user

Request

Request url

GET /user/:userId/normal_setting

Parameters

name type description required default
userId string id of the user true --

Request Example

GET /user/1/normal_setting

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IUserSetting response data

IUserSetting

name type description
id number Primary Key
userId number User ID
personalInfo IUserPersonalInfo Personal information of the user
notificationSetting INotificationSetting Notification settings for the user
createdAt number Timestamp when created
updatedAt number Timestamp when updated
deletedAt number Timestamp when deleted

INotificationSetting

name type description
systemNotification boolean Indicates if system notifications are enabled
updateAndSubscriptionNotification boolean Indicates if update and subscription notifications are enabled
emailNotification boolean Indicates if email notifications are enabled

IUserPersonalInfo

name type description
firstName string First name of the user
lastName string Last name of the user
country string Country of the user
language string Preferred language of the user
phone string Phone number of the user

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get an user normal setting successfully",
    "payload": 
       {
        "id": 1,
        "userId": 1,
        "personalInfo": {
            "firstName": "",
            "lastName": "大明",
            "country": "Taiwan",
            "language": "english",
            "phone": "+886912345666"
        },
        "notificationSetting": {
            "systemNotification": false,
            "updateAndSubscriptionNotification": false,
            "emailNotification": true
        },
        "createdAt": 1633036800,
        "updatedAt": 1636854800,
        "deletedAt": null,
       },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

updateUserSetting

  • description: update the normal setting of the user

Request

Request url

PUT /user/:userId/normal_setting

Parameters

name type description required default
userId string id of the user true --

body

name type description
name string name of the user
email string email of the user
phone string phone number of the user
country string country of the user belongs to
lauguage string using language of the user
device string using device name of the user
IpAddress string IP address of the user
systemNotification boolean whether receiving the notification about system
updateAndSubscriptionNotification boolean whether receiving the notification about the update and the subscription
emailNotification boolean whether sending the notification to email

Request Example

PUT /user/1/normal_setting

const body = {
        "name": "王大明",
        "phone": "+886912345666",
        "systemNotification": false,
        "updateAndSubscriptionNotification": false,
        "emailNotification": true,
}

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IUserSetting response data

IUserSetting

name type description
id number Primary Key
userId number User ID
personalInfo IUserPersonalInfo Personal information of the user
notificationSetting INotificationSetting Notification settings for the user
createdAt number Timestamp when created
updatedAt number Timestamp when updated
deletedAt number Timestamp when deleted

INotificationSetting

name type description
systemNotification boolean Indicates if system notifications are enabled
updateAndSubscriptionNotification boolean Indicates if update and subscription notifications are enabled
emailNotification boolean Indicates if email notifications are enabled

IUserPersonalInfo

name type description
firstName string First name of the user
lastName string Last name of the user
country string Country of the user
language string Preferred language of the user
phone string Phone number of the user

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get an user normal setting successfully",
    "payload": 
       {
        "id": 1,
        "userId": 1,
        "personalInfo": {
            "firstName": "",
            "lastName": "大明",
            "country": "Taiwan",
            "language": "english",
            "phone": "+886912345666"
        },
        "notificationSetting": {
            "systemNotification": false,
            "updateAndSubscriptionNotification": false,
            "emailNotification": true
        },
        "createdAt": 1633036800,
        "updatedAt": 1636854800,
        "deletedAt": null,
       },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getUserActionLog

  • description: get the action log of the user

Request

Request url

GET /user/:userId/action_log

Parameters

name type description required default
userId string id of the user true --

Request Example

GET /user/1/action_log

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IPaginatedData<IUserActionLog[]> response data

IPaginatedData

name type description
data IUserActionLog[] The journal data
page number The page number
totalPages number The total number of pages
totalCount number The total number of items
pageSize number The number of items per page
hasNextPage boolean Indicates if there is a next page
hasPreviousPage boolean Indicates if there is a previous page
sort {sortBy: string, sortOrder: string}[] The order and field to sort by

IUserActionLog

name type description
id number Primary Key
sessionId string Session ID of the user
userId number User ID
actionType string Type of action performed
actionDescription string Description of the action
actionTime number Timestamp when the action occurred
ipAddress string IP address from which the action was performed
userAgent string User agent information
apiEndpoint string API endpoint accessed
httpMethod string HTTP method used (e.g., GET, POST)
requestPayload Record<string, string> Payload sent with the request
httpStatusCode number HTTP status code returned
statusMessage string Status message returned by the server

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get an user action log successfully",
    "payload": 
       {
    "data": [
      {
        "id": 1,
        "sessionId": "abc123",
        "userId": 1,
        "actionType": "LOGIN",
        "actionDescription": "User logged in",
        "actionTime": 165165156,
        "ipAddress": "192.168.1.1",
        "userAgent": "Mozilla/5.0",
        "apiEndpoint": "/api/login",
        "httpMethod": "POST",
        "requestPayload": { "username": "user1" },
        "httpStatusCode": 200,
        "statusMessage": "Success"
      }
    ],
    "page": 1,
    "totalPages": 5,
    "totalCount": 23,
    "pageSize": 5,
    "hasNextPage": true,
    "hasPreviousPage": false,
    "sort": [
      {
        "sortBy": "actionTime",
        "sortOrder": "desc"
      }
    ]
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": []
}

createUserAgreement

  • description: This API provides the functionality to create an agreement for user.

Request

Request url

POST `/user/:userId/agreement`

Body

name type description
agreementHash string hash of the agreement

Request Example

POST `/user/1/agreement`

Body

{
    "agreementHash": "0x1234567890"
}

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload IUser | {} response data

User

name type description
id number unique number of user
name string user name
fullName string user full name
email string user email
phone string user phone
imageId string user image id
agreementList string[] list of agreement hash
createdAt number creation timestamp
updatedAt number update timestamp

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.8+52",
    "success": true,
    "code": "201ISF0000",
    "message": "Created successfully",
    "payload": {
        "id": 10000001,
        "name": "book",
        "fullName": "book",
        "email": "[email protected]",
        "phone": "0912345678",
        "imageId": "0x1234567890",
        "agreementList": ["0x1234567890"],
        "createdAt": 1721635489,
        "updatedAt": 1721635489
    }
}
  • 失敗的回傳

    {
        "powerby": "iSunFA v0.1.2+50",
        "success": false,
        "code":  "400",
        "message": "bad request",
        "payload": {}
    }

putuserdeletion

  • description: This API provides the functionality to delete an user.

Request

Request url

PUT `/user/:userId/deletion`

Parameters

name type description
userId number id of the user

Request Example

PUT `/user/1/deletion`

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload IUser | {} response data

User

name type description
id number unique number of user
name string user name
email string user email
imageId string user image id
agreementList string[] list of agreement hash
createdAt number creation timestamp
updatedAt number update timestamp
deletedAt number delete timestamp

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.8+52",
    "success": true,
    "code": "201ISF0000",
    "message": "Deleted successfully",
    "payload": {
        "id": 10000001,
        "name": "book",
        "email": "aaa@example;com",
        "imageId": "0x1234567890",
        "agreementList": ["0x1234567890"],
        "createdAt": 1721635489,
        "updatedAt": 1721635489,
        "deletedAt": 0,
    }
}
  • 失敗的回傳

    {
        "powerby": "iSunFA v0.1.2+50",
        "success": false,
        "code":  "400",
        "message": "bad request",
        "payload": {}
    }

createUserCompany

  • description: create a new company

Request

Request url

POST user/:userId/company

body

name type description
name string name of the company
taxId string tax Id of the company
tag string tag of the company

Request Example

POST user/1/company

const body = {
        "name": "iSunFA",
        "taxId": "1234",
        "tag": "all",
}

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload ICompanyAndRole response data

ICompanyAndRole

name type description
company ICompany Company information
role IRole Role information
tag string Tag or label associated with the company
order number Order of the company

ICompany

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

IRole

name type description
id number Primary Key
name string Name of the role
permission string Permission of the role
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "201",
    "message": "Create a new company successfully",
    "payload": 
    {
        "company": {
            "id": 1,
            "imageId": "abc123",
            "name": "iSunFA",
            "taxId": "1234",
            "startDate": 1633036800,
            "createdAt": 1633036800,
            "updatedAt": 1633036800
        },
        "role": {
            "id": 1,
            "name": "admin",
            "permission": "all",
            "createdAt": 1633036800,
            "updatedAt": 1633036800
        },
        "tag": "accounting",
        "order": 1
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

listUserCompany

  • description: get all companies of the user

Request

Request url

GET user/:userId/company

Query

name type description required default
userId number id of the user true --

Request Example

GET user/1000/company

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IPaginatedData<ICompanyAndRole[]> response data

IPaginatedData

name type description
data ICompany[] The journal data
page number The page number
totalPages number The total number of pages
totalCount number The total number of items
pageSize number The number of items per page
hasNextPage boolean Indicates if there is a next page
hasPreviousPage boolean Indicates if there is a previous page
sort {sortBy: string, sortOrder: string}[] The order and field to sort by

ICompanyAndRole

name type description
company ICompany Company information
role IRole Role information
tag string Tag or label associated with the company
order number Order of the company

ICompany

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

IRole

name type description
id number Primary Key
name string Name of the role
permission string Permission of the role
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get all companies of the user successfully",
    "payload": 
    {
        "data": [
            {
                "company": {
                    "id": 1,
                    "imageId": "abc123",
                    "name": "iSunFA",
                    "taxId": "1234",
                    "startDate": 1633036800,
                    "createdAt": 1633036800,
                    "updatedAt": 1633036800
                },
                "role": {
                    "id": 1,
                    "name": "admin",
                    "permission": "all",
                    "createdAt": 1633036800,
                    "updatedAt": 1633036800
                },
                "tag": "accounting",
                "order": 1
            }
        ],
        "page": 1,
        "totalPages": 3,
        "totalCount": 30,
        "pageSize": 10,
        "hasNextPage": true,
        "hasPreviousPage": true,
        "sort": [
            {
                "sortBy": "createAt",
                "sortOrder": "desc"
            }
        ]
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": []
}

getcompany

  • description: get a company by id of the company

Request

Request url

GET /company/:companyId

Parameters

name type description required default
companyId string id of the company true --

Request Example

GET /company/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload ICompanyAndRole response data

ICompanyAndRole

name type description
company ICompany Company information
role IRole Role information
tag string Tag or label associated with the company
order number Order of the company

ICompany

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

IRole

name type description
id number Primary Key
name string Name of the role
permission string Permission of the role
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get a company info of the user successfully",
    "payload": 
    {
        "company": {
            "id": 1,
            "imageId": "abc123",
            "name": "iSunFA",
            "taxId": "1234",
            "startDate": 1633036800,
            "createdAt": 1633036800,
            "updatedAt": 1633036800
        },
        "role": {
            "id": 1,
            "name": "admin",
            "permission": "all",
            "createdAt": 1633036800,
            "updatedAt": 1633036800
        },
        "tag": "accounting",
        "order": 1
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

updatecompany

  • description: update a company by id of the company

Request

Request url

PUT /company/:companyId

Parameters

name type description required default
companyId number id of the company true --

body

name type description
action string action to update the company e.g. setToTop, updateupdateTag
tag string tag or label associated with the company

Request Example

PUT /company/1

const body = {
        "action": "updateTag",
        "tag": "accounting",
}

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload ICompanyAndRole response data

ICompanyAndRole

name type description
company ICompany Company information
role IRole Role information
tag string Tag or label associated with the company
order number Order of the company

ICompany

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

IRole

name type description
id number Primary Key
name string Name of the role
permission string Permission of the role
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Update a company info of the user successfully",
    "payload": 
    {
        "company": {
            "id": 1,
            "imageId": "abc123",
            "name": "iSunFAAAA",
            "taxId": "12345678",
            "startDate": 1633036800,
            "createdAt": 1633036800,
            "updatedAt": 1633036800
        },
        "role": {
            "id": 1,
            "name": "admin",
            "permission": "all",
            "createdAt": 1633036800,
            "updatedAt": 1633036800
        },
        "tag": "accounting",
        "order": 1
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

deleteCompany

  • description: delete a company by id of the company

Request

Request url

DELETE /company/:companyId

Parameters

name type description required default
companyId number id of the company true --

Request Example

DELETE /company/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload company response data

company

name type description
id number id of the company
imageId string ID of the associated image
name string name of the company
taxId string tax Id of the company
startDate number start date of the company
createdAt number timestamp when created
updatedAt number timestamp when updated

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Delete a company info of the user successfully",
    "payload": 
    {
        "id": 1,
        "imageId": "abc123",
        "name": "iSunFAAAA",
        "taxId": "12345678",
        "startDate": 1633036800,
        "createdAt": 1633036800,
        "updatedAt": 1633036800
    },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

selectUserCompany

  • description: This API provides the functionality to select a company.

Request

Request URL

PUT /user/userId/selected_company

Query

name type description required default
userId number specific user number yes -

Body

name type description required default
companyId number specific company number yes -

Request Example

PUT /user/1/selected_company

const body = {
    "companyId": 1
}

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload company response data or {}

company

name type description
id number id of the company
imageId string ID of the associated image
name string name of the company
taxId string tax Id of the company
startDate number start date of the company
createdAt number timestamp when created
updatedAt number timestamp when updated

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Select a company successfully",
    "payload": 
    {
        "id": 1,
        "imageId": "abc123",
        "name": "iSunFAAAA",
        "taxId": "12345678",
        "startDate": 1633036800,
        "createdAt": 1633036800,
        "updatedAt": 1633036800
    },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

createfile

  • description: create a file

Request

Request url

POST /file

Query

name type description required default
type string type of the file yes -
targetId number id of the target yes -

Body

name type description required default
formData formData form data of the file yes -

formData

name type description required default
file file file to upload yes -
encryptedSymmetricKey string encrypted symmetric key yes -
iv string iv of the file yes -

Request Example

POST /file?type=company&targetId=1

const body = {
    "formData": {
        "file": file,
        "encryptedSymmetricKey": "1234567890",
        "iv": "1234567890"
    }
}

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload file response data or {}

file

name type description
id number id of the file
name string name of the file
size number size of the file
existed boolean existed or not
url string url of the file

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": true,
    "code":  "201",
    "message": "Created successfully",
    "payload": 
    {
        "id": 1,
        "name": "file1",
        "size": 123456,
        "existed": true,
        "url": "https://www.isunfa.com/file/1"
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code":  "400",
    "message": "bad request",
    "payload": {}
}

getFileById

  • description: get a file by id of the file

Request

Request url

GET /file/:fileId

Parameters

name type description required default
fileId number id of the file true --

Request Example

GET /file/1

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload file response data or {}

file

name type description
id number id of the file
name string name of the file
size number size of the file
existed boolean existed or not
url string url of the file

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": true,
    "code":  "200",
    "message": "Get a file successfully",
    "payload": 
    {
        "id": 1,
        "name": "file1",
        "size": 123456,
        "existed": true,
        "url": "https://www.isunfa.com/file/1"
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code":  "404",
    "message": "Not found",
    "payload": {}
}

deleteFileById

  • description: delete a file by id of the file

Request

Request url

DELETE /file/:fileId

Parameters

name type description required default
fileId number id of the file true --

Request Example

DELETE /file/1

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload file response data or {}

file

name type description
id number id of the file
name string name of the file
size number size of the file
existed boolean existed or not
url string url of the file

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": true,
    "code":  "200",
    "message": "Delete a file successfully",
    "payload": 
    {
        "id": 1,
        "name": "file1",
        "size": 123456,
        "existed": true,
        "url": "https://www.isunfa.com/file/1"
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code":  "404",
    "message": "Not found",
    "payload": {}
}

getimageById

  • description: get a image by id of the image

Request

Request url

GET /image/:imageId

Parameters

name type description required default
imageId number id of the image true --

Request Example

GET /image/1

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload buffer response data

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": true,
    "code":  "200",
    "message": "Get a image successfully",
    "payload": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABjElEQVRIS+2Vv0oDQRDG"
}
  • 失敗的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code":  "400",
    "message": "bad request",
    "payload": {}
}

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.2+50",
    "success": true,
    "code":  "200",
    "message": "Get a image successfully",
    "payload": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABjElEQVRIS+2Vv0oDQRDG

# createKYC

- description: create a kyc

## Request

### Request url

```typescript
POST user/:userId/kyc

Parameters

name type description required default
userId string id of the user true --
type string type of the kyc true --

body

bookkeeper

name type description
name string bookkeeper's name
birthDate string bookkeeper's birthday
email string bookkeeper's email
phone string bookkeeper's phone number
qualification boolean bookkeeper's qualification
certificationNumber string bookkeeper's certification number
personalIdType string bookkeeper's personal id type
personalIdFileId string bookkeeper's personal id
certificationFileId string bookkeeper's certification file

Request Example

POST user/1/kyc

const body = {
          "type": "bookkeeper",
          "name": "isunfa",
          "birthDate": "1990-01-01",
          "email": "[email protected]",
            "phone": "0912345678",
            "qualification": true,
            "certificationNumber": "1234",
            "personalIdType": "id",
            "personalIdFileId": 1234,
            "certificationFileId": 1234
         }

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload KYC response data

KYC

name type description
id number kyc's id
userId number id of the user associated with the kyc
type string type of the kyc
content string content of the kyc
status string status of the kyc
reviewer number name of the reviewer
note string note of the kyc
createdAt number create time
updatedAt number update time
reviewedAt number review time
deletedAt number delete time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Create a kyc successfully",
    "payload": 
       {
          "id": 1,
          "userId": 1,
          "type": "bookkeeper",
          "content": "isunfa",
          "status": "pending",
          "reviewer": null,
          "note": null,
          "createdAt": 1630000001,
          "updatedAt": 1630000001,
          "reviewedAt": null,
          "deletedAt": null,
       },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

listOrder

  • description:
    • get order list

Request

Request url

GET /company/:companyId/order

Param

name type description required default
companyId string specific id of the company yes -

Request Example

GET /company/1/order

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description the status of the request
payload Order[] order list

Order

name type description
id number Unique identifier for the order
companyId number Identifier for the associated company
planId number Identifier for the associated plan
status string Current status of the order
createdAt number Timestamp when the order was created
updatedAt number Timestamp when the order was last updated

Response example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.4+55",
    "success": true,
    "code": "200ISF0002",
    "message": "list successfully",
    "payload":  [
        {
            "id": 1,
            "companyId": 1,
            "planId": 1,
            "status": "success",
            "createdAt": 1630000000,
            "updatedAt": 1630000000
        }
    ]
}
  • 失敗的回傳
{
        "powerby": "iSunFA v0.1.2+50",
        "success": false,
        "code":  "400",
        "message": "bad request",
        "payload": {}
}

createOrder

  • description:
    • create an order

Request

Request url

POST /company/:companyId/order

Param

name type description required default
companyId string specific id of the company yes -

Body

name type description required default
planId number specific id of the plan yes -
status string status of the order yes -

Request Example

POST /company/1/order
{
    "planId": 1,
    "status": "active"
}

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description the status of the request
payload Order an order

Response example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.4+55",
    "success": true,
    "code": "200ISF0002",
    "message": "Create successfully",
    "payload": {
      "id": 12345,
      "companyId": 678,
      "planId": 91011,
      "status": "active",
      "createdAt": 1627890123,
      "updatedAt": 1627891123
    }

}
  • 失敗的回傳
{
        "powerby": "iSunFA v0.1.2+50",
        "success": false,
        "code":  "400",
        "message": "bad request",
        "payload": {}
}

getPaymentByOrderId

  • description:
    • get payment by order id

Request

Request url

GET /company/:companyId/payment?orderId=

Param

name type description required default
companyId string specific id of the company yes -

Query

name type description required default
orderId string specific id of the order yes -

Request Example

GET /company/1/payment?orderId=ORDER00001

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description the status of the request
payload string redirectUrl

Response example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.4+55",
    "success": true,
    "code": "200ISF0002",
    "message": "Get successfully",
    "payload":  "https://${merchantId}.testing.oen.tw/checkout/subscription/create/${id}"
}
  • 失敗的回傳
{
        "powerby": "iSunFA v0.1.2+50",
        "success": false,
        "code":  "400",
        "message": "bad request",
        "payload": ""
}

createPayment

  • description:
    • create payment

Request

Request url

POST /company/:companyId/payment

Param

name type description required default
companyId string specific id of the company yes -

Body

name type description required default
token string specific id of the token yes -
customId string json stringify, with orderIdNum, subPlan, subPeriod yes -

Request Example

POST /company/1/payment
{
    "token": "2etM3aQSCMWv7OGYQ6gDWtcOJaR",
    "customId": "{"orderId":1,"subPlan":"Trail","subPeriod":30}"
}

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description the status of the request
payload string payment record status

Response example

  • 成功的回傳
{
    "powerby": "iSunFA v0.1.4+55",
    "success": true,
    "code": "200ISF0002",
    "message": "Create successfully",
    "payload":  "success"
}
  • 失敗的回傳
{
        "powerby": "iSunFA v0.1.2+50",
        "success": false,
        "code":  "400",
        "message": "bad request",
        "payload": ""
}

listCompanyPendingTask

  • description: get all pending tasks of the company

Request

Request url

GET company/:companyId/pending_task

Parameters

name type description required default
companyId string id of the company true --

Request Example

GET company/1/pending_task

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IPendingTask response data

IPendingTask

name type description
companyId number id of the company
missingCertificate IMissingCertificate missing certificate info
missingCertificatePercentage number missing certificate percentage
unpostedVoucher IUnpostedVoucher unposted voucher info
unpostedVoucherPercentage number unposted voucher percentage

IMissingCertificate

name type description
companyId number id of the company
companyName string name of the company
count number count of missing certificate

IUnpostedVoucher

name type description
companyId number id of the company
companyName string name of the company
count number count of unposted voucher

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get all pending tasks of the company successfully",
    "payload": 
    {
        "companyId": 1,
        "missingCertificate": {
            "companyId": 1,
            "companyName": "iSunFA",
            "count": 1
        },
        "missingCertificatePercentage": 0.1,
        "unpostedVoucher": {
            "companyId": 1,
            "companyName": "iSunFA",
            "count": 2
        },
        "unpostedVoucherPercentage": 0.2
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

listUserPendingTask

  • description: get all pending tasks of the user

Request

Request url

GET user/:userId/pending_task

Parameters

name type description required default
userId string id of the user true --

Request Example

GET user/1/pending_task

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IPendingTask response data

IPendingTask

name type description
userId number id of the user
totalMissingCertificate number total missing certificate
totalMissingCertificatePercentage number total missing certificate percentage
missingCertificateList IMissingCertificate[] missing certificate list
totalUnpostedVoucher number total unposted voucher
totalUnpostedVoucherPercentage number total unposted voucher percentage
unpostedVoucherList IUnpostedVoucher[] unposted voucher list

IMissingCertificate

name type description
companyId number id of the company
companyName string name of the company
count number count of missing certificate

IUnpostedVoucher

name type description
companyId number id of the company
companyName string name of the company
count number count of unposted voucher

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get all pending tasks of the user successfully",
    "payload": 
    {
        "userId": 1,
        "totalMissingCertificate": 1,
        "totalMissingCertificatePercentage": 0.1,
        "missingCertificateList": [
            {
                "companyId": 1,
                "companyName": "iSunFA",
                "count": 1
            }
        ],
        "totalUnpostedVoucher": 2,
        "totalUnpostedVoucherPercentage": 0.2,
        "unpostedVoucherList": [
            {
                "companyId": 1,
                "companyName": "iSunFA",
                "count": 2
            }
        ]
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

listrole

  • description: get all roles

Request

Request url

GET role

Query

name type description required default
type string type of the role false --

Request Example

GET role?type=User

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload role[] response data

role

name type description
id number role's id
name string role's name
type string role's type
permissionList string role's permission list
createdAt number create time
updatedAt number update time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get all roles successfully",
    "payload": 
       [
          {
            "id": 1,
            "name": "bookkeeper",
            "type": "User",
            "permissionList": "read,write",
            "createdAt": 1630000001,
            "updatedAt": 1630000001
          },
          {
            "id": 2,
            "name": "admin",
            "type": "System",
            "permissionList": "all",
            "createdAt": 1630000001,
            "updatedAt": 1630000001
          }
       ]
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": []
}

createUserRole

  • description: create a role for user

Request

Request url

POST user/:userId/role

Parameters

name type description required default
userId string id of the user true --

body

name type description
roleId number role's id

Request Example

POST user/1/role

const body = {
          "roleId": 1
       }

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload userRole response data

userRole

name type description
id number userRole's id
userId number user's id
role role role related info
lastLoginAt number last login time
createdAt number create time
updatedAt number update time

role

name type description
id number role's id
name string role's name
permissionList string role's permission list
createdAt number create time
updatedAt number update time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get all roles of the user successfully",
    "payload": 
       
          {
            "id": 1,
            "userId": 1,
            "role": {
              "id": 1,
              "name": "bookkeeper",
              "permissionList": "read,write",
              "createdAt": 1630000001,
              "updatedAt": 1630000001
            },
            "lastLoginAt": 1630000001,
            "createdAt": 1630000001,
            "updatedAt": 1630000001
            }
         
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": []
}

listUserRole

  • description: get all roles of the user

Request

Request url

GET user/:userId/role

Parameters

name type description required default
userId string id of the user true --

Request Example

GET user/1/role

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload userRole[] response data

userRole

name type description
id number userRole's id
userId number user;s id
role role role related info
lastLoginAt number last login time
createdAt number create time
updatedAt number update time

Role

name type description
id number role's id
name string role's name
permissionList string role's permission list
createdAt number create time
updatedAt number update time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get all roles of the user successfully",
    "payload": 
       [
          {
            "id": 1,
            "userId": 1,
            "role": {
              "id": 1,
              "name": "bookkeeper",
              "permissionList": "read,write",
              "createdAt": 1630000001,
              "updatedAt": 1630000001
            },
            "lastLoginAt": 1630000001,
            "createdAt": 1630000001,
            "updatedAt": 1630000001
            }
         ]
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": []
}

selectUserRole

  • description: select a role for user

Request

Request url

PUT /user/:userId/selected_role

Parameters

name type description required default
userId string id of the user true --

body

name type description
roleId number role's id

Request Example

PUT /user/1/selected_role

const body = {
          "roleId": 1
       }

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload userRole response data

userRole

name type description
id number userRole's id
userId number user's id
role role role related info
lastLoginAt number last login time
createdAt number create time
updatedAt number update time

role

name type description
id number role's id
name string role's name
permissionList string role's permission list
createdAt number create time
updatedAt number update time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get all roles of the user successfully",
    "payload": 
       
          {
            "id": 1,
            "userId": 1,
            "role": {
              "id": 1,
              "name": "bookkeeper",
              "permissionList": "read,write",
              "createdAt": 1630000001,
              "updatedAt": 1630000001
            },
            "lastLoginAt": 1630000001,
            "createdAt": 1630000001,
            "updatedAt": 1630000001
            }
         
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": []
}

getReport

  • description: get Report by startDate, endDate and reportType
  • Check Postman for example request

Request

Request url

GET /company/:companyId/report?startDate=1704070800&endDate=1706745599&language=en&reportType=cash_flow_statement

Params

name type description required default
companyId number specific id of the companyId yes -

Query

name type description required default
startDate number timestamp in second yes -
endDate number timestamp in second yes -
language number can be any string, but require yes -
reportType FinancialReportTypesKey can be found in src/interfaces/report_type.ts yes -

Request Example

GET /company/10000009/report?startDate=1704070800&endDate=1706745599&language=en&reportType=cash_flow_statement

Response

Response Parameter

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description
payload FinancialReport or null) the data

FinancialReport

name type description
company {id: number, code: string, name: string} company related info
preDate {from: number, to: number } last period time spam, it will be same date of curDate last year
curDate {from: number, to: number } it will be from and to of current date
reportType ReportSheetType { BALANCE_SHEET = 'balance_sheet', INCOME_STATEMENT = 'comprehensive_income_statement', CASH_FLOW_STATEMENT = 'cash_flow_statement', REPORT_401 = 'report_401',} Financial Report type
general IAccountReadyForFrontend[] simplified version of financial report rows
details IAccountReadyForFrontend[] detail version of financial report rows
otherInfo BalanceSheetOtherInfo | IncomeStatementOtherInfo | CashFlowStatementOtherInfo base on your financial report type, it will return different info
IAccountReadyForFrontend
name type description
code string code of accounting
name string name of accounting
curPeriodAmount number this period amount of money
curPeriodAmountString string (Recomended)this period amount of money but in string, it will be (brackets) if negative, it will be - if too small
curPeriodPercentage number percentage of amount vs total amount of that account category
curPeriodPercentageString string (Recomended)this period number of percntage but in string, it will be (brackets) if negative, it will be - if too small
prePeriodAmount number last period amount of money
prePeriodAmountString string (Recomended) last period amount of money percntage but in string, it will be (brackets) if negative, it will be - if too small
prePeriodPercentage number percentage of amount vs total amount of that account category
prePeriodPercentageString string (Recomended)last period number of percntage but in string, it will be (brackets) if negative, it will be - if too small
indent number what level of this account in account tree
children IAccountReadyForFrontend[] next layer of accounts, can be use to Expand
BalanceSheetOtherInfo
name type description
assetLiabilityRatio {[date: string]: {data: number[], labels: string[]}} data 和 labels 的順序是 [資產, 負債, 權益],key 則是日期 YYYY-MM-DD
assetMixRatio {[date: string]: {data: number[], labels: string[]}} data 和 labels 的順序是 [資產, 負債, 權益],key 則是日期 YYYY-MM-DD
dso { curDso: number; preDso: number;} 應收週轉天數:curDso 是本期,preDso 是上期
inventoryTurnoverDays { curInventoryTurnoverDays: number; preInventoryTurnoverDays: number; }; 存貨週轉天數: curInventoryTurnoverDays 是本期, preInventoryTurnoverDays 是上期
IncomeStatementOtherInfo
name type description
revenueAndExpenseRatio Check Below 投入費用和成本, 與收入的倍數關係
revenueToRD Check Below 收入提撥制研發費用比例
RevenueAndExpenseRatio
name type description
revenue IAccountReadyForFrontend revenue data of current year income statement
totalCost IAccountReadyForFrontend total Cost(not expense) of current year income statement
salesExpense IAccountReadyForFrontend sale expense data of current year income statement
administrativeExpense IAccountReadyForFrontend admin expense data of current year income statement
ratio {curRatio: number; preRatio: number;}; ratio of revenue/(cost + expense)
RevenueToRD
name type description
revenue IAccountReadyForFrontend revenue data of current year income statement
researchAndDevelopmentExpense IAccountReadyForFrontend Research and Development expense of current year income statement
ratio {curRatio: number; preRatio: number;}; ratio of revenue/(cost + expense)
CashFlowStatementOtherInfo
name type description
operatingStabilized Check Below 營業活動穩定度:A 與 B 呈現穩定比例關係,公司的營業活動穩定
lineChartDataForRatio {data: number[];labels: string[];} A 和 b 比例的線圖, labels 依照時間排列
strategyInvest [year: string]: {data: number[];labels: string[];}; 依照年份列出 [不動產、廠房、設備的收支項目, 策略性投資項目, 其他] data 是資料內容,labels 是資料名稱
thirdTitle string 三:營業活動穩定度 的標題內容
forthTitle String 四:投資活動 - 「不動產, 廠房及設備」及 「策略性投資」 的標題內容
fourPointOneTitle String 四之一:202X 年度上圖組成支系項及 ISunFa 認為
ourThoughts String[] (length is 3) 四之一的 段落內容: outThoughts[0] 是第一段(不動產, 廠房, 設備的收支項目),outThoughts[1] 是第二段(策略性投資項目),outThoughts[2] 是第三段(其他)
freeCash Check Below 五、年度產生的自由現金圖表資料
OperatingStabilized
name type description
beforeTaxIncome [year: string]: number 5 period (current year ~ current year - 4) of income before tax
amortizationDepreciation [year: string]: number 5 period (current year ~ current year - 4) of amortization and depreciation
tax [year: string]: number 5 period (current year ~ current year - 4) of tax expense
operatingIncomeCashFlow [year: string]: number 5 period (current year ~ current year - 4) of operating income cash flow
ratio [year: string]: number 5 period (current year ~ current year - 4) of (beforeTaxIncome + amortizationDepreciation + tax) / operatingIncomeCashFlow
FreeCash
  freeCash: {
    [year: string]: {
      operatingCashFlow: number;
      ppe: number;
      intangibleAsset: number;
      freeCash: number;
    };
  };
name type description
[year] string 以年份當作 key, 有今年度和去年度資料
operatingCashFlow number 營業活動產生的現金流量
ppe number 不動產、廠房及設備的收支項目
intangibleAsset number 無形資產的收支項目
freeCash number 自由現金流量

Response example

{
    "powerby": "iSunFA v0.8.2+71",
    "success": true,
    "code": "200ISF0002",
    "message": "Get successfully",
    "payload": {
        "company": {
            "id": 10000009,
            "code": "11",
            "name": "local"
        },
        "reportType": "balance_sheet",
        "preDate": {
            "from": 1672534800,
            "to": 1675209599
        },
        "curDate": {
            "from": 1704070800,
            "to": 1706745599
        },
        "otherInfo": {
            "assetLiabilityRatio": {
                "2024-02-01": {
                    "data": [
                        50,
                        12,
                        38
                    ],
                    "labels": [
                        "資產",
                        "負債",
                        "權益"
                    ]
                },
                "2023-02-01": {
                    "data": [
                        0,
                        0,
                        0
                    ],
                    "labels": [
                        "資產",
                        "負債",
                        "權益"
                    ]
                }
            },
            "assetMixRatio": {
                "2024-02-01": {
                    "data": [
                        58,
                        27,
                        16,
                        14,
                        0
                    ],
                    "labels": [
                        "應收帳款淨額",
                        "不動產、廠房及設備",
                        "預付款項",
                        "現金及約當現金",
                        "透過損益按公允價值衡量之⾦融資產-流動"
                    ]
                },
                "2023-02-01": {
                    "data": [
                        0,
                        0,
                        0,
                        0,
                        0,
                        100
                    ],
                    "labels": [
                        "應收帳款淨額",
                        "不動產、廠房及設備",
                        "預付款項",
                        "現金及約當現金",
                        "透過損益按公允價值衡量之⾦融資產-流動",
                        "其他"
                    ]
                }
            },
            "dso": {
                "curDso": -365,
                "preDso": 0
            },
            "inventoryTurnoverDays": {
                "curInventoryTurnoverDays": -182.5,
                "preInventoryTurnoverDays": 0
            }
        },
        "general": [
            {
                "code": "11XX",
                "name": "流動資產合計",
                "curPeriodAmount": 270000,
                "curPeriodPercentage": 73,
                "curPeriodAmountString": "270,000",
                "curPeriodPercentageString": "73",
                "prePeriodAmount": 0,
                "prePeriodPercentage": 0,
                "prePeriodAmountString": "-",
                "prePeriodPercentageString": "-",
                "indent": 2,
                "children": []
            },
        ],
        "details": [
            {
                "code": "1100",
                "name": "現金及約當現金",
                "curPeriodAmount": 50000,
                "curPeriodPercentage": 14,
                "curPeriodAmountString": "50,000",
                "curPeriodPercentageString": "14",
                "prePeriodAmount": 0,
                "prePeriodPercentage": 0,
                "prePeriodAmountString": "-",
                "prePeriodPercentageString": "-",
                "indent": 2,
                "children": [
                    {
                        "code": "1101",
                        "name": "庫存現金",
                        "curPeriodAmount": 66000,
                        "curPeriodPercentage": 18,
                        "curPeriodAmountString": "66,000",
                        "curPeriodPercentageString": "18",
                        "prePeriodAmount": 0,
                        "prePeriodPercentage": 0,
                        "prePeriodAmountString": "-",
                        "prePeriodPercentageString": "-",
                        "indent": 3,
                        "children": []
                    },
                ]
            }
        ]
    }
}

createroom

  • description: create a room

Request

Request url

POST /room

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IRoom response data

IRoom

name type description
id string room's id
password string room's password
fileList IFileBeta[] list of files in the room

IFileBeta

name type description
id string file's id
name string file's name
size number file's size
type string file's type
url string file's url

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Create a room successfully",
    "payload": 
    {
        "id": 1,
        "password": "123456",
        "fileList": [
            {
                "id": 1,
                "name": "file1",
                "size": 1000,
                "type": "pdf",
                "url": "https://www.example.com/file1.pdf"
            }
        ]
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getroombyid

  • description: get a room by id

Request

Request url

POST /room/:roomId

note: use POST method to get room by id for security reason

Parameters

name type description required default
roomId string id of the room true --

body

name type description required default
password string room's password true --

Request Example

POST /room/1

const body = {
          "password":"123321"
          }

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IRoom response data

IRoom

name type description
id string room's id
password string room's password
fileList IFileBeta[] list of files in the room

IFileBeta

name type description
id string file's id
name string file's name
size number file's size
type string file's type
url string file's url

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get a room successfully",
    "payload": 
    {
        "id": 1,
        "password": "123456",
        "fileList": [
            {
                "id": 1,
                "name": "file1",
                "size": 1000,
                "type": "pdf",
                "url": "https://www.example.com/file1.pdf"
            }
        ]
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

deleteroombyid

  • description: delete a room by id

Request

Request url

DELETE /room/:roomId

Parameters

name type description required default
roomId string id of the room true --

Request Example

DELETE /room/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IRoom response data

IRoom

name type description
id string room's id
password string room's password
fileList IFileBeta[] list of files in the room

IFileBeta

name type description
id string file's id
name string file's name
size number file's size
type string file's type
url string file's url

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Delete a room successfully",
    "payload": 
    {
        "id": 1,
        "password": "123456",
        "fileList": [
            {
                "id": 1,
                "name": "file1",
                "size": 1000,
                "type": "pdf",
                "url": "https://www.example.com/file1.pdf"
            }
        ]
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getAccountingSetting

description: get the accounting setting of the company

Request

Request url

GET /company/:companyId/accounting_setting

Parameters

name type description required default
companyId string id of the company true --

Request Example

GET /company/1/accounting_setting

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IAccountingSetting response data

IAccountingSetting

name type description
id number Primary Key
companyId number Company ID
companyName string Name of the company
taxSettings ITaxSetting Tax settings for the company
currency string Currency code (e.g., USD, EUR)
lastDayOfFiscalYear number Last day of the fiscal year
shortcutList IShortcut[] List of shortcuts defined for the company

ITaxSetting

name type description
salesTax ITaxRate Sales tax settings
purchaseTax ITaxRate Purchase tax settings
returnPeriodicity string Frequency of tax return (e.g., monthly)

ITaxRate

name type description
taxable boolean Indicates if the item is taxable
rate number Tax rate percentage

IShortcut

name type description
action IAction The action that this shortcut performs
keyList string[] List of keys associated with the shortcut

IAction

name type description
name string Name of the action
description string Description of the action
fieldList IField[] List of fields associated with the action

IField

name type description
name string Name of the field
value string Value of the field

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get a company accounting setting successfully",
    "payload": 
    {
        "id": 1,
        "companyId": 1,
        "companyName": "iSunFA",
        "taxSettings": {
            "salesTax": {
                "taxable": true,
                "rate": 7
            },
            "purchaseTax": {
                "taxable": true,
                "rate": 7
            },
            "returnPeriodicity": "Month"
        },
        "currency": "USD",
        "lastDayOfFiscalYear": 30,
        "shortcutList": [
            {
                "action": {
                    "name": "Create Invoice",
                    "description": "Create a new invoice",
                    "fieldList": [
                        {
                            "name": "Customer",
                            "value": "Customer Name"
                        },
                        {
                            "name": "Amount",
                            "value": "1000"
                        }
                    ]
                },
                "keyList": ["Ctrl", "I"]
            }
        ]
    },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

updateAccountingSetting

  • description: update the accounting setting of the company

Request

Request url

PUT /company/:companyId/accounting_setting

Parameters

name type description required default
companyId string id of the company true --

body

name type description
taxSettings ITaxSetting Tax settings for the company
currency string Currency code (e.g., USD, EUR)
lastDayOfFiscalYear number Last day of the fiscal year
shortcutList IShortcut[] List of shortcuts defined for the company

ITaxSetting

name type description
salesTax ITaxRate Sales tax settings
purchaseTax ITaxRate Purchase tax settings
returnPeriodicity string Frequency of tax return (e.g., monthly)

ITaxRate

name type description
taxable boolean Indicates if the item is taxable
rate number Tax rate percentage

IShortcut

name type description
action IAction The action that this shortcut performs
keyList string[] List of keys associated with the shortcut

IAction

name type description
name string Name of the action
description string Description of the action
fieldList IField[] List of fields associated with the action

IField

name type description
name string Name of the field
value string Value of the field

Request Example

PUT /company/1/accounting_setting

const body = {
    "taxSettings": {
        "salesTax": {
            "taxable": true,
            "rate": 7
        },
        "purchaseTax": {
            "taxable": true,
            "rate": 7
        },
        "returnPeriodicity": "Month"
    },
    "currency": "USD",
    "lastDayOfFiscalYear": 30,
    "shortcutList": [
        {
            "action": {
                "name": "Create Invoice",
                "description": "Create a new invoice",
                "fieldList": [
                    {
                        "name": "Customer",
                        "value": "Customer Name"
                    },
                    {
                        "name": "Amount",
                        "value": "1000"
                    }
                ]
            },
            "keyList": ["Ctrl", "I"]
        }
    ]
}

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IAccountingSetting response data

IAccountingSetting

name type description
id number Primary Key
companyId number Company ID
companyName string Name of the company
taxSettings ITaxSetting Tax settings for the company
currency string Currency code (e.g., USD, EUR)
lastDayOfFiscalYear number Last day of the fiscal year
shortcutList IShortcut[] List of shortcuts defined for the company

ITaxSetting

name type description
salesTax ITaxRate Sales tax settings
purchaseTax ITaxRate Purchase tax settings
returnPeriodicity string Frequency of tax return (e.g., monthly)

ITaxRate

name type description
taxable boolean Indicates if the item is taxable
rate number Tax rate percentage

IShortcut

name type description
action IAction The action that this shortcut performs
keyList string[] List of keys associated with the shortcut

IAction

name type description
name string Name of the action
description string Description of the action
fieldList IField[] List of fields associated with the action

IField

name type description
name string Name of the field
value string Value of the field

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get a company accounting setting successfully",
    "payload": 
    {
        "id": 1,
        "companyId": 1,
        "companyName": "iSunFA",
        "taxSettings": {
            "salesTax": {
                "taxable": true,
                "rate": 7
            },
            "purchaseTax": {
                "taxable": true,
                "rate": 7
            },
            "returnPeriodicity": "Month"
        },
        "currency": "USD",
        "lastDayOfFiscalYear": 30,
        "shortcutList": [
            {
                "action": {
                    "name": "Create Invoice",
                    "description": "Create a new invoice",
                    "fieldList": [
                        {
                            "name": "Customer",
                            "value": "Customer Name"
                        },
                        {
                            "name": "Amount",
                            "value": "1000"
                        }
                    ]
                },
                "keyList": ["Ctrl", "I"]
            }
        ]
    },
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

listAccount

  • description: get the accounting accounts of the company

Request

Request url

GET /company/:companyId/accounting_setting/account

Parameters

name type description required default
companyId string id of the company true --

Request Example

GET /company/1/accounting_setting/account

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload { code: string, name: string }[] response data

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get accounting accounts of the company successfully",
    "payload": [
        {
            "code": "1755",
            "name": "Royalty assets"
        },
        {
            "code": "1780",
            "name": "Intangible assets"
        },
        {
            "code": "1920",
            "name": "Deposit of Margin"
        },
        {
            "code": "1990",
            "name": "Other non-current assets"
        }
    ]
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

createSubAccountingAccount

  • description: create a sub accounting account of the company

Request

Request url

POST /company/:companyId/accounting_setting/account

Parameters

name type description required default
companyId string id of the company true --

body

name type description
code string code of the account
name string name of the account

Request Example

POST /company/1/accounting_setting/account

const body = {
    "code": "1755",
    "name": "Sub royalty assets"
}

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload subAccount response data

subAccount

name type description
accountingType string type of account, (e.g., Assets)
assetType string category type, (e.g., Non-Current Assets)
currentAssetType string type of current Asset, (e.g., Consolidated financial assets)
code string sub account Code
name string sub account name

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Create a sub accounting account of the company successfully",
    "payload": 
    {
        "accountingType": "Assets",
        "assetType": "Non-Current Assets",
        "currentAssetType": "Consolidated financial assets",
        "code": "1755-01",
        "name": "Sub royalty assets"
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getSubAccountingAccount

  • description: get a sub accounting account of the company

Request

Request url

GET /company/:companyId/account/:accountId

Parameters

name type description required default
companyId string id of the company true --
accountId string id of the account true --

Request Example

GET /company/1/account/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload subAccount response data

subAccount

name type description
accountingType string type of account, (e.g., Assets)
assetType string category type, (e.g., Non-Current Assets)
currentAssetType string type of current Asset, (e.g., Consolidated financial assets)
code string sub account Code
name string sub account name

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get a sub accounting account of the company successfully",
    "payload": 
    {
        "accountingType": "Assets",
        "assetType": "Non-Current Assets",
        "currentAssetType": "Consolidated financial assets",
        "code": "1755-01",
        "name": "Sub royalty assets"
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

updateSubAccountingAccount

  • description: update a sub accounting account of the company

Request

Request url

PUT /company/:companyId/account/:accountId

Parameters

name type description required default
companyId string id of the company true --
accountId string id of the account true --

body

name type description
code string code of the account
name string name of the account

Request Example

PUT /company/1/account/1

const body = {
    "code": "1755",
    "name": "Sub royalty assets"
}

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload subAccount response data

subAccount

name type description
accountingType string type of account, (e.g., Assets)
assetType string category type, (e.g., Non-Current Assets)
currentAssetType string type of current Asset, (e.g., Consolidated financial assets)
code string sub account Code
name string sub account name

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Update a sub accounting account of the company successfully",
    "payload": 
    {
        "accountingType": "Assets",
        "assetType": "Non-Current Assets",
        "currentAssetType": "Consolidated financial assets",
        "code": "1755-01",
        "name": "Sub royalty assets"
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

deleteSubAccountingAccount

  • description: delete a sub accounting account of the company

Request

Request url

DELETE /company/:companyId/account/:accountId

Parameters

name type description required default
companyId string id of the company true --
accountId string id of the account true --

Request Example

DELETE /company/1/account/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload subAccount response data

subAccount

name type description
accountingType string type of account, (e.g., Assets)
assetType string category type, (e.g., Non-Current Assets)
currentAssetType string type of current Asset, (e.g., Consolidated financial assets)
code string sub account Code
name string sub account name

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Delete a sub accounting account of the company successfully",
    "payload": 
    {
        "accountingType": "Assets",
        "assetType": "Non-Current Assets",
        "currentAssetType": "Consolidated financial assets",
        "code": "1755-01",
        "name": "Sub royalty assets"
    }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getOpeningBalance

  • description: get the opening balance of the company

Request

Request url

GET /company/:companyId/accounting_setting/opening_balance

Parameters

name type description required default
companyId string id of the company true --

Request Example

GET /company/1/accounting_setting/opening_balance

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload openingBalance[] response data

openingBalance

name type description
code string code of the account
name string name of the account
type string type of the account, (e.g., Current assets)
beginningDebit int beginning debit of the account
openingCredit int beginning credit of the account

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get opening balance of the company successfully",
    "payload": [
        {
            "code": "151711",
            "name": "Consolidated financial assets",
            "type": "Current assets",
            "beginningDebit": 100,
            "openingCredit": 100
        },
        {
            "code": "175511",
            "name": "Royalty assets",
            "type": "Current assets",
            "beginningDebit": 100,
            "openingCredit": 100
        },
        {
            "code": "178911",
            "name": "Intangible assets",
            "type": "Current assets",
            "beginningDebit": 100,
            "openingCredit": 100
        },
        {
            "code": "192011",
            "name": "Deposit of Margin",
            "type": "Current assets",
            "beginningDebit": 100,
            "openingCredit": 100
        }
    ]
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

updateOpeningBalance

  • description: update the opening balance of the company

Request

Request url

PUT /company/:companyId/accounting_setting/opening_balance

Parameters

name type description required default
companyId string id of the company true --

body

name type description
code string code of the account
type string type of the account, (e.g., Current assets)
beginningDebit int beginning debit of the account
openingCredit int beginning credit of the account

Request Example

PUT /company/1/accounting_setting/opening_balance

const body = [
    {
        "code": "151711",
        "type": "Current assets",
        "beginningDebit": 200,
        "openingCredit": 200
    },
    {
        "code": "175511",
        "type": "Non-current assets",
        "beginningDebit": 200,
        "openingCredit": 200
    }
]

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload openingBalance[] response data

openingBalance

name type description
code string code of the account
name string name of the account
type string type of the account, (e.g., Current assets)
beginningDebit int beginning debit of the account
openingCredit int beginning credit of the account

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Update opening balance of the company successfully",
    "payload": [
        {
            "code": "151711",
            "name": "Consolidated financial assets",
            "type": "Current assets",
            "beginningDebit": 200,
            "openingCredit": 200
        },
        {
            "code": "175511",
            "name": "Royalty assets",
            "type": "Non-current",
            "beginningDebit": 200,
            "openingCredit": 200
        },
        {
            "code": "178911",
            "name": "Intangible assets",
            "type": "Current assets",
            "beginningDebit": 100,
            "openingCredit": 100
        },
        {
            "code": "192011",
            "name": "Deposit of Margin",
            "type": "Current assets",
            "beginningDebit": 100,
            "openingCredit": 100
        }
    ]
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

listAllJobs

  • description: List all jobs

Request

Request url

GET /job

Request Query

name type description required
page number The page number no
pageSize number The number of items per page no
sortBy string The field to sort by no
sortOrder string The order to sort by no
startDate number The start date no
endDate number The end date no
searchQuery string The search query no
isMatched boolean Whether the job is matched no

Request Example

GET /job?page=1&pageSize=10&sortBy=createdAt&sortOrder=desc&startDate=1630000001&endDate=1630000001&searchQuery=accounting

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IPaginatedData<IJob[]> response data

IPaginatedData

name type description
data IJob[] The job data
page number The page number
totalPages number The total number of pages
totalCount number The total number of items
pageSize number The number of items per page
hasNextPage boolean Indicates if there is a next page
hasPreviousPage boolean Indicates if there is a previous page
sort {sortBy: string, sortOrder: string}[] The order and field to sort by

IJob

name type description
id number job ID
companyName string company name
companyLogo string company logo URL
issueType string type of job
publicationDate number publication date (timestamp)
estimatedWorkingHours object estimated working hours range
deadline number deadline (timestamp)
hourlyWage number hourly wage
caseDescription string case description
targetCandidates string target candidates description
remarks string remarks
applicationsCount number number of applications
isMatched boolean whether the job is matched
createdAt number creation time (timestamp)
updatedAt number last update time (timestamp)

Response Example

  • Successful response
{
    "powerby": "iSunFA v2.0.0+4",
    "success": true,
    "code": "200ISF0000",
    "message": "Success",
    "payload": {
        "data": [
            {
                "id": 2,
                "companyName": "B 公司",
                "companyLogo": "https://example.com/company-b-logo.png",
                "issueType": "稅務",
                "publicationDate": 1692499600,
                "estimatedWorkingHours": {
                    "start": 1693526400,
                    "end": 1698768000
                },
                "deadline": 1699920000,
                "hourlyWage": 600,
                "caseDescription": "協助處理年度稅務申報",
                "targetCandidates": "有稅務申報經驗的會計師或記帳士",
                "remarks": "需要了解最新的稅務法規",
                "applicationsCount": 3,
                "isMatched": true,
                "createdAt": 1692489600,
                "updatedAt": 1692489600
            },
            {
                "id": 1,
                "companyName": "A 公司",
                "companyLogo": "https://example.com/company-a-logo.png",
                "issueType": "記帳",
                "publicationDate": 1692489600,
                "estimatedWorkingHours": {
                    "start": 1693008000,
                    "end": 1695600000
                },
                "deadline": 1696032000,
                "hourlyWage": 500,
                "caseDescription": "上傳相關憑證,徵求記帳士開立傳票",
                "targetCandidates": "具有3年以上記帳經驗的記帳士",
                "remarks": "需要熟悉國際會計準則",
                "applicationsCount": 5,
                "isMatched": false,
                "createdAt": 1692489600,
                "updatedAt": 1692489600
            }
        ],
        "page": 1,
        "totalPages": 1,
        "totalCount": 2,
        "pageSize": 10,
        "hasNextPage": false,
        "hasPreviousPage": false,
        "sort": [
            {
                "sortBy": "publicationDate",
                "sortOrder": "desc"
            }
        ]
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getAJobById

  • description: Get details of a specific job

Request

Request url

GET /job/:jobId

Parameters

name type description required default
jobId string ID of the job true --

Request Example

GET /job/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload Job response data

Job

name type description
id number job ID
companyName string company name
companyLogo string company logo URL
issueType string type of job
publicationDate number publication date (timestamp)
estimatedWorkingHours object estimated working hours range
deadline number deadline (timestamp)
hourlyWage number hourly wage
caseDescription string case description
targetCandidates string target candidates description
remarks string remarks
applicationsCount number number of applications
isMatched boolean whether the job is matched
createdAt number creation time (timestamp)
updatedAt number last update time (timestamp)

Response Example

  • Successful response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code": "200",
    "message": "Successfully retrieved job details",
    "payload": {
        "id": 1,
        "companyName": "iSunCloud",
        "companyLogo": "https://example.com/isuncloud-logo.png",
        "issueType": "Accounting",
        "publicationDate": 1706227200000,
        "estimatedWorkingHours": {
            "start": 1711584000000,
            "end": 1743120000000
        },
        "deadline": 1743120000000,
        "hourlyWage": 2500,
        "caseDescription": "This is a description of an accounting case.",
        "targetCandidates": "A bookkeeper with tax experience.",
        "remarks": "None",
        "applicationsCount": 10,
        "isMatched": false,
        "createdAt": 1706227200000,
        "updatedAt": 1706227200000
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

createAnApplication

  • description: Create an application for a job

Request

Request url

POST /job/:jobId/application

Parameters

name type description required default
jobId string ID of the job true --

body

name type description
content string application content

Request Example

POST /job/1/application

const body = {
  "content": "application content",
}

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload Application response data

Application

name type description
id number application ID
bookkeeperId number bookkeeper's ID
jobId number job ID
content string application content
createdAt number creation time
updatedAt number last update time

Response Example

  • Successful response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Application created successfully",
    "payload": 
       {
          "id": 1,
          "bookkeeperId": 1000,
          "jobId": 1,
          "content": "application content",
          "createdAt": 1630000000,
          "updatedAt": 1630000000
       }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

listNews

  • description: list news

Request

Request url

GET news
name type description required
simple boolean simple mode no
type string news type no
targetPage string target page no
pageSize number page size no
startDate number start date no
endDate number end date no
searchQuery string search query no

Request Example

GET news?simple=false&type=company&targetPage=1&pageSize=10&startDate=1630000001&endDate=1630000001&searchQuery=apple

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload IPaginatedData<INews[]> INews[]

IPaginatedData

name type description
data INews[] The journal data
page number The page number
totalPages number The total number of pages
totalCount number The total number of items
pageSize number The number of items per page
hasNextPage boolean Indicates if there is a next page
hasPreviousPage boolean Indicates if there is a previous page
sort {sortBy: string, sortOrder: string}[] The order and field to sort by

INews

name type description
id number news's id
imageId string news's image id
title string news's title
content string news's content
type string news's type
createdAt number create time
updatedAt number update time
deletedAt number delete time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "List news successfully",
    "payload": 
       {
          "data": [
            {
              "id": 1,
              "imageId": "1",
              "title": "apple",
              "content": "apple",
              "type": "company",
              "createdAt": 1630000001,
              "updatedAt": 1630000001,
              "deletedAt": null,
            }
          ],
          "page": 1,
          "totalPages": 1,
          "totalCount": 1,
          "pageSize": 10,
          "hasNextPage": false,
          "hasPreviousPage": false,
          "sort": [
            {
              "sortBy": "createdAt",
              "sortOrder": "desc"
            }
          ]
       },
}
  • 成功的回傳(simple)
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "List news successfully",
    "payload": 
       [
            {
              "id": 1,
              "imageId": "1",
              "title": "apple",
              "content": "apple",
              "type": "company",
              "createdAt": 1630000001,
              "updatedAt": 1630000001,
              "deletedAt": null,
            }
          ],
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getnewsbyid

  • description: get news by id

Request

Request url

GET news/:newsId

Parameters

name type description required default
newsId string news id true --

Request Example

GET news/1

Response

Response Parameters

name type description
powerby string the version of the API
success boolean true or false
code string response code
message string a message detailing the result of the request
payload INews response data

INews

name type description
id number news's id
imageId string news's image id
title string news's title
content string news's content
type string news's type
createdAt number create time
updatedAt number update time
deletedAt number delete time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Get news successfully",
    "payload": 
       {
          "id": 1,
          "imageId": "1",
          "title": "apple",
          "content": "apple",
          "type": "company",
          "createdAt": 1630000001,
          "updatedAt": 1630000001,
          "deletedAt": null,
       }
}
  • 失敗的回傳
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

signOut

  • description: This API is used to sign out an user by clearing the FIDO2 cookie.

Request

Request URL

POST `/sign-out`

Request Example

POST `/sign-out`

Response

Response Parameters

name type description
success boolean indicates whether the operation was successful
message string provides a message related to the success or failure of the operation.

Response Example

  • Successful Response

    {
      "success": true,
      "message": "Successfully signed out"
    }
  • Unsuccessful Response

    {
      "success": false,
      "message": "Failed to sign out"
    }

getStatusInfo

  • description: This API provides the functionality to get the session information.

Request

Request URL

GET `/status_info`

Request Example

GET `/status_info`

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload User & Company & Role response data or {}

Company

name type description
id number id of company
name string name of company
code string code of company
regional string regional of company
kycStatus boolean kyc status of company
imageId string image id of company
startDate number start date of the company
createdAt number create timestamp of the company
updatedAt number update timestamp of the company

User

name type description
id number unique number of user
name string user name
fullName string user full name
email string user email
phone string user phone
imageId string user image id
agreementList string[] list of agreement hash
createdAt number creation timestamp
updatedAt number update timestamp

role

name type description
id number role's id
name string role's name
permissionList string role's permission list
createdAt number create time
updatedAt number update time

Response Example

  • 成功的回傳
{
    "powerby": "iSunFA v0.8.0+5",
    "success": true,
    "code": "200ISF0002",
    "message": "Get successfully",
    "payload": {
        "user": {
            "id": 10000003,
            "name": "kk",
            "fullName": null,
            "email": null,
            "phone": null,
            "imageId": "552c2dbf-997c-4b13-957e-ea03c45d2ec1.svg",
            "agreementList": ["agreement1", "agreement2"],
            "createdAt": 1723538422,
            "updatedAt": 1723538422
        },
        "company": {
            "id": 10000002,
            "name": "kk",
            "code": "123",
            "regional": "Taiwan",
            "kycStatus": false,
            "imageId": "https://storage.googleapis.com/mermer-offical-km/ISunFa/e8a48a55-2d97-4dc3-89fb-0fd3947cc971.svg",
            "startDate": 1723538434,
            "createdAt": 1723538434,
            "updatedAt": 1723538434,
            "deletedAt": null
        },
        "role": {
            "id": 10000001,
            "name": "admin",
            "permissionList": ["permission1", "permission2"],
            "createdAt": 1723538422,
            "updatedAt": 1723538422
        }
    }
}
  • 失敗的回傳
    {
      "powerby": "iSunFA v0.1.2+50",
      "success": false,
      "code": "404",
      "message": "Resource not found",
      "payload": {} 
    }

listTrialBalance

  • Description: List all trial balance items

Request

Request URL

GET /company/:companyId/trial_balance

Parameters

Name Type Description Required Default
companyId string Company ID Yes --

Query Parameters

Name Type Description Required Default
startDate number Start date (timestamp, seconds) Yes --
endDate number End date (timestamp, seconds) Yes --
sortOption string Sort options sortBy:sortOrder multiple conditions separated by - No beginningCreditAmount:desc
page number Page number No 1
pageSize number Items per page No 10

Request Example

GET /company/10000/trial_balance?startDate=1728802871&endDate=1731524471&page=1&pageSize=10&sortOption=EndingDebitAmount:desc

Response

Response Parameters

Name Type Description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload object Trial balance data

Payload

Name Type Description
currencyAlias string Currency of the trial balance
items IPaginatedData<TrialBalanceItem[]> Paginated list of trial balance items
total ITrialBalanceTotal Total amount

IPaginatedData

Name Type Description
data TrialBalanceItem[] Trial balance item list
page number Current page number
totalPages number Total number of pages
totalCount number Total number of trial balance items
pageSize number Items per page
hasNextPage boolean Whether there is a next page
hasPreviousPage boolean Whether there is a previous page
sort {sortBy: string, sortOrder: string}[] Sort method

TrialBalanceItem

Name Type Description
id number Account ID
no string Account number
accountingTitle string Accounting title
beginningCreditAmount number Beginning credit balance
beginningDebitAmount number Beginning debit balance
midtermCreditAmount number Current period credit transactions
midtermDebitAmount number Current period debit transactions
endingCreditAmount number Ending credit balance
endingDebitAmount number Ending debit balance
createAt number Creation timestamp, seconds
updateAt number Last update timestamp, seconds
deletedAt number Deletion timestamp, seconds
subAccounts TrialBalanceItem[] List of sub-accounts

ITrialBalanceTotal

Name Type Description
beginningCreditAmount number Beginning credit balance
beginningDebitAmount number Beginning debit balance
midtermCreditAmount number Current period credit transactions
midtermDebitAmount number Current period debit transactions
endingCreditAmount number Ending credit balance
endingDebitAmount number Ending debit balance
createAt number Creation timestamp, seconds
updateAt number Last update timestamp, seconds

Response Example

  • Successful response
{
    "powerby": "iSunFA v0.8.5+73",
    "success": true,
    "code": "200ISF0001",
    "message": "List successfully",
    "payload": {
        "currencyAlias": "TWD",
        "items": {
            "data": [
                {
                    "id": 10000345,
                    "no": "6112",
                    "accountingTitle": "推銷費用 - 文具用品",
                    "beginningCreditAmount": 0,
                    "beginningDebitAmount": 300,
                    "midtermCreditAmount": 0,
                    "midtermDebitAmount": 0,
                    "endingCreditAmount": 0,
                    "endingDebitAmount": 300,
                    "createAt": 0,
                    "updateAt": 0,
                    "subAccounts": []
                },
                {
                    "id": 10000347,
                    "no": "6114",
                    "accountingTitle": "推銷費用 - 運費",
                    "beginningCreditAmount": 0,
                    "beginningDebitAmount": 0,
                    "midtermCreditAmount": 0,
                    "midtermDebitAmount": 50,
                    "endingCreditAmount": 0,
                    "endingDebitAmount": 50,
                    "createAt": 0,
                    "updateAt": 0,
                    "subAccounts": []
                },
                {
                    "id": 10000601,
                    "no": "1101",
                    "accountingTitle": "庫存現金",
                    "beginningCreditAmount": 300,
                    "beginningDebitAmount": 0,
                    "midtermCreditAmount": 0,
                    "midtermDebitAmount": 0,
                    "endingCreditAmount": 300,
                    "endingDebitAmount": 0,
                    "createAt": 0,
                    "updateAt": 0,
                    "subAccounts": []
                },
                {
                    "id": 10000602,
                    "no": "1102",
                    "accountingTitle": "零用金/週轉金",
                    "beginningCreditAmount": 0,
                    "beginningDebitAmount": 0,
                    "midtermCreditAmount": 50,
                    "midtermDebitAmount": 0,
                    "endingCreditAmount": 50,
                    "endingDebitAmount": 0,
                    "createAt": 0,
                    "updateAt": 0,
                    "subAccounts": []
                }
            ],
            "page": 1,
            "totalPages": 1,
            "totalCount": 4,
            "pageSize": 10,
            "hasNextPage": false,
            "hasPreviousPage": false,
            "sort": [
                {
                    "sortBy": "EndingDebitAmount",
                    "sortOrder": "desc"
                }
            ]
        },
        "total": {
            "beginningCreditAmount": 300,
            "beginningDebitAmount": 300,
            "midtermCreditAmount": 50,
            "midtermDebitAmount": 50,
            "endingCreditAmount": 350,
            "endingDebitAmount": 350,
            "createAt": 1731554218,
            "updateAt": 1731554218
        }
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code": "405ISF0000",
    "message": "Method not allowed",
    "payload": {}
}

listLedger

  • Description: List ledger details for a specific accounting account range

Request

Request URL

GET /company/:companyId/ledger

Parameters

Name Type Description Required Default
companyId string Company ID Yes --

Query Parameters

Name Type Description Required Default
startDate number Start date (timestamp, seconds) Yes --
endDate number End date (timestamp, seconds) Yes --
startAccountNo string Starting account number No --
endAccountNo string Ending account number No --
labelType string Label type (general/detailed/all) No general
page number Page number No 1
pageSize number Items per page No 10

Request Example

GET /company/1/ledger?startDate=1706745600&endDate=1707350399&startAccountNo=1141&endAccountNo=1142&labelType=general&page=1&pageSize=10

Response

Response Parameters

Name Type Description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload object Ledger data

Payload

Name Type Description
currencyAlias string Currency
items IPaginatedData<LedgerItem[]> Paginated list of ledger items
total ILedgerTotal Information about total debit and credit amount

IPaginatedData

Name Type Description
data LedgerItem[] Ledger item list
page number Current page number
totalPages number Total number of pages
totalCount number Total number of ledger items
pageSize number Items per page
hasNextPage boolean Whether there is a next page
hasPreviousPage boolean Whether there is a previous page
sort {sortBy: string, sortOrder: string}[] Sort method

ILedgerItem

Name Type Description
id number Ledger item ID
voucherDate number Voucher date, timestamp, seconds
no string Account number
accountingTitle string Accounting title
voucherNumber string Voucher number
particulars string Details
debitAmount number Debit amount
creditAmount number Credit amount
balance number Balance
createdAt number Creation timestamp, seconds
updatedAt number Last update timestamp, seconds

ILedgerTotal

Name Type Description
totalDebitAmount number Total debit amount
totalCreditAmount number Total credit amount
createdAt number Creation timestamp, seconds
updatedAt number Last update timestamp, seconds

Response Example

  • Successful response
{
    "powerby": "iSunFA v0.8.5+144",
    "success": true,
    "code": "200ISF0001",
    "message": "List successfully",
    "payload": {
        "currencyAlias": "TWD",
        "items": {
            "data": [
                {
                    "id": 10000372,
                    "accountId": 1601,
                    "voucherId": 10000111,
                    "voucherDate": 1728489600,
                    "no": "1101",
                    "accountingTitle": "庫存現金",
                    "voucherNumber": "20241025001",
                    "voucherType": "expense",
                    "particulars": "",
                    "debitAmount": 0,
                    "creditAmount": 300,
                    "balance": -300,
                    "createdAt": 1729823017,
                    "updatedAt": 1729823017
                },
                {
                    "id": 10000374,
                    "accountId": 1602,
                    "voucherId": 10000112,
                    "voucherDate": 1729785600,
                    "no": "1102",
                    "accountingTitle": "零用金/週轉金",
                    "voucherNumber": "20241025002",
                    "voucherType": "expense",
                    "particulars": "",
                    "debitAmount": 0,
                    "creditAmount": 50,
                    "balance": -350,
                    "createdAt": 1729847360,
                    "updatedAt": 1729847360
                },
                {
                    "id": 10000373,
                    "accountId": 1345,
                    "voucherId": 10000111,
                    "voucherDate": 1728489600,
                    "no": "6112",
                    "accountingTitle": "推銷費用 - 文具用品",
                    "voucherNumber": "20241025001",
                    "voucherType": "expense",
                    "particulars": "",
                    "debitAmount": 300,
                    "creditAmount": 0,
                    "balance": -50,
                    "createdAt": 1729823017,
                    "updatedAt": 1729823017
                },
                {
                    "id": 10000375,
                    "accountId": 1347,
                    "voucherId": 10000112,
                    "voucherDate": 1729785600,
                    "no": "6114",
                    "accountingTitle": "推銷費用 - 運費",
                    "voucherNumber": "20241025002",
                    "voucherType": "expense",
                    "particulars": "",
                    "debitAmount": 50,
                    "creditAmount": 0,
                    "balance": 0,
                    "createdAt": 1729847360,
                    "updatedAt": 1729847360
                }
            ],
            "page": 1,
            "totalPages": 1,
            "totalCount": 4,
            "pageSize": 10,
            "hasNextPage": false,
            "hasPreviousPage": false,
            "sort": [
                {
                    "sortBy": "voucherDate",
                    "sortOrder": "asc"
                }
            ]
        },
        "total": {
            "totalDebitAmount": 350,
            "totalCreditAmount": 350,
            "createdAt": 0,
            "updatedAt": 0
        }
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code": "405ISF0000",
    "message": "Method not allowed",
    "payload": null
}

listAssets

  • description: List all assets

Request

Request url

GET /company/:companyId/asset

Parameters

name type description required default
companyId string Company ID yes --

Query

name type description required default
page number Page number no 1
pageSize number Items per page no 10
type string Asset type no --
status string Asset status no --
startDate number Start of time range (timestamp, seconds) no --
endDate number End of time range (timestamp, seconds) no --
searchQuery string Search keyword no --
sortOption string Sort options sortBy:sortOrder multiple conditions separated by - no AcquisitionDate:desc

Sort Fields

Available fields for sorting:

  • AcquisitionDate - Acquisition date
  • PurchasePrice - Purchase price
  • AccumulatedDepreciation - Accumulated depreciation
  • ResidualValue - Residual value
  • RemainingLife - Remaining useful life (timestamp, seconds)

Sort Order

  • asc - ascending
  • desc - descending

Request Example

GET /company/1/asset?page=2&sortOption=PurchasePrice:desc-ResidualValue:desc&startDate=1704067200&endDate=1704067200&type=1691&searchQuery=000001&page=1

Response

Response Parameters

name type description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload IPaginatedData<IAssetItem[]> Data containing asset list

IPaginatedData

name type description
data Asset[] Asset list
page number Current page number
totalPages number Total number of pages
totalCount number Total number of items
pageSize number Items per page
hasNextPage boolean Whether there is a next page
hasPreviousPage boolean Whether there is a previous page
sort {sortBy: string, sortOrder: string}[] Sort method

IAssetItem

name type description
id number Asset ID
currencyAlias string Currency
acquisitionDate number Acquisition date (timestamp, seconds)
assetType string Accounting subject
assetNumber string Asset number
assetName string Asset name
purchasePrice number Purchase price
accumulatedDepreciation number Accumulated depreciation
residualValue number Residual value
remainingLife number Remaining useful life (timestamp, seconds)
assetStatus string Asset status
createdAt number Creation time (timestamp, seconds)
updatedAt number Update time (timestamp, seconds)
deletedAt number Deletion time (timestamp, seconds)

Response Example

  • Successful response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code": "200ISF0000",
    "message": "Success",
    "payload": {
        "data": [
            {
                "id": 1,
                "currencyAlias": "TWD",
                "acquisitionDate": 1632511200,
                "assetType": "123 Machinery",
                "assetNumber": "A-000010",
                "assetName": "MackBook",
                "purchasePrice": 100000,
                "accumulatedDepreciation": 5000,
                "residualValue": 5000,
                "remainingLife": 61580800,
                "assetStatus": "normal",
                "createdAt": 1632511200,
                "updatedAt": 1632511200,
                "deletedAt": null
            },
            // ... 
        ],
        "page": 1,
        "totalPages": 10,
        "totalCount": 100,
        "pageSize": 10,
        "hasNextPage": true,
        "hasPreviousPage": false,
        "sort": [
            {
                "sortBy": "acquisitionDate",
                "sortOrder": "desc"
            }
        ]
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

getAssetById

  • description: Get details of a single asset

Request

Request url

GET /company/:companyId/asset/:assetId

Parameters

name type description required default
companyId string Company ID yes --
assetId string Asset ID yes --

Request Example

GET /company/1/asset/1

Response

Response Parameters

name type description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload Asset Asset details data

IAssetDetails

name type description
id number Asset ID
acquisitionDate number Acquisition date (timestamp, seconds)
assetType string Accounting subject
assetNumber string Asset number
assetName string Asset name
purchasePrice number Purchase price
accumulatedDepreciation number Accumulated depreciation
residualValue number Residual value
remainingLife number Remaining useful life (timestamp, seconds)
assetStatus string Asset status
currencyAlias string Currency
depreciationStart number Depreciation start time, timestamp in seconds
depreciationMethod string Depreciation method
usefulLife number Useful life (timestamp, seconds)
relatedVouchers IRelatedVoucher[] Related vouchers
note string Remarks
createdAt number Creation time (timestamp, seconds)
updatedAt number Update time (timestamp, seconds)
deletedAt number Deletion time (timestamp, seconds)

IRelatedVoucher

name type description
id number Voucher ID
number string Voucher number

Response Example

  • Successful response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code": "200ISF0000",
    "message": "Successfully retrieved asset details",
    "payload": {
        "id": 1,
        "acquisitionDate": 1234567890,
        "assetType": "Equipment",
        "assetNumber": "EQ-001",
        "assetName": "Office Computer",
        "purchasePrice": 50000,
        "accumulatedDepreciation": 10000,
        "residualValue": 40000,
        "remainingLife": 1560000,
        "assetStatus": "normal",
        "currencyAlias": "TWD",
        "depreciationStart": 1234567890,
        "depreciationMethod": "straight-line",
        "usefulLife": 6000000,
        "relatedVouchers": [
            {"id": 101, "number": "V-2023-001"},
            {"id": 102, "number": "V-2023-002"}
        ],
        "note": "Main office computer",
        "createdAt": 1234567000,
        "updatedAt": 1234568000,
        "deletedAt": null
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

createAsset

  • description: Create a new asset

Request

Request url

POST /company/:companyId/asset

Parameters

name type description required default
companyId string Company ID yes --

Body

name type description required
assetName string Name yes
assetType string Accounting subject yes
assetNumber string Property number yes
acquisitionDate string Acquisition time, timestamp in seconds yes
purchasePrice number Purchase price yes
residualValue number Residual value yes
amount number Amount yes
depreciationStart string Depreciation start time, timestamp in seconds no
depreciationMethod string Depreciation method no
usefulLife number Useful life (timestamp, seconds) no
note string Remarks no

Request Example

POST /company/1/asset

const body = {
    "assetName": "New Office Laptop",
    "assetType": "1602",
    "assetNumber": "NEW office eq", 
    "acquisitionDate": 1234567890,
    "purchasePrice": 30000,
    "residualValue": 30000,
    "amount": 1,
    "depreciationStart": 1234567890,
    "depreciationMethod": "straight_line",
    "usefulLife": 36000,
    "note": "Laptop for new employee"
}

Response

Response Parameters

name type description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload Asset Newly created asset data

Payload

name type description
id number Asset ID
name string Asset Name
number string Asset Number
companyId number Company ID
status string Asset Status
createdAt number Creation Time (timestamp, seconds)
updatedAt number Update Time (timestamp, seconds)
note string Remarks

Response Example

  • Successful response
{
    "powerby": "iSunFA v0.8.5+157",
    "success": true,
    "code": "201ISF0000",
    "message": "Created successfully",
    "payload": {
        "id": 10122865,
        "name": "New Office Laptop",
        "number": "NEW office eq-5e392086-fb33-409e-a2d9-39e0be9b9014-000001",
        "companyId": 10000003,
        "status": "normal",
        "createdAt": 1733471154,
        "updatedAt": 1733471154,
        "note": "Laptop for new employee"
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405ISF0000",
    "message": "Method not allowed",
    "payload": null
}

updateAsset

  • description: Update asset information

Request

Request url

PUT /company/:companyId/asset/:assetId

Parameters

name type description required default
companyId string Company ID yes --
assetId string Asset ID yes --

Body

name type description required
assetName string Asset name no
assetStatus string Asset status no
acquisitionDate number Acquisition time, timestamp in seconds no
purchasePrice number Purchase price no
depreciationStart number Depreciation start time, timestamp in seconds no
depreciationMethod string Depreciation method no
usefulLife number Useful life (seconds) no
residualValue number Residual value no
note string Note no
updateDate number Update time for asset status, timestamp in seconds no

Request Example

PUT /company/1/asset/2

const body = {
    "assetName": "new asset name~",
    "acquisitionDate": 1733889697,
    "assetStatus": "normal",
    "purchasePrice": 30000,
    "depreciationStart": 1733889697,
    "depreciationMethod": "straight_line",
    "usefulLife": 2592000,
    "residualValue": 30000,
    "note": "new note by updating asset API",
    "updateDate": 1733889697
}

Response

Response Parameters

name type description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload Asset Updated asset data

IAssetDetails

name type description
id number Asset ID
acquisitionDate number Acquisition date (timestamp, seconds)
assetType string Accounting subject
assetNumber string Asset number
assetName string Asset name
purchasePrice number Purchase price
accumulatedDepreciation number Accumulated depreciation
residualValue number Residual value
remainingLife number Remaining useful life (timestamp, seconds)
assetStatus string Asset status
currencyAlias string Currency
depreciationStart number Depreciation start time, timestamp in seconds
depreciationMethod string Depreciation method
usefulLife number Useful life (timestamp, seconds)
relatedVouchers IRelatedVoucher[] Related vouchers
note string Remarks
createdAt number Creation time (timestamp, seconds)
updatedAt number Update time (timestamp, seconds)
deletedAt number Deletion time (timestamp, seconds)

IRelatedVoucher

name type description
id number Voucher ID
number string Voucher number

Response Example

  • Successful response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code": "200ISF0000",
    "message": "Asset updated successfully",
    "payload": {
        "id": 2,
        "acquisitionDate": 1234567890,
        "assetType": "Equipment",
        "assetNumber": "EQ-001",
        "assetName": "Office Computer",
        "purchasePrice": 50000,
        "accumulatedDepreciation": 10000,
        "residualValue": 40000,
        "remainingLife": 1560000,
        "assetStatus": "missing",
        "currencyAlias": "TWD",
        "depreciationStart": 1234567890,
        "depreciationMethod": "straight-line",
        "usefulLife": 6000000,
        "relatedVouchers": [
            {"id": 101, "number": "V-2023-001"},
            {"id": 102, "number": "V-2023-002"}
        ],
        "createdAt": 1234567000,
        "updatedAt": 2234568000,
        "deletedAt": null,
        "note": "Updated: Laptop for marketing team",
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

deleteAsset

  • description: Soft delete an asset

Request

Request url

DELETE /company/:companyId/asset/:assetId

Parameters

name type description required default
companyId string Company ID yes --
assetId string Asset ID yes --

Request Example

DELETE /company/1/asset/2

Response

Response Parameters

name type description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload Asset Asset details data

IAssetDetails

name type description
id number Asset ID
acquisitionDate number Acquisition date (timestamp, seconds)
assetType string Accounting subject
assetNumber string Asset number
assetName string Asset name
purchasePrice number Purchase price
accumulatedDepreciation number Accumulated depreciation
residualValue number Residual value
remainingLife number Remaining useful life (timestamp, seconds)
assetStatus string Asset status
currencyAlias string Currency
depreciationStart number Depreciation start time, timestamp in seconds
depreciationMethod string Depreciation method
usefulLife number Useful life (timestamp, seconds)
relatedVouchers IRelatedVoucher[] Related vouchers
note string Remarks
createdAt number Creation time (timestamp, seconds)
updatedAt number Update time (timestamp, seconds)
deletedAt number Deletion time (timestamp, seconds)

IRelatedVoucher

name type description
id number Voucher ID
number string Voucher number

Response Example

  • Successful response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code": "200ISF0000",
    "message": "Asset deleted successfully",
    "payload": {
        "id": 1,
        "acquisitionDate": 1234567890,
        "assetType": "Equipment",
        "assetNumber": "EQ-001",
        "assetName": "Office Computer",
        "purchasePrice": 50000,
        "accumulatedDepreciation": 10000,
        "residualValue": 40000,
        "remainingLife": 1560000,
        "assetStatus": "normal",
        "currencyAlias": "TWD",
        "depreciationStart": 1234567890,
        "depreciationMethod": "straight-line",
        "usefulLife": 6000000,
        "relatedVouchers": [
            {"id": 101, "number": "V-2023-001"},
            {"id": 102, "number": "V-2023-002"}
        ],
        "note": "Main office computer",
        "createdAt": 1234567000,
        "updatedAt": 1234568000,
        "deletedAt": null
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405",
    "message": "Method not allowed",
    "payload": {}
}

GET ALL Voucher

  • Description: Get all voucher

Request

Request url

GET /company/voucher

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Query

name type description required Default
strategy "upcoming" | "uploaded" | "payment" | "receiving" implement different types of voucher to get ("ledger" is not in here) true -
canBeEdit boolean | undefined get voucher that can be edit or not, get all if undefined no undefined
page number The page number no 1
pageSize number how many items in one page no 10
type string (payment | transfer | receiving) | undefined get what "type" of voucher it is, get all if undefined no undefined
sortBy string | undefined which column to sort by (ex: "voucherDate", "period", "credit", "debit"), will use sum of line items when sort by "credit" or "debit" no undefined
sortOrder string ("asc"/"desc") The order to sort by no undefined
startDate integer(timestamp in second) item include and after startDate, default is 0 no
endDate integer(timestamp in second) item include and before startDate, default is infinity no
searchQuery string this field is to search name no

Resonse

Response Parameter

To be continue

Response Example

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": {
     "page": 1, // current page
     "totalUnRead": 99,
     "totalPages": 3,
     "totalCount": 30,
     "pageSize": 10,
     "hasNextPage": true,
     "hasPreviousPage": true,
     "sort": [
      {
       "sortBy": "createAt",
       "sortOrder": "desc"
      }
     ],
     "data": [
{
  "id": 1001,
  "eventId": null,
  "status": "uploaded", // "uploaded" or "upcoming"
  "canBeEdit": true, // true or false
  "voucherNo": "240417-001",
  "voucherDate": 1000000,
  "type": "payment", // or transfer or receiving
  "note": "This is a note",
  "createAt": 1000000,
  "updateAt": 1000000,
  "deletedAt": null, // if have Number then it is deleted
  "reverseAt": 1727317, // if have Number then it is reversed
  "certificates": [
    {
      "id": 1,
      "inputOrOutput": "input",
      "certificateDate": 10000001,
      "certificateNo": "AB-12345678",
      "currencyAlias": "TWD",
      "priceBeforeTax": 4000,
      "taxRatio": 5,
      "taxPrice": 200,
      "totalPrice": 4200,
      "counterPartyId": 1,
      "invoiceType": "triplicate_uniform_invoice",
      "deductible": true,
      "connectToId": null,
      "name": "invoice001.jpg",
      "url": "/api/v2/certificate/1",
      "type": "invoice",
      "connectToType": "voucher",
      "mimeTYpe": "image/jpeg",
      "size": "3.0 MB",
      "uploadProgress": 50,
      "aiResultId": "douhvjax_-1",
      "aiStatus": "success",
      "createAt": 10000000,
      "updateAt": 10000000
    }
  ],
  "reverseVoucherIds": [
    // 或是完整的voucher?
    {
      "id": 1111,
      "voucherNo": "240817-001"
    },
    {
      "id": 1112,
      "voucherNo": "240817-002"
    }
  ],
  "issuer": {
    // IUser
    "id": 1001,
    "name": "Murky",
    "fullName": "Tiny Murky",
    "email": "[email protected]",
    "phone": "1234567890",
    "imageId": "/api/v2/image/1001.jpg",
    "agreementList": ["agreement1", "agreement2"],
    "createdAt": 1000000,
    "updatedAt": 1000000
  },
  "counterParty": {
    // ICounterparty
    "id": 1001,
    "companyId": 1001,
    "name": "Cool LLC",
    "taxId": "12345678",
    "type": "customer",
    "note": "This is a note",
    "createdAt": 1000000,
    "updatedAt": 1000000
  },
  "payableInfo": {
    // payableInfo 如果存在,那麼receivingInfo就會都是0
    "total": 1000,
    "alreadyHappened": 400,
    "remain": 600
  },
  "receivingInfo": {
    "total": 1000,
    "alreadyHappened": 400,
    "remain": 600
  },
  "recurringInfo": {
    "type": "month", // or year or week or atOnce
    "startDate": 1000000,
    "endDate": 1000100,
    "daysOfWeek": [0, 1, 2], // 這邊是示範,如果type是week, 這個array才有東西, 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday
    "daysOfMonth": [1, 15, 30], // 這邊是示範,如果type是month, 這個array才有東西
    "daysOfYears": [
      {
        "month": 1,
        "day": 1
      },
      {
        "month": 12,
        "day": 25
      }
    ] // 這邊是示範,如果type是year, 這個array才有東西
  },
  "assets": [
    // IAssetItem
    {
      "id": 1,
      "acquisitionDate": 1632511200,
      "assetType": "123 Machinery",
      "assetNumber": "A000010",
      "assetName": "MackBook",
      "purchasePrice": 100000,
      "accumulatedDepreciation": 5000,
      "residualValue": 5000,
      "remainingTimestamp": 1761580800,
      "assetStatus": "normal" //AssetStatus.NORMAL,
    }
  ],
  "lineItemsInfo": {
    "sum": {
      "debit": true,
      "amount": 1000
    },
    "lineItems": [
      {
        "id": 1001,
        "amount": 1000,
        "description": "This is a description",
        "debit": true,
        "account": {
          "id": 1001,
          "companyId": 1001,
          "system": "IFRS",
          "type": "Asset",
          "debit": true,
          "liquidity": true,
          "code": "1001",
          "name": "Cash",
          "forUser": true,
          "parentCode": "1000",
          "rootCode": "1000",
          "createdAt": 1000000,
          "updatedAt": 1000000,
          "level": 1,
          "deletedAt": null
        },
        "voucherId": 1001,
        "createdAt": 1000000,
        "updatedAt": 1000000,
        "deletedAt": null
      },
      {
        "id": 1002,
        "amount": 1001,
        "description": "This is a description",
        "debit": false,
        "account": {
          "id": 1002,
          "companyId": 1001,
          "system": "IFRS",
          "type": "Asset",
          "debit": true,
          "liquidity": true,
          "code": "1002",
          "name": "Accounts Receivable",
          "forUser": true,
          "parentCode": "1000",
          "rootCode": "1000",
          "createdAt": 1000000,
          "updatedAt": 1000000,
          "level": 1,
          "deletedAt": null
        },
        "voucherId": 1001,
        "createdAt": 1000000,
        "updatedAt": 1000000,
        "deletedAt": null
      }
    ]
  }
}
     ],

    }
}

GET One Voucher

Request

Request usrl

GET /company/voucher/[voucherId]

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Parameter

name type description required
voucherId number The id of certain voucher Yes

Resonse

Response Parameter

To be continue

Response Example

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": {
  "id": 1001,
  "eventId": null, // will be null if not recurring, integer if recurring
  "hasReaded": true, 
  "status": "uploaded", // "uploaded" or "upcoming"
  "canBeEdit": true, // true or false
  "voucherNo": "240417-001",
  "voucherDate": 1000000,
  "type": "payment", // or transfer or receiving
  "note": "This is a note",
  "createAt": 1000000,
  "updateAt": 1000000,
  "deletedAt": null, // if have Number then it is deleted
  "reverseAt": 1727317, // if have Number then it is reversed
  "certificates": [
    {
      "id": 1,
      "inputOrOutput": "input",
      "certificateDate": 10000001,
      "certificateNo": "AB-12345678",
      "currencyAlias": "TWD",
      "priceBeforeTax": 4000,
      "taxRatio": 5,
      "taxPrice": 200,
      "totalPrice": 4200,
      "counterPartyId": 1,
      "invoiceType": "triplicate_uniform_invoice",
      "deductible": true,
      "connectToId": null,
      "name": "invoice001.jpg",
      "url": "/api/v2/certificate/1",
      "type": "invoice",
      "connectToType": "voucher",
      "mimeTYpe": "image/jpeg",
      "size": "3.0 MB",
      "uploadProgress": 50,
      "aiResultId": "douhvjax_-1",
      "aiStatus": "success",
      "createAt": 10000000,
      "updateAt": 10000000
    }
  ],
  "reverseVoucherIds": [
    // 或是完整的voucher?
    {
      "id": 1111,
      "voucherNo": "240817-001"
    },
    {
      "id": 1112,
      "voucherNo": "240817-002"
    }
  ],
  "issuer": {
    // IUser
    "id": 1001,
    "name": "Murky",
    "fullName": "Tiny Murky",
    "email": "[email protected]",
    "phone": "1234567890",
    "imageId": "/api/v2/image/1001.jpg",
    "agreementList": ["agreement1", "agreement2"],
    "createdAt": 1000000,
    "updatedAt": 1000000
  },
  "counterParty": {
    // ICounterparty
    "id": 1001,
    "companyId": 1001,
    "name": "Cool LLC",
    "taxId": "12345678",
    "type": "customer",
    "note": "This is a note",
    "createdAt": 1000000,
    "updatedAt": 1000000
  },
  "payableInfo": {
    // payableInfo 如果存在,那麼receivingInfo就會都是0
    "total": 1000,
    "alreadyHappened": 400,
    "remain": 600
  },
  "receivingInfo": {
    "total": 1000,
    "alreadyHappened": 400,
    "remain": 600
  },
  "recurringInfo": {
    "type": "month", // or year or week or atOnce
    "startDate": 1000000,
    "endDate": 1000100,
    "daysOfWeek": [0, 1, 2], // 這邊是示範,如果type是week, 這個array才有東西, 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday
    "daysOfMonth": [1, 15, 30], // 這邊是示範,如果type是month, 這個array才有東西
    "daysOfYears": [
      {
        "month": 1,
        "day": 1
      },
      {
        "month": 12,
        "day": 25
      }
    ] // 這邊是示範,如果type是year, 這個array才有東西
  },
  "assets": [
    // IAssetItem
    {
      "id": 1,
      "acquisitionDate": 1632511200,
      "assetType": "123 Machinery",
      "assetNumber": "A000010",
      "assetName": "MackBook",
      "purchasePrice": 100000,
      "accumulatedDepreciation": 5000,
      "residualValue": 5000,
      "remainingTimestamp": 1761580800,
      "assetStatus": "normal" //AssetStatus.NORMAL,
    }
  ],
  "lineItemsInfo": {
    "sum": {
      "debit": true,
      "amount": 1000
    },
    "lineItems": [
      {
        "id": 1001,
        "amount": 1000,
        "description": "This is a description",
        "debit": true,
        "account": {
          "id": 1001,
          "companyId": 1001,
          "system": "IFRS",
          "type": "Asset",
          "debit": true,
          "liquidity": true,
          "code": "1001",
          "name": "Cash",
          "forUser": true,
          "parentCode": "1000",
          "rootCode": "1000",
          "createdAt": 1000000,
          "updatedAt": 1000000,
          "level": 1,
          "deletedAt": null
        },
        "voucherId": 1001,
        "createdAt": 1000000,
        "updatedAt": 1000000,
        "deletedAt": null
      },
      {
        "id": 1002,
        "amount": 1001,
        "description": "This is a description",
        "debit": false,
        "account": {
          "id": 1002,
          "companyId": 1001,
          "system": "IFRS",
          "type": "Asset",
          "debit": true,
          "liquidity": true,
          "code": "1002",
          "name": "Accounts Receivable",
          "forUser": true,
          "parentCode": "1000",
          "rootCode": "1000",
          "createdAt": 1000000,
          "updatedAt": 1000000,
          "level": 1,
          "deletedAt": null
        },
        "voucherId": 1001,
        "createdAt": 1000000,
        "updatedAt": 1000000,
        "deletedAt": null
      }
    ]
  }
}
}

POST check already Read voucher

  • Description: when enter list voucher, all voucher on that page will be consider readed

Request

Request usrl

POST /company/voucher/readed

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Body

name type description
voucherIds Integer[] the vouchers that want to be updated to read:true
{
  "voucherIds": [
   1,
   2,
   3
  ]
}

Response

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": "Success",
}

Post Voucher

  • Description:Post one voucher, if posting "recurring" event, it will create all the voucher in upcoming

Request url

POST /company/voucher

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Body

name type description default required
actions VoucherV2Action[] 需要執行哪些特殊動作,是一個array, 裡面放VoucherV2Action, 有 ADD_ASSET, REVERT, RECURRING - (沒有特殊動作請放空的array) true
certificateIds integer[] certificate connect to this voucher [] (empty array) true(but can be empty array)
voucherDate integer voucher occur day in second - true
type "payment" | "receiving" | "transfer" voucher type - true
note string note on voucher, can be empty string - true
counterPartyId integer id of counterPartyId, id should come from ICounterparty, 只有在要用 revert功能的時候提供 - false
lineItems lineItem[] lineItems of voucher, need to make sure tax is same as certificate and credit debit is equal - true, empty array is not allowed
recurringInfo recurringInfo | undefined if is recurring entry, then add this object, if not please use undefined undefined false
assetIds integer[] asset to be connect to, empty array if not to connect - true
reverseVouchers reverseVoucher [] empty array if not used -

lineItems

name type description default required
accoutId integer id of account - true
description string custom description for user to input - true(can be empty string)
debit boolean is it credit or debit - true
amount number how much is this - true

recurringInfo

name type description default required
type EventEntityFrequency.MONTHLY, EventEntityFrequency.YEARLY which type of frequency to be repeat - true
startDate number start date in second - true
endDate number end date in second - true
daysOfWeek integer[] date of week to be repeat, if not repeat by week, use empty array, 0 be sunday - true
monthsOfYear integer[] day of month to be repeat, if not repeat by month, use empty array, 這邊提供數字, 0代表一月, 11代表12月 - true

reversedVoucher

name type description default required
voucherId integer which voucher to be reversed - true
amount number how much is for amount - true
const body = {
        actions: [VoucherV2Action.ADD_ASSET],
        certificateIds: [1001, 1002],
        voucherDate: 10000000,
        type: EventType.PAYMENT,
        note: 'this is note',
        counterPartyId: 1001,
        lineItems: [
          { accountId: 1001, description: 'this is for Particulars', debit: true, amount: 1000 },
          { accountId: 1002, description: 'this is for Particulars', debit: false, amount: 1000 },
        ],
        recurringEntry: {
          type: 'month',
          startDate: 1000000,
          endDate: 1000100,
          daysOfWeek: [0, 1, 2],
          daysOfMonth: [1, 15, 30],
          daysOfYears: [
            {
              month: 1,
              day: 1,
            },
            {
              month: 12,
              day: 25,
            },
          ],
        },
        assetIds: [1001],
        reverseVouchers: [
          {
            voucherId: 1003,
            amount: 500,
            lineItemIdBeReversed: 1001,
            lineItemIdReverseOther: 1002,
          },
        ],
      };

Response

Response Example

it will response id of voucher that created

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": 1003,
}

Put Voucher

  • Description: Put voucher
  • If recurring event is edit, all upcoming event should be edit

Request url

PUT /company/voucher/[voucherId]

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Parameter

name type description required
voucherId number The id of certain voucher Yes

Body

It is same as post voucher

Response Example

it will response id of voucher that put

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": 1003,
}

Delete Voucher

  • Description: this will create an reverse

Request

Request usrl

DELETE /company/voucher/[voucherId]

Session

Session data will be get from session, so not needed to be provided.

name type description
companyId number id of company
userId number id of user

Parameter

name type description required
voucherId number The id of certain voucher to be delete Yes

Response

Response Example

it will response id of voucher that is created in reverse

{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code":  "200",
    "message": "Success",
    "payload": 1003,
}

getUser

  • description: This API provides the functionality to get an user.

Request

Request url

GET `/user/:userId`

Query

name type description required default
userId string specific user number yes -

Request Example

GET `/user/1`

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload User or null response data or null

User

name type description
id number unique number of user
name string user name
fullName string user full name
email string user email
phone string user phone
imageId string user image id
agreementList string[] list of agreement hash
createdAt number creation timestamp
updatedAt number update timestamp

Response Example

  • 成功的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
      "success": true,
      "code":  "200",
      "message": "Get User sucessfully",
      "payload": 
        {
          "id": 1,
          "name": "John",
          "fullName": "John Doe",
          "email": "[email protected]",
          "phone": "12345678",
          "imageId": "552c2dbf-997c-4b13-957e-ea03c45d2ec1.svg",
          "agreementList": ["agreement1", "agreement2"],
          "createdAt": 1723538422,
          "updatedAt": 1723538422
        },
    }
  • 失敗的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code": "404",
    "message": "Resource not found",
    "payload": {} 
    }

deleteUser

  • description: This API provides the functionality to delete an user.

Request

Request url

DELETE `/user/:userId`

Query

name type description required default
userId string specific user number yes -

Request Example

DELETE `/user/1`

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload user

User

name type description
id number unique number of user
name string user name
fullName string user full name
email string user email
phone string user phone
imageId string user image id
agreementList string[] list of agreement hash
createdAt number creation timestamp
updatedAt number update timestamp

Response Example

  • 成功的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
      "success": true,
      "code":  "200",
      "message": "Delete User sucessfully",
      "payload": 
        {
          "id": "1",
          "name": "John",
          "fullName": "John Doe",
          "email": "[email protected]",
          "phone": "12345678",
          "imageId": "552c2dbf-997c-4b13-957e-ea03c45d2ec1.svg",
          "agreementList": ["agreement1", "agreement2"],
          "createdAt": 1723538422,
          "updatedAt": 1723538422
        },
    }
  • 失敗的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code": "404",
    "message": "Resource not found",
    "payload": {} 
    }

updateUser

  • description: This API provides the functionality to update an user.

Request

Request url

PUT `/user/:userId`

Query

name type description required default
userId string specific user number yes -

Body

name type description
name string name of the user
fullName string full name of the user
email string email of the user
phone string phone of the user
imageId string imageId of the user

Request Example

PUT `/user/1`

const body = {
      name: 'Jane',
      email: '[email protected]',
      fullName: 'Jane Doe',
      phone: '1234567890',
      imageId: 'imageId',
    }

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload User response data

User

name type description
id number unique number of user
name string user name
fullName string user full name
email string user email
phone string user phone
imageId string user image id
agreementList string[] list of agreement hash
createdAt number creation timestamp
updatedAt number update timestamp

Response Example

  • 成功的回傳
    {
      "powerby": "iSunFA v0.1.2+50",
      "success": true,
      "code":  "200",
      "message": "Update User sucessfully",
      "payload": 
        {
          "id": 1,
          "name": "John",
          "fullName": "John Doe",
          "email": "[email protected]",
          "phone": "12345678",
          "imageId": "552c2dbf-997c-4b13-957e-ea03c45d2ec1.svg",
          "agreementList": ["agreement1", "agreement2"],
          "createdAt": 1723538422,
          "updatedAt": 1723538422
        },
    }
  • 失敗的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code": "404",
    "message": "Resource not found",
    "payload": {} 
    }

listUserTodo

  • description: This API provides the functionality to list all todo.

Request

Request url

GET /user/:userId/todo

Query

name type description required default
userId string specific user number yes -

Request Example

GET user/1/todo

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload ITodoCompany[] response data

ITodoCompany

name type description
id number unique number of todo
company Company company of the todo
name string name of the todo
deadline number deadline of the todo
note string note of the todo
status boolean status of the todo
startTime number start time of the todo, 這個會是millisecond(13位數)
endTime number end time of the todo, 這個會是millisecond(13位數)
createdAt number creation timestamp
updatedAt number update timestamp

Company

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
    {
      "powerby": "iSunFA v0.8.5+153",
      "success": true,
      "code": "200ISF0001",
      "message": "List successfully",
      "payload": [
        {
          "id": 10000000,
          "name": "Test Todo",
          "deadline": 1772617600,
          "note": "NaN",
          "status": true,
          "createdAt": 1733379398,
          "updatedAt": 1733379398,
          "startTime": 1772617600000,
          "endTime": 1772617600000,
          "company": {
            "id": 555,
            "name": "N/A",
            "taxId": "555",
            "startDate": 0,
            "createdAt": 0,
            "updatedAt": 0,
            "imageId": "N/A"
          }
        },
        {
          "id": 10000001,
          "name": "Test Todo",
          "deadline": 1772617600,
          "note": "NaN",
          "status": true,
          "createdAt": 1733379575,
          "updatedAt": 1733379575,
          "startTime": 1772617600000,
          "endTime": 1772617600000,
          "company": {
            "id": 555,
            "name": "N/A",
            "taxId": "555",
            "startDate": 0,
            "createdAt": 0,
            "updatedAt": 0,
            "imageId": "N/A"
          }
        }
      ]
    }
  • 失敗的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code": "404",
    "message": "Resource not found",
    "payload": {} 
    }

createUserTodo

  • description: This API provides the functionality to create a todo.

Request

Request url

POST `/user/:userId/todo`

Query

name type description required default
userId string specific user number yes -

Body

name type description
type string type of the todo
name string name of the todo
deadline number deadline of the todo
startTime number | undefined start time of the todo, 這個寫millisecond(13位數)或是second(10位數)都可以, 不填的話會是呼叫當下的時間
endTime number | undefined end time of the todo, 這個會是millisecond(13位數)或是second(10位數)都可以 , 不填的話會是呼叫當天的時間的最後一秒
note string note of the todo

Request Example

POST `user/:userId/todo`

const body = {
      type: 'type',
      name: 'name',
      deadline: 1000000,
      note: 'note',
    }

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload ITodoCompany response data

ITodoCompany

name type description
id number unique number of todo
company Company company of the todo
name string name of the todo
deadline number deadline of the todo
startTime number start time of the todo, 這個會是millisecond(13位數)
endTime number end time of the todo, 這個會是millisecond(13位數)
note string note of the todo
status boolean status of the todo
createdAt number creation timestamp
updatedAt number update timestamp

Company

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
   {
      powerby: 'iSunFA v0.8.5+153',
      success: true,
      code: '201ISF0000',
      message: 'Created successfully',
      payload: {
        id: 10000001,
        name: 'Test Todo',
        deadline: 1772617600,
        note: '1772617600-1772617600-',
        status: true,
        createdAt: 1733379575,
        updatedAt: 1733379575,
        startTime: 1772617600000,
        endTime: 1772617600000,
        company: {
          id: 555,
          name: 'N/A',
          taxId: '555',
          startDate: 0,
          createdAt: 0,
          updatedAt: 0,
          imageId: 'N/A'
        }
      }
    }
  • 失敗的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code": "404",
    "message": "Resource not found",
    "payload": {} 
    }

gettodobyid

  • description: This API provides the functionality to get a todo.

Request

Request url

GET `todo/:todoId`

Query

name type description required default
userId string specific user number yes -
todoId string specific todo number yes -

Request Example

GET todo/1

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload ITodoCompany response data

ITodoCompany

name type description
id number unique number of todo
company Company company of the todo
name string name of the todo
deadline number deadline of the todo
note string note of the todo
startTime number start time of the todo, 這個會是millisecond(13位數)
endTime number end time of the todo, 這個會是millisecond(13位數)
status boolean status of the todo
createdAt number creation timestamp
updatedAt number update timestamp

Company

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
    {
      "powerby": "iSunFA v0.1.2+50",
      "success": true,
      "code":  "200",
      "message": "Get Todo sucessfully",
      "payload": 
        {
          "id": 1,
          "company": {
            "id": 1,
            "imageId": "552c2dbf-997c-4b13-957e-ea03c45d2ec1.svg",
            "name": "company1",
            "taxId": "12345678",
            "startDate": 1723538422,
            "createdAt": 1723538422,
            "updatedAt": 1723538422
          },
          "name": "name",
          "deadline": 1000000,
          "note": "note",
          "status": true,
          "startTime": 1772617600000,
          "endTime": 1772617600000,
          "createdAt": 1723538422,
          "updatedAt": 1723538422
        },
    }
  • 失敗的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code": "404",
    "message": "Resource not found",
    "payload": {} 
    }

updateTodo

  • description: This API provides the functionality to update a todo.

Request

Request url

PUT /todo/:todoId

Query

name type description required default
userId string specific user number yes -
todoId string specific todo number yes -

Body

name type description
type string type of the todo
name string name of the todo
deadline number deadline of the todo
startTime number | undefined start time of the todo, 這個寫millisecond(13位數)或是second(10位數)都可以, 不填的話會是呼叫當下的時間
endTime number | undefined end time of the todo, 這個會是millisecond(13位數)或是second(10位數)都可以 , 不填的話會是呼叫當天的時間的最後一秒
note string note of the todo

Request Example

PUT /todo/1

const body = {
      type: 'type',
      name: 'name',
      deadline: 1000000,
      startTime: 100000000000,
      endTime: 100000000000,
      note: 'note',
    }

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload ITodoCompany response data

ITodoCompany

name type description
id number unique number of todo
company Company company of the todo
name string name of the todo
deadline number deadline of the todo
note string note of the todo
status boolean status of the todo
startTime number start time of the todo, 這個會是millisecond(13位數)
endTime number end time of the todo, 這個會是millisecond(13位數)
createdAt number creation timestamp
updatedAt number update timestamp

Company

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
    {
      "powerby": "iSunFA v0.1.2+50",
      "success": true,
      "code":  "200",
      "message": "Update Todo sucessfully",
      "payload": 
        {
          "id": 1,
          "company": {
            "id": 1,
            "imageId": "552c2dbf-997c-4b13-957e-ea03c45d2ec1.svg",
            "name": "company1",
            "taxId": "12345678",
            "startDate": 1723538422,
            "createdAt": 1723538422,
            "updatedAt": 1723538422
          },
          "name": "name",
          "deadline": 1000000,
          "startTime": 1772617600000,
          "endTime": 1772617600000,
          "note": "note",
          "status": true,
          "createdAt": 1723538422,
          "updatedAt": 1723538422
        },
    }
  • 失敗的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code": "404",
    "message": "Resource not found",
    "payload": {} 
    }

deleteTodo

  • description: This API provides the functionality to delete a todo.

Request

Request url

DELETE `/todo/:todoId`

Query

name type description required default
userId string specific user number yes -
todoId string specific todo number yes -

Request Example

DELETE `/todo/:todoId`

Response

Response Parameters

name type description
powerby string iSunFA v0.1.2+50
success boolean true or false
code string response code
message string description of response data
payload ITodoCompany response data

ITodoCompany

name type description
id number unique number of todo
company Company company of the todo
name string name of the todo
deadline number deadline of the todo
note string note of the todo
status boolean status of the todo
startTime number start time of the todo, 這個會是millisecond(13位數)
endTime number end time of the todo, 這個會是millisecond(13位數)
createdAt number creation timestamp
updatedAt number update timestamp

Company

name type description
id number Primary Key
imageId string ID of the associated image
name string Name of the company
taxId string Tax identification number
startDate number Start date of the company (timestamp)
createdAt number Timestamp when created
updatedAt number Timestamp when updated

Response Example

  • 成功的回傳
    {
      "powerby": "iSunFA v0.1.2+50",
      "success": true,
      "code":  "200",
      "message": "Delete Todo sucessfully",
      "payload": 
        {
          "id": 1,
          "company": {
            "id": 1,
            "imageId": "552c2dbf-997c-4b13-957e-ea03c45d2ec1.svg",
            "name": "company1",
            "taxId": "12345678",
            "startDate": 1723538422,
            "createdAt": 1723538422,
            "updatedAt": 1723538422
          },
          "name": "name",
          "deadline": 1000000,
          "startTime": 1772617600000,
          "endTime": 1772617600000,
          "note": "note",
          "status": true,
          "createdAt": 1723538422,
          "updatedAt": 1723538422
        },
    }
  • 失敗的回傳

    {
      "powerby": "iSunFA v0.1.2+50",
    "success": false,
    "code": "404",
    "message": "Resource not found",
    "payload": {} 
    }

getSuggestedAssetNumber

  • description: Get suggested asset number for reference

Request

Request url

GET /company/:companyId/asset/suggested_number

Parameters

name type description required default
companyId string Company ID yes --

Query

name type description required default
assetType string Asset type yes --

Request Example

GET /company/1/asset/suggested_number?assetType=equipment

Response

Response Parameters

name type description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload object Suggested asset number data

Payload

name type description
assetNumber string Suggested asset number

Response Example

  • Successful response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": true,
    "code": "200ISF0000",
    "message": "Successfully retrieved suggested asset number",
    "payload": {
        "assetNumber": "EQ-000123"
    }
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code": "405",
    "message": "Method not allowed",
    "payload": {}
}

exportAsset

  • description: Export asset list data

Request

Request url

POST /company/:companyId/asset/export

Parameters

name type description required default
companyId string Company ID yes --

Body

name type description required default
fileType string File type (csv) yes --
filters object Filter conditions no --
sort Sort[] Sort options no --
options object Export options no --

filters Object

Asset Filters

name type description required default
type string Asset type no --
status string Asset status no --
startDate number Start of time range based on acquisition date (timestamp, seconds) no --
endDate number End of time range based on acquisition date (timestamp, seconds) no --
searchQuery string Search keyword no --

options Object

Asset Options

name type description required default
language string Export file language (zh-TW, en-US) no zh-TW
timezone string Timezone offset (e.g., +0800, -0530) no +0800
fields string[] Specified export fields no all fields

Asset Fields

field description
name Asset name
type Asset type
status Asset status
assetNumber Asset number
acquisitionDate Acquisition date
purchasePrice Purchase price
accumulatedDepreciation Accumulated depreciation
residualValue Residual value
remainingLife Remaining useful life (timestamp, seconds)

Sort Object

name type description required default
by string Sort field yes --
order "asc" | "desc" Sort direction yes --

Assets Sort Fields

field description
acquisitionDate Acquisition date
purchasePrice Purchase price
accumulatedDepreciation Accumulated depreciation
residualValue Residual value
remainingLife Remaining useful life (timestamp, seconds)

Request Example

POST /company/1/asset/export

const body = {
    "fileType": "csv",
    "filters": {
        "startDate": 1672531200,
        "endDate": 1704067199,
        "type": "equipment",
        "status": "normal",
        "searchQuery": "computer"
    },
    "sort": [
        {
            "by": "acquisitionDate",
            "order": "desc"
        },
        {
            "by": "purchasePrice", 
            "order": "asc"
        }
    ],
    "options": {
        "language": "zh-TW",
        "timezone": "+0800",
        "fields": ["name", "purchasePrice", "acquisitionDate"]
    }
}

Response

Success Response

return file

Response Headers

Content-Type: text/csv
Content-Disposition: attachment; filename=assets_20240101123456.csv

Response Body Example

資產名稱,購買價格,取得日期
MacBook Pro,45000,2023/12/01
辦公桌,12000,2023/11/15
印表機,35000,2023/10/30

Error Response

{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code": "405",
    "message": "Method not allowed",
    "payload": null
}

exportTrialBalance

  • description: Export trial balance list data

Request

Request url

POST /company/:companyId/trial_balance/export

Parameters

name type description required default
companyId string Company ID yes --

Body

name type description required default
fileType string File type (csv) yes --
filters object Filter conditions yes --
sort Sort[] Sort options no --
options object Export options no --

filters Object

name type description required default
startDate number Start of time range based on acquisition date (timestamp, seconds) yes --
endDate number End of time range based on acquisition date (timestamp, seconds) yes --

options Object

name type description required default
language string Export file language (zh-TW, en-US) no zh-TW
timezone string Timezone offset (e.g., +0800, -0530) no +0800
fields string[] Specified export fields no all fields

Fields

field description
accountingTitle account name
beginningCreditAmount beginning credit amount
beginningDebitAmount beginning debit amount
midtermCreditAmount midterm credit amount
midtermDebitAmount midterm debit amount
endingCreditAmount ending credit amount
endingDebitAmount ending debit amount

Sort Object

name type description required default
by string Sort field yes --
order "asc" | "desc" Sort direction yes --

Sort Fields

field description
beginningCreditAmount beginning credit amount
beginningDebitAmount beginning debit amount
midtermCreditAmount midterm credit amount
midtermDebitAmount midterm debit amount
endingCreditAmount ending credit amount
endingDebitAmount ending debit amount

Request Example

POST /company/1002/trial_balance/export

const body = {
    "fileType": "csv",
    "filters": {
        "startDate": 1672531200,
        "endDate": 1704067199
    },
    "sort": [
        {
            "by": "beginningCreditAmount",
            "order": "desc"
        },
    ],
    "options": {
        "language": "zh-TW",
        "timezone": "+0800",
        "fields": ["accountingTitle", "beginningCreditAmount", "beginningDebitAmount"]
    }
}

Response

Success Response

return file

Response Headers

Content-Type: text/csv
Content-Disposition: attachment; filename=trial_balance_20240101123456.csv

Response Body Example

會計科目,期初貸方餘額,期初借方餘額
庫存現金,0,300
零用金/週轉金,0,50
推銷費用 - 文具用品,0,300
推銷費用 - 運費,0,50

Error Response

{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code": "405",
    "message": "Method not allowed",
    "payload": null
}

createAssetBulk

  • description: Create multiple assets

Request

Request url

POST /company/:companyId/asset/bulk

Parameters

name type description required default
companyId string Company ID yes --

Body

name type description required
assetName string Name yes
assetType string Accounting subject yes
assetNumber string Property number yes
acquisitionDate string Acquisition time, timestamp in seconds yes
purchasePrice number Purchase price yes
residualValue number Residual value yes
amount number Amount yes
depreciationStart string Depreciation start time, timestamp in seconds no
depreciationMethod string Depreciation method no
usefulLife number Useful life (timestamp, seconds) no
note string Remarks no

Request Example

POST /company/1002/asset/bulk

const body = {
    "assetName": "New Office Laptop",
    "assetType": "1602",
    "assetNumber": "EQ-20241006", 
    "acquisitionDate": 1234567890,
    "purchasePrice": 30000,
    "residualValue": 30000,
    "amount": 2,
    "depreciationStart": 1234567890,
    "depreciationMethod": "straight_line",
    "usefulLife": 36000,
    "note": "Laptop for new employee"
}

Response

Response Parameters

name type description
powerby string API version
success boolean Success status
code string Response code
message string Response message
payload Asset Newly created asset data

Payload

name type description
id number Asset ID
name string Asset Name
number string Asset Number
companyId number Company ID
status string Asset Status
createdAt number Creation Time (timestamp, seconds)
updatedAt number Update Time (timestamp, seconds)
note string Remarks

Response Example

  • Successful response
{
    "powerby": "iSunFA v0.8.5+157",
    "success": true,
    "code": "201ISF0000",
    "message": "Created successfully",
    "payload": [
        {
            "id": 10122863,
            "name": "New Office Laptop",
            "number": "EQ-20241006-6fdee94c-a984-428b-ab86-4ffcef3de221-000001",
            "companyId": 10000003,
            "status": "normal",
            "createdAt": 1733471083,
            "updatedAt": 1733471083,
            "note": "Laptop for new employee"
        },
        {
            "id": 10122864,
            "name": "New Office Laptop",
            "number": "EQ-20241006-6fdee94c-a984-428b-ab86-4ffcef3de221-000002",
            "companyId": 10000003,
            "status": "normal",
            "createdAt": 1733471083,
            "updatedAt": 1733471083,
            "note": "Laptop for new employee"
        }
    ]
}
  • Failed response
{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code":  "405ISF0000",
    "message": "Method not allowed",
    "payload": null
}

exportLedger

  • description: Export ledger list data

Request

Request url

POST /company/:companyId/ledger/export

Parameters

name type description required default
companyId string Company ID yes --

Body

name type description required default
fileType string File type (csv) yes --
filters object Filter conditions yes --
options object Export options no --

Filters

name type description required default
startDate number Start of time range based on acquisition date (timestamp, seconds) yes --
endDate number End of time range based on acquisition date (timestamp, seconds) yes --
startAccountNo number Starting account number no --
endAccountNo number Ending account number no --
labelType string Label type (general/detailed/all) no general

Options

name type description required default
language string Export file language (zh-TW, en-US) no zh-TW
timezone string Timezone offset (e.g., +0800, -0530) no +0800
fields string[] Specified export fields no all fields

Accounting Subject Fields

Field Name Description
accountId Accounting subject ID
no Account number
accountTitle Name of the accounting subject
voucherDate Voucher date
voucherNumber Voucher number
debitAmount Debit amount
creditAmount Credit amount
balance balance
particulars Description

Response Example

POST /company/1002/ledger/export

const body = {
    "fileType": "csv",
    "filters": {
        "startDate": 1672531200,
        "endDate": 1704067199,
        "startAccountNo": 1001,
        "endAccountNo": 2002,
        "labelType": "general"
    },
    "options": {
        "language": "zh-TW",
        "timezone": "+0800",
        "fields": ["accountTitle", "debitAmount", "creditAmount", "voucherDate"]
    }
}

Response

Success Response

return file

Response Headers

Content-Type: text/csv
Content-Disposition: attachment; filename=ledger_20240101123456.csv

Response Body Example

會計科目,貸方餘額,借方餘額,傳票日期,餘額
庫存現金,0,300,2024-01-01,300

Error Response

{
    "powerby": "iSunFA v2.0.0+1",
    "success": false,
    "code": "405",
    "message": "Method not allowed",
    "payload": null
}
⚠️ **GitHub.com Fallback** ⚠️