Skip to main content

Endpoints

MethodEndpointDescription
GET/walletsList all wallets
POST/walletsCreate new wallet
GET/wallets/:idGet wallet by ID
PUT/wallets/:idUpdate wallet
DELETE/wallets/:idDelete wallet

List Wallets

GET /wallets
Authorization: Bearer <token>
Response:
[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Cash",
    "currency": "USD",
    "balance": 150.00,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  },
  {
    "id": "550e8400-e29b-41d4-a716-446655440001",
    "name": "Chase Checking",
    "currency": "USD",
    "balance": 2500.50,
    "created_at": "2024-01-14T09:00:00Z",
    "updated_at": "2024-01-15T11:00:00Z"
  }
]

Create Wallet

POST /wallets
Authorization: Bearer <token>
Content-Type: application/json

{
  "name": "Savings",
  "currency": "USD",
  "balance": 5000.00
}
Response (201):
{
  "id": "550e8400-e29b-41d4-a716-446655440002",
  "name": "Savings",
  "currency": "USD",
  "balance": 5000.00,
  "created_at": "2024-01-15T12:00:00Z",
  "updated_at": "2024-01-15T12:00:00Z"
}
Validation Errors (422):
{
  "error": "Validation failed",
  "fields": {
    "name": "Name is required",
    "currency": "Invalid currency code"
  }
}

Get Wallet

GET /wallets/550e8400-e29b-41d4-a716-446655440000
Authorization: Bearer <token>
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Cash",
  "currency": "USD",
  "balance": 150.00,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}
Not Found (404):
{
  "error": "Not found",
  "message": "Wallet not found"
}

Update Wallet

PUT /wallets/550e8400-e29b-41d4-a716-446655440000
Authorization: Bearer <token>
Content-Type: application/json

{
  "name": "Updated Name",
  "balance": 200.00
}
Response:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Updated Name",
  "currency": "USD",
  "balance": 200.00,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T13:00:00Z"
}

Delete Wallet

DELETE /wallets/550e8400-e29b-41d4-a716-446655440000
Authorization: Bearer <token>
Response (204): No content.

Wallet Schema

FieldTypeRequiredDescription
idUUIDAutoUnique identifier
nameStringYesWallet name (2-100 chars)
currencyStringYesISO 4217 code
balanceDecimalNoCurrent balance (default: 0)
created_atDateTimeAutoCreation timestamp
updated_atDateTimeAutoLast update timestamp