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.

Creates a new digital wallet account in the Accounts Service and persists it to the Accounts table. Each account is associated with exactly one user and holds the CVU and alias generated during registration, along with a running balance. Under normal circumstances this endpoint is invoked automatically by the User Service as part of the registration flow using a pre-shared internal service token, but it can also be called directly by an authenticated user or by an admin-level JWT.

Endpoint

POST /accounts/create
Base URL: http://localhost:8085 Full URL: http://localhost:8085/accounts/create

Authentication

This endpoint accepts two forms of credentials:
  • Internal service token — pass the raw token value as the full Authorization header value in the format Bearer <internalToken>. The Accounts Service compares the header against a configured secret (${internal.token}). This is the mechanism used by the User Service during registration.
  • User JWT — a standard Bearer token issued to an authenticated user. The service extracts the email claim from the JWT to audit the request.
Authorization: Bearer <token>
Requests without either a valid internal token or a valid JWT receive 401 Unauthorized.

Request Body

userId
long
required
The primary key of the user record this account belongs to. Must reference an existing user in the User Service.
email
string
required
The user’s email address. Stored on the account for authorization checks during subsequent operations (e.g., self-service deletion).
alias
string
required
The unique human-readable alias generated for the user during registration (e.g., sol.rio.mar).
cvu
string
required
The unique 22-character Uniform Virtual Key generated for the user during registration.
initialBalance
decimal
Optional starting balance for the account. Defaults to 0.00 if omitted.

Response Fields

A successful request returns 200 OK with an AccountResponse object.
Id
long
The auto-generated primary key of the newly created account record.
balance
decimal
The current balance of the account immediately after creation. Reflects the initialBalance value from the request, or 0.00 if none was provided.

Example

Request

curl -X POST "http://localhost:8085/accounts/create" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "userId": 42,
    "email": "maria.gonzalez@example.com",
    "alias": "sol.rio.mar",
    "cvu": "0000003100025678901234",
    "initialBalance": 0.00
  }'

Response

{
  "Id": 7,
  "balance": 0.00
}
Under typical platform usage you do not need to call this endpoint manually. When a user registers via POST /users/register, the User Service automatically calls POST /accounts/create using the internal service token. The resulting accountId is then written back to the user record. Call this endpoint directly only for administrative provisioning or testing purposes.

Error Codes

HTTP StatusDescription
400 Bad RequestThe request body is malformed or a required field is missing.
401 UnauthorizedNo valid JWT or internal service token was provided.

Build docs developers (and LLMs) love