1. Wallet
Personal Finance Tracker
  • Personal Finance Tracker
  • Auth
    • Register
      POST
    • Login
      POST
    • Email Verification
      POST
    • Forgot Password
      POST
    • Reset Password
      POST
    • Resend Verification Code
      POST
  • Finance
    • Wallet
      • Create Wallet
        POST
      • Get All Wallet
        GET
      • Get Detail Wallet
        GET
    • Transaction
      • Create New Transaction
      • Get Summary By WalletId
      • Delete Transaction
      • Update Transaction
      • Get Summary
    • Category
      • Create Category
      • Get All Category
    • Budget
      • Create Budget
      • Get All
      • Get Detail
  • User
    • Get My Profile
      GET
  • Schemas
    • Finance
      • Wallet
  1. Wallet

Create Wallet

Developing
POST
/api/v1/finance/wallet

Description:#

This endpoint allows users to create a new wallet to manage different types of accounts such as cash, bank accounts, credit cards, e-wallets, and more. Users can specify the wallet type, initial balance, and other details.

Request Body:#

Type: application/json
{
  "type": "Cash",
  "name": "Main Wallet",
  "currency": "USD",
  "balance": 100.0,
  "description": "Primary wallet for daily expenses"
}
Parameters:
ParameterTypeRequiredDescription
typestringYesSpecifies the type of wallet. Options include: Cash, Bank Account, etc.
namestringYesName of the wallet (e.g., "Main Wallet").
currencystringYesCurrency code in ISO 4217 format (e.g., USD, IDR).
balancenumberNoInitial balance of the wallet (default is 0).
descriptionstringNoAdditional details or description of the wallet.

Response:#

Success (201 Created):#

{
  "id": "12345",
  "type": "Cash",
  "name": "Main Wallet",
  "currency": "USD",
  "balance": 100.0,
  "description": "Primary wallet for daily expenses",
  "createdAt": "2024-07-25T10:00:00Z"
}

Error Responses:#

400 Bad Request:
{
  "error": "Invalid request body. Please check the input fields."
}
422 Unprocessable Entity:
{
  "error": "Invalid wallet type. Allowed values are: 'Cash', 'Bank Account', etc."
}
500 Internal Server Error:
{
  "error": "Unable to create wallet due to an internal error. Please try again later."
}

Notes:#

Validation: Ensure type is one of the allowed values, and currency follows the ISO 4217 format.
Default Values: If balance is not provided, it will default to 0.
Rate Limiting: Apply rate limits to prevent abuse of wallet creation.
Security: Ensure the endpoint is authenticated and authorized for the user.

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Body Params application/json

Example
{
    "type" : "Uang Tunai",
    "name" : "Uang Tunai",
    "currency" : "IDR",
    "balance" : 25000
}

Request Code Samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/api/v1/finance/wallet' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type" : "Uang Tunai",
    "name" : "Uang Tunai",
    "currency" : "IDR",
    "balance" : 25000
}'

Responses

🟢200Success
application/json
Body

Example
{}
Modified at 2024-12-23 01:36:47
Previous
Resend Verification Code
Next
Get All Wallet
Built with