swap_user_referral_code
Swap a user's referral code by removing them from an existing code and assigning them to a new one. Validate changes with a dry run before committing the mutation.
Instructions
Move a user between referral codes with full redemption semantics: DELETE from from_referral_code then PATCH /api/v1/referral_codes/:to_referral_code/use (not atomic). Step 1 tolerates already-removed 422s (e.g. user never had a prior code). Step 2 assigns to the owner of to_referral_code — there are no to_referrer_* params. If PATCH /use fails after DELETE, response has partial:true with use_error; complete with use_referral_code or update_user_referrer. Legacy PUT-only users (user_referrers without referral_code_use) may block step 2 with "User already has a referrer" — clear with delete_user_referrer first when appropriate. For first assign with no prior code, use use_referral_code directly. Requires service_role project API key. Auth: project API key only (pass project_api_key or set env FUUL_MCP_PROJECT_API_KEY). Dashboard OAuth from fuul-mcp login is not accepted on these routes. dry_run then confirmed. Example dry_run: {"user_identifier":"0xUser...","user_identifier_type":"evm_address","from_referral_code":"OLD","from_referrer_identifier":"0xOldKol...","from_referrer_identifier_type":"evm_address","to_referral_code":"NEW","dry_run":true}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"user_identifier": "<user_identifier>",
"user_identifier_type": "<user_identifier_type>",
"from_referral_code": "<from_referral_code>",
"from_referrer_identifier": "<from_referrer_identifier>",
"from_referrer_identifier_type": "<from_referrer_identifier_type>",
"to_referral_code": "<to_referral_code>"
},
"name": "swap_user_referral_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_api_key | No | Project API key used as Bearer for this request. Falls back to FUUL_MCP_PROJECT_API_KEY when omitted. | |
| dry_run | No | If true, validate and return a preview only; no server mutation. | |
| confirmed | No | Must be true to perform the mutation after reviewing dry_run output. | |
| user_identifier | Yes | ||
| user_identifier_type | Yes | ||
| from_referral_code | Yes | ||
| from_referrer_identifier | Yes | Wallet of the owner of from_referral_code. | |
| from_referrer_identifier_type | Yes | ||
| to_referral_code | Yes | Target referral code. Step 2 PATCH /use assigns the user to this code owner (no separate to_referrer fields). |