MiniFirma API

بیش از 20 سال تاریخ برنامه نویسی و ایده پردازی

مطالب پیش رو برای زبان فارسی تهیه نشده است.

Minifirma API is a CLI/Webserver application which can be used as a service (self-hosted) for softwares in the finance areas:

It can support:

  • Different type of business entities
  • Creating and managing accounts
  • Mirroring bank accounts from real banks
  • Reporting on mirrored transactions
  • Holding balance, to create wallet apps

Minifirma is PixelPlux financial and accounting app, consists of a mobile application and web services, which uses MiniFirma API. Neither of products are open-source, but you can download the API and CLI tool in case you want to create your own app and extend this services under an special agreement with PixelPlux

Download the binaries

You can download the binaries of Minifirma CLI from top of this document, and it could be run like any other executable on Ubuntu and MacOs, and there is the minifirma-cli.exe for Windows users.

Check the version

The first thing you want to do when you downloaded the binary, to run and check the version.

$ ./minifirma.exe

It will create an output like this:

NAME:
   Fireback develop/administration cli

USAGE:
    [global options] command [command options] [arguments...]

COMMANDS:
   server, s        Starts the web server
   users, u         
   transactions, t  
   drive            
   help, h          Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help

Business entities

In many accounting and financing softwares, all the finances are happening under a business. Even for personal use cases, you can create a self business to store the transactions under that, to make reporting easier.

Note: Transactions do not need to be under a business in the design.

Create a new business

You can use this POST endpoint to create a new business, by passing name and legalType of the business as strings.

Also, you can pass more details about the business in data json object. It should be a flat json (nested is not accepted) and can both accept string values and numeric values. This will be normalized in database and can have reporting later on. (In comparison with storing only json and loosing that option).

curl --data '{"name":"PixelPlux","legalType":"poland_spzoo","data":{"nip":1000,"size":"large"}}' -X POST http://localhost:6120/business-entity
{
  "data": {
    "createdAt": "2022-06-09T14:14:08.090909+02:00",
    "updatedAt": "2022-06-09T14:14:08.090909+02:00",
    "workspaceId": "",
    "deletedAt": null,
    "name": "PixelPlux",
    "uniqueId": "fa9d80bd-70d1-4e01-931f-fddb786071f3",
    "legalType": "poland_spzoo",
    "data": {
      "nip": 1000,
      "size": "large"
    }
  }
}

Access list of businesses

You can get the list of businesses available in the system using get endpoint.

curl -X GET http://localhost:6120/business-entities
{
  "data": {
    "items": [
      {
        "createdAt": "2022-06-09T14:14:07.996454+02:00",
        "updatedAt": "2022-06-09T14:14:07.996454+02:00",
        "workspaceId": "",
        "deletedAt": null,
        "name": "Sample business for account",
        "uniqueId": "bd4a8c05-2cc1-4e91-b969-3539987dd1e7",
        "legalType": "",
        "data": null
      },
      {
        "createdAt": "2022-06-09T14:14:08.090909+02:00",
        "updatedAt": "2022-06-09T14:14:08.090909+02:00",
        "workspaceId": "",
        "deletedAt": null,
        "name": "PixelPlux",
        "uniqueId": "fa9d80bd-70d1-4e01-931f-fddb786071f3",
        "legalType": "poland_spzoo",
        "data": null
      }
    ]
  }
}
curl --data '{"name":"Main account","currency":"pln","mirror":true}' -X POST http://localhost:6120/account
{
  "data": {
    "createdAt": "2022-06-09T14:14:07.949077+02:00",
    "updatedAt": "2022-06-09T14:14:07.949077+02:00",
    "workspaceId": "",
    "deletedAt": null,
    "name": "Main account",
    "uniqueId": "aad43f12-0f32-49aa-89dc-55ff1d0a61fb",
    "currency": "pln",
    "mirror": true,
    "businessEnttityId": ""
  }
}
curl -X GET http://localhost:6120/accounts
{
  "data": {
    "items": [
      {
        "createdAt": "2022-06-09T14:13:53.781889+02:00",
        "updatedAt": "2022-06-09T14:13:53.781889+02:00",
        "workspaceId": "",
        "deletedAt": null,
        "name": "Mirror account",
        "uniqueId": "debef2d9-64d5-49b6-89cb-416288061238",
        "currency": "bit",
        "mirror": true,
        "businessEnttityId": ""
      },
      {
        "createdAt": "2022-06-09T14:14:07.949077+02:00",
        "updatedAt": "2022-06-09T14:14:07.949077+02:00",
        "workspaceId": "",
        "deletedAt": null,
        "name": "Main account",
        "uniqueId": "aad43f12-0f32-49aa-89dc-55ff1d0a61fb",
        "currency": "pln",
        "mirror": true,
        "businessEnttityId": ""
      }
    ]
  }
}
curl -X GET http://localhost:6120/report/monthly?range=2022-04-01...2022-06-01
{
  "data": {
    "items": [
      {
        "date": "2022-04-01",
        "incomeAmount": 0,
        "incomeCount": 0,
        "expenseAmount": 0,
        "expenseCount": 0,
        "month": "APR"
      },
      {
        "date": "2022-05-01",
        "incomeAmount": 6000,
        "incomeCount": 2,
        "expenseAmount": -6000,
        "expenseCount": 2,
        "month": "MAY"
      },
      {
        "date": "2022-06-01",
        "incomeAmount": 0,
        "incomeCount": 0,
        "expenseAmount": 0,
        "expenseCount": 0,
        "month": "JUN"
      }
    ]
  }
}
curl --data '{"title":"Transaction 1","amount":100,"accountId":"0dd1c3ee-3932-4573-8950-6af619cf91d4"}' -X POST http://localhost:6120/transaction
{
  "data": {
    "createdAt": "2022-06-09T14:14:08.208095+02:00",
    "updatedAt": "2022-06-09T14:14:08.208095+02:00",
    "workspaceId": "",
    "title": "Transaction 1",
    "uniqueId": "271d957d-48ee-42bc-b644-ca6b38b4c26d",
    "account": {
      "createdAt": "2022-06-09T14:14:08.197872+02:00",
      "updatedAt": "2022-06-09T14:14:08.197872+02:00",
      "workspaceId": "",
      "deletedAt": null,
      "name": "Mirror account",
      "uniqueId": "0dd1c3ee-3932-4573-8950-6af619cf91d4",
      "currency": "bit",
      "mirror": true,
      "businessEnttityId": ""
    },
    "accountId": "0dd1c3ee-3932-4573-8950-6af619cf91d4",
    "transactionDate": "0001-01-01T00:00:00Z",
    "settlementDate": "0001-01-01T00:00:00Z",
    "correspondence": "",
    "correspondenceAccount": "",
    "amount": 0,
    "summary": 100
  }
}
curl -X DELETE http://localhost:6120/transaction/271d957d-48ee-42bc-b644-ca6b38b4c26d
{
  "data": {
    "deleted": 1
  }
}
curl -X GET http://localhost:6120/business-entity/aad43f12-0f32-49aa-89dc-55ff1d0a61fb
{
  "data": {
    "createdAt": "0001-01-01T00:00:00Z",
    "updatedAt": "0001-01-01T00:00:00Z",
    "workspaceId": "",
    "deletedAt": null,
    "name": "",
    "uniqueId": "",
    "legalType": "",
    "data": {}
  }
}
curl -X GET http://localhost:6120/transactions
{
  "data": {
    "items": [
      {
        "createdAt": "2022-06-09T14:14:08.208095+02:00",
        "updatedAt": "2022-06-09T14:14:08.208095+02:00",
        "workspaceId": "",
        "title": "Transaction 1",
        "uniqueId": "271d957d-48ee-42bc-b644-ca6b38b4c26d",
        "account": {
          "createdAt": "0001-01-01T00:00:00Z",
          "updatedAt": "0001-01-01T00:00:00Z",
          "workspaceId": "",
          "deletedAt": null,
          "name": "",
          "uniqueId": "",
          "currency": "",
          "mirror": false,
          "businessEnttityId": ""
        },
        "accountId": "0dd1c3ee-3932-4573-8950-6af619cf91d4",
        "transactionDate": "0001-01-01T00:00:00Z",
        "settlementDate": "0001-01-01T00:00:00Z",
        "correspondence": "",
        "correspondenceAccount": "",
        "amount": 0,
        "summary": 100
      }
    ]
  }
}
curl --data '{"name":"new name","business_id":"bd4a8c05-2cc1-4e91-b969-3539987dd1e7"}' -X POST http://localhost:6120/account/aad43f12-0f32-49aa-89dc-55ff1d0a61fb
{
  "data": {
    "createdAt": "2022-06-09T14:14:07.949077+02:00",
    "updatedAt": "2022-06-09T14:14:08.008798+02:00",
    "workspaceId": "",
    "deletedAt": null,
    "name": "new name",
    "uniqueId": "aad43f12-0f32-49aa-89dc-55ff1d0a61fb",
    "currency": "pln",
    "mirror": true,
    "businessEnttityId": "bd4a8c05-2cc1-4e91-b969-3539987dd1e7"
  }
}
curl --data '{"name":"new name","data":{"NIP":"89280192"}}' -X POST http://localhost:6120/business-entity/fa9d80bd-70d1-4e01-931f-fddb786071f3
{
  "data": {
    "createdAt": "2022-06-09T14:14:08.090909+02:00",
    "updatedAt": "2022-06-09T14:14:08.142189+02:00",
    "workspaceId": "",
    "deletedAt": null,
    "name": "new name",
    "uniqueId": "fa9d80bd-70d1-4e01-931f-fddb786071f3",
    "legalType": "poland_spzoo",
    "data": {
      "NIP": "89280192"
    }
  }
}