Cash Flows Endpoint

{info} Mengolah data aliran dana pribadi (catatan keuangan).


Base URL

https://public-api.delcom.org/api/v1

Add New Cash Flow

  • URL
    • /cash-flows
  • Method
    • POST
  • Headers
    • Content-Type: multipart/form-data
    • Authorization: Bearer <token>
  • Request Body
    • type as inflow | outflow
    • source as cash | savings | loans
    • label as string
    • description as string
    • nominal as number
  • Response
{
    "success": true,
    "message": "Berhasil menambahkan data",
    "data": {
        "cash_flow_id": 1
    }
}

Update Cash Flow

  • URL
    • /cash-flows/:id
  • Method
    • PUT
  • Headers
    • Content-Type: application/x-www-form-urlencoded
    • Authorization: Bearer <token>
  • Request Body
    • type as inflow | outflow
    • source as cash | savings | loans
    • label as string
    • description as string
    • nominal as number
  • Response
{
    "success": true,
    "message": "Berhasil mengubah data"
}

Get All Cash Flows

  • URL
    • /cash-flows
  • Parameters
    • type as inflow | outflow
    • source as cash | savings | loans
    • label as string
    • start_date as timestamp, example: 2024-10-05 00:00:00
    • end_date as timestamp, example: 2024-10-05 23:59:59
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Response
{
    "success": true,
    "message": "Berhasil mengambil data",
    "data": {
        "cash_flows": [
            {
                "id": 4,
                "user_id": 1,
                "type": "outflow",
                "source": "savings",
                "label": "alat-elektronik",
                "description": "Membeli kebutuhan keyboard dan mouse",
                "nominal": 400000,
                "created_at": "2024-10-05T12:09:16.000000Z",
                "updated_at": "2024-10-05T12:09:16.000000Z"
            },
            {
                "id": 3,
                "user_id": 1,
                "type": "outflow",
                "source": "cash",
                "label": "alat-mandi",
                "description": "Membeli kebutuhan alat mandi seperti sabun, odol.",
                "nominal": 100000,
                "created_at": "2024-10-05T11:28:02.000000Z",
                "updated_at": "2024-10-05T11:28:02.000000Z"
            },
            {
                "id": 2,
                "user_id": 1,
                "type": "inflow",
                "source": "cash",
                "label": "gaji",
                "description": "Gaji bulanan",
                "nominal": 2500000,
                "created_at": "2024-10-05T11:26:45.000000Z",
                "updated_at": "2024-10-05T11:26:48.000000Z"
            }
        ],
        "stats": {
            "cashflow": 2000000,
            "total_outflow": 500000,
            "total_outflow_savings": 400000,
            "total_outflow_savings_alat-elektronik": 400000,
            "total_outflow_label_alat-elektronik": 400000,
            "total_outflow_cash": 100000,
            "total_outflow_cash_alat-mandi": 100000,
            "total_outflow_label_alat-mandi": 100000,
            "total_inflow": 2500000,
            "total_inflow_cash": 2500000,
            "total_inflow_cash_gaji": 2500000,
            "total_inflow_label_gaji": 2500000
        }
    }
}

Detail Cash Flow

  • URL
    • /cash-flows/:id
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Response
{
    "success": true,
    "message": "Berhasil mengambil data",
    "data": {
        "cash_flow": {
            "id": 4,
            "user_id": 1,
            "type": "outflow",
            "source": "savings",
            "label": "alat-elektronik",
            "description": "Membeli kebutuhan keyboard dan mouse",
            "nominal": 400000,
            "created_at": "2024-10-05T12:09:16.000000Z",
            "updated_at": "2024-10-05T12:09:16.000000Z"
        }
    }
}

Delete Cash Flow

  • URL
    • /cash-flows/:id
  • Method
    • DELETE
  • Headers
    • Authorization: Bearer <token>
  • Response
{
    "success": true,
    "message": "Berhasil menghapus data"
}

Get Your Labels

  • URL
    • /cash-flows/labels
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Response
{
    "success": true,
    "message": "Berhasil mengambil data",
    "data": {
        "labels": ["gaji", "alat-mandi"]
    }
}

Get Stats Daily

  • URL
    • /cash-flows/stats/daily
  • Parameters
    • end_date as timestamp, example: 2024-10-05 23:59:59
    • total_data as number
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Response
{
    "success": true,
    "message": "Berhasil mengambil data",
    "data": {
        "stats_inflow": {
            "01-10-2024": 0,
            "02-10-2024": 0,
            "03-10-2024": 0,
            "04-10-2024": 0,
            "05-10-2024": 2500000,
            "06-10-2024": 0,
            "07-10-2024": 0
        },
        "stats_outflow": {
            "01-10-2024": 0,
            "02-10-2024": 0,
            "03-10-2024": 0,
            "04-10-2024": 0,
            "05-10-2024": 500000,
            "06-10-2024": 0,
            "07-10-2024": 0
        },
        "stats_cashflow": {
            "01-10-2024": 0,
            "02-10-2024": 0,
            "03-10-2024": 0,
            "04-10-2024": 0,
            "05-10-2024": 2000000,
            "06-10-2024": 0,
            "07-10-2024": 0
        }
    }
}

Get Stats Monthly

  • URL
    • /cash-flows/stats/monthly
  • Parameters
    • end_date as timestamp, example: 2024-10-05 23:59:59
    • total_data as number
  • Method
    • GET
  • Headers
    • Authorization: Bearer <token>
  • Response
{
    "success": true,
    "message": "Berhasil mengambil data",
    "data": {
        "stats_inflow": {
            "01-2024": 0,
            "02-2024": 0,
            "03-2024": 0,
            "04-2024": 0,
            "05-2024": 0,
            "06-2024": 0,
            "07-2024": 0,
            "08-2024": 0,
            "09-2024": 0,
            "10-2024": 2500000,
            "11-2024": 0,
            "12-2024": 0
        },
        "stats_outflow": {
            "01-2024": 0,
            "02-2024": 0,
            "03-2024": 0,
            "04-2024": 0,
            "05-2024": 0,
            "06-2024": 0,
            "07-2024": 0,
            "08-2024": 0,
            "09-2024": 0,
            "10-2024": 500000,
            "11-2024": 0,
            "12-2024": 0
        },
        "stats_cashflow": {
            "01-2024": 0,
            "02-2024": 0,
            "03-2024": 0,
            "04-2024": 0,
            "05-2024": 0,
            "06-2024": 0,
            "07-2024": 0,
            "08-2024": 0,
            "09-2024": 0,
            "10-2024": 2000000,
            "11-2024": 0,
            "12-2024": 0
        }
    }
}