Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Gianluca-X/DigitalMoney/llms.txt

Use this file to discover all available pages before exploring further.

The Accounts Service provides two PATCH endpoints for modifying account data. The general-purpose PATCH /accounts/{id} endpoint accepts an AccountEntryDTO payload and can update any writable account field, returning the full updated record. The targeted PATCH /accounts/update/alias/{id} endpoint updates only the alias field and is the endpoint called by the User Service when an alias change is propagated from the user profile — keeping both services consistent. Both require a valid Bearer JWT.

Update Account

PATCH /accounts/{id}
Base URL: http://localhost:8085 Full URL: http://localhost:8085/accounts/{id}

Authentication

Authorization: Bearer <token>

Path Parameters

id
long
required
The primary key of the account to update.

Request Body

Fields are sourced from AccountEntryDTO. Include only the fields you wish to change.
userId
long
The primary key of the owning user. Typically not changed after account creation.
alias
string
A new unique alias for the account (e.g., luna.campo.verde).
cvu
string
A new CVU value. Should only be set administratively — CVUs are normally immutable after generation.
balance
decimal
Updated account balance. Use this only for administrative corrections; normal balance changes should flow through the Transactions Service.
transactions
array
A list of transaction references to associate with this account. Normally managed by the Transactions Service.

Response Fields

Returns the updated AccountOutDTO on 200 OK.
id
long
The account’s primary key.
userId
long
The primary key of the owning user.
alias
string
The alias after the update.
cvu
string
The CVU after the update.
balance
decimal
The balance after the update.
transactions
array
Transaction references associated with this account.

Example

curl -X PATCH "http://localhost:8085/accounts/7" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "alias": "luna.campo.verde"
  }'
{
  "id": 7,
  "userId": 42,
  "alias": "luna.campo.verde",
  "cvu": "0000003100025678901234",
  "balance": 15000.50,
  "transactions": []
}

Update Alias Only

PATCH /accounts/update/alias/{id}
Full URL: http://localhost:8085/accounts/update/alias/{id} Directly updates the alias column for the specified account using a repository-level query. This endpoint is invoked by the User Service whenever a user changes their alias via PATCH /users/update/alias/{id}, ensuring the alias remains consistent across both services. It returns a JSON object with a confirmation message field on success, or an error field on failure.

Authentication

Authorization: Bearer <token>

Path Parameters

id
long
required
The primary key of the account whose alias should be updated.

Request Body

alias
string
required
The new alias to assign to the account. Must be unique across the platform.

Response

Returns 200 OK with a JSON object.
{
  "message": "Alias actualizado exitosamente"
}

Example

curl -X PATCH "http://localhost:8085/accounts/update/alias/7" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "alias": "luna.campo.verde"
  }'
{
  "message": "Alias actualizado exitosamente"
}

Error Codes

HTTP StatusDescription
401 UnauthorizedThe Authorization header is missing or the JWT is invalid/expired.
404 Not FoundNo account exists with the provided id.
500 Internal Server ErrorThe alias update failed due to an unexpected server error (e.g., a database constraint violation). The response body will contain { "error": "Error al actualizar el alias en el servicio de usuarios." }.

Build docs developers (and LLMs) love