Set the default account.
const url = 'https://api.tradr.cloud/api/accounts/default';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"accountId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.tradr.cloud/api/accounts/default \ --header 'Content-Type: application/json' \ --data '{ "accountId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Authed. Moves the default-account designation — the account the app’s pickers preselect — to the named account. Exactly one account holds it at a time: setting a new default clears the old one in the same statement. The first account a user creates takes the designation automatically, and deleting the default hands it to the oldest remaining account, so this endpoint is only ever a move.
The account must belong to the current user (404 otherwise), and the sample account is refused with 400 DEMO_ACCOUNT_NOT_DEFAULTABLE — a preselected sample account would put invented data behind every new position by default.
Every account read carries a boolean isDefault; it is server-set and cannot be sent in on create or update.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Examplegenerated
{ "accountId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Responses
Section titled “Responses”{ defaultAccountId } — the stored designation.
Validation error, or DEMO_ACCOUNT_NOT_DEFAULTABLE (the sample account).
Account not found (or not owned by the user).