# update_affiliate

Source: https://modulify.ai/docs/api/account/update-affiliate

Sets the referral code people use to sign up under you, and the email your payouts go to.

- Title: Set your referral code and payout email
- Scope: `account:write`
- Access: Destructive
- Endpoint: `POST /v1/update_affiliate`

The code is one way once somebody has referred through it: after that it cannot be undone or changed, and a change is refused with `Affiliate code cannot be changed after being used by your referrals!` The tool tells the client to check the code with `check_affiliate_code` and confirm the exact spelling with you before setting it.

Both the code and the payout email are required together and both are rewritten on every call. Read the current values with `get_account` first, where they sit under `Affiliate` as `Code` and `PayPalEmail`, and send back the one you are not changing.

A code is 3 to 12 letters and digits and is stored in lowercase, and one somebody else holds is refused with `Affiliate code is already taken!` It acts only on the account the token belongs to and needs no workspace. See [Affiliates](https://modulify.ai/docs/plans/affiliates#change-your-code-or-your-payout-email).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/update_affiliate`, sending the inputs below as a JSON object. The token needs the `account:write` scope.

> **Warning**
>
> This method is marked destructive: it deletes or overwrites data. Check the inputs before you call it, and send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it.

```bash
curl -X POST https://api.modulify.ai/v1/update_affiliate \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"code":"CODE","email":"EMAIL"}'
```

Over MCP, the same method is the [update_affiliate tool](https://modulify.ai/docs/mcp/account/update-affiliate).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | The referral code to claim, 3 to 12 letters and digits. It cannot be changed once a referral has used it. |
| `email` | string | Yes | The PayPal address your payouts are sent to. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.