PATCH /flexi/merge
Merge SOL from multiple running bots into the first one. Sources are stopped once their funds are drained.
Async — target is botIds[0], the rest are sources.
Use case
Consolidate stragglers — combine several low-balance bots into one well-funded bot rather than run them to depletion separately.
Body
| Field | Type | Required | Description |
|---|---|---|---|
botIds | string[] | yes | 2–100 bot ObjectIds, no duplicates. The first id is the merge target; the rest are sources. |
Requirements
Every bot must be:
- Owned by the caller
- In
RUNNINGstate - Not already merging, splitting, or scheduled to stop
Response 200
{ "message": "Bots prepared to be merged" }
Errors
| Status | Meaning |
|---|---|
400 | Fewer than 2 ids, or any bot not in RUNNING state. |
403 | Any bot not owned by the caller (cross-tenant merge rejected). |
404 | Any id unknown. |
Example
curl -X PATCH "$BASE_URL/flexi/merge" \
-H "Authorization: Bearer $ACCESS" \
-H "x-user-id: $USER_ID" \
-H "Content-Type: application/json" \
-d '{ "botIds": ["<target>", "<source1>", "<source2>"] }'