Run in Apidog
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" : "Cash" ,
"name" : "Main Wallet" ,
"currency" : "USD" ,
"balance" : 100.0 ,
"description" : "Primary wallet for daily expenses"
} Parameter Type Required Description typestring Yes Specifies the type of wallet. Options include: Cash, Bank Account, etc. namestring Yes Name of the wallet (e.g., "Main Wallet"). currencystring Yes Currency code in ISO 4217 format (e.g., USD, IDR). balancenumber No Initial balance of the wallet (default is 0). descriptionstring No Additional 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: # {
"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 Provide your bearer token in the Authorization
header when making requests to protected resources. Example: Authorization: Bearer ********************
Body Params application/json
{
"type" : "Uang Tunai" ,
"name" : "Uang Tunai" ,
"currency" : "IDR" ,
"balance" : 25000
} Request Code Samples
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 application/json Generate Code
Modified at 2024-12-23 01:36:47