Authorization: Bearer <broker API key> and Content-Type: application/json. Never ship the key in browser or mobile code. Paths below are relative to /api/v1/mamx. Omit server: the instance identifies its own MT5 server. Example logins and groups are placeholders; use actual MT5 responses.
1. Create or import a trading account
Create when no MT5 login exists. The minimum body forPOST /accounts/create creates an investor:
"can_be_leader": true and "can_be_follower": false. The default currency is USD with two decimal places; for other MT5 group settings, supply the matching currency or precision. A confirmed creation returns 201, mt5_login and initial credentials. Never log this response.
Import when the login already exists. Send POST /accounts/add:
status_url or poll GET /operations/{operation_id}. For password delivery after asynchronous creation, see Operations. Do not interpret a pending login as proof that registration succeeded.
2. Create the leader profile and payment account
SendPOST /leaders with the registered trading login, not the account’s internal ID:
payment_account_login to create a payment account in the master group. To link an existing one, add e.g. "payment_account_login":"100003". The agent checks MT5. The login must be distinct, unused for another MAMX role, trading-disabled, and match the master’s currency and currency precision. A bad supplied login does not trigger fallback creation.
The response is 202. Wait for DONE; store evidence.result.master_id (the leader ID) and payment_account_login from the result. Existing payment accounts retain their own credentials.
3. Fund and subscribe the investor
Registration does not fund any account. The master can register with no deposit, but proportional settlement needs a valid positive denominator. See Funding. SendPOST /allocations:
"allocation_mode": "EQUITY". For safe retries, add an idempotency_key and persist it before sending. Replaying the same key and payload returns the current allocation without reactivating a cancelled one. Save the returned allocation id.
4. Update or end the relationship
PATCH /accounts/{account_login}: edit the name or eligible role with anIdempotency-Keyheader. A role change requires no conflicting master, allocation or payment links and no live positions or pending orders. It does not move the account to another MT5 group.PATCH /leaders/{leader_id}: edit the strategy name, fee rate or fee period. A term change crystallizes accrued fees under the old terms; a rename alone does not. Use anIdempotency-Keyheader.PATCH /allocations/{allocation_id}: update allocation settings. Completed imports and already established partial chains are not rewritten.POST /allocations/{allocation_id}/unsubscribe: stop future participation and settle outstanding obligations. This is not a withdrawal. If a captured import must finish first, wait and retry after the conflict clears.DELETE /accounts/{account_login}: remove the account from MAMX, not from MT5. It does not withdraw funds, fabricate exit trades or erase history. Deleting a master ends its allocations but does not delete its investors. Track anyfinal_fee_idsuntil paid; repeated deletion does not charge again.
/accounts/add and manual payment option require the matching API and agent build. An older instance’s Swagger may not advertise them.
