Delete an account.
const url = 'https://api.tradr.cloud/api/accounts/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0?cascade=demo';const options = {method: 'DELETE'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request DELETE \ --url 'https://api.tradr.cloud/api/accounts/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0?cascade=demo'Authed. Refused with 409 when the account holds positions — deleting one would take its trading history with it.
?cascade=demo asks instead for the sample-account teardown: the account and every position, fill and ledger entry booked against it, removed together in one transaction, leaving nothing orphaned behind. It is a request and not an authorisation — the server decides from the account’s own stored sample-data flag, so the same call against a real account holding positions is refused with 409 exactly as it is without the parameter. Nothing a client sends can reach the flag.
Teardown is idempotent: repeating it against a sample account that has already been removed answers 204, so two tabs pressing the same button settle on the same state. That applies only to the caller’s own former sample account; every other unknown id is a 404, as is any account belonging to another user.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Query Parameters
Section titled “Query Parameters”demo requests the sample-account teardown. Any other value is a 400.
Responses
Section titled “Responses”Deleted, or already torn down.
Validation error (a non-uuid id, or an unrecognised cascade value).
Account not found (or not owned by the user).
The account has positions and no cascade applies.