Attach Existing Client to IB
Attaches an existing B2CORE client under an IB in one call. When the client is new to the IB module, its IB profile and client user are created from `profile`; then one relation is created per resolved partner user and a chain rebuild is scheduled, which also updates the client's IB settings in B2CORE. `parentUser` accepts the IB's user ID, referral token or profile email. The call is idempotent per client and IB: repeating it returns `already_attached` with the current upline. A client that already belongs to a different IB is not moved (`different_parent`); use the reassignments flow for that. A call that creates relations records one `relation_create` relation operation for them (see `GET /relation-operations`); its ID is not returned.
Authorization
appToken writeApp access token issued by POST /tokens (client credentials). Full-access Apps hold the read and write scopes, read-only Apps hold read only. Send it as Authorization: Bearer <token>.
In: header
Scope: write
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/relations/attach" \ -H "Content-Type: application/json" \ -d '{ "clientUuid": "12345", "parentUser": "a3f1c2d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "profile": { "email": "user@example.com", "firstName": "string", "lastName": "string" } }'{ "status": "attached", "user": { "userId": "string", "userUuid": "string", "profileId": "string", "profileUuid": "string", "parents": [ { "userId": "string", "userUuid": "string", "groupId": "string", "groupName": "string", "profileId": "string", "profileUuid": "string", "relationId": "string", "relationUuid": "string" } ] }}{ "message": "string", "code": "string", "errors": { "property1": [ "string" ], "property2": [ "string" ] }, "details": [ { "field": "string", "issue": "string" } ]}{ "message": "string", "code": "string", "errors": { "property1": [ "string" ], "property2": [ "string" ] }, "details": [ { "field": "string", "issue": "string" } ]}{ "error": { "message": "This App is read-only and cannot perform this operation.", "code": "insufficient_scope" }}{ "message": "string", "code": "string", "errors": { "property1": [ "string" ], "property2": [ "string" ] }, "details": [ { "field": "string", "issue": "string" } ]}{ "message": "string", "code": "string", "errors": { "property1": [ "string" ], "property2": [ "string" ] }, "details": [ { "field": "string", "issue": "string" } ]}{ "message": "string", "code": "string", "errors": { "property1": [ "string" ], "property2": [ "string" ] }, "details": [ { "field": "string", "issue": "string" } ]}{ "message": "string", "code": "string", "errors": { "property1": [ "string" ], "property2": [ "string" ] }, "details": [ { "field": "string", "issue": "string" } ]}