# Update affiliate

Updates the specified affiliate by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

## Request

| Method | URL                                              |
| ------ | ------------------------------------------------ |
| `PUT`  | `https://api.getrewardful.com/v1/affiliates/:id` |

### Parameters

| Parameter                              | Required? | Description                                                                                                                                                                                                                                |
| -------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `first_name`                           | No        | The affiliate's first name.                                                                                                                                                                                                                |
| `last_name`                            | No        | The affiliate's last name.                                                                                                                                                                                                                 |
| `email`                                | No        | The affiliate's email address.                                                                                                                                                                                                             |
| `state`                                | No        | A string indicating the [affiliate's state](/rest-api/affiliates/object.md#state). Defaults to `active`.                                                                                                                                   |
| `stripe_customer_id`                   | No        | For customer referral programs, this is the Stripe Customer that will receive account credits as rewards. ***Note:** the customer must exist in your Stripe account in livemode.*                                                          |
| `campaign_id`                          | No        | The UUID of the campaign this affiliate should be moved to. [Learn more about moving affiliates between campaigns.](https://help.getrewardful.com/en/articles/2330644-working-with-multiple-campaigns#moving-affiliates-between-campaigns) |
| `paypal_email`                         | No        | The PayPal address that commissions should be paid to.                                                                                                                                                                                     |
| `wise_email`                           | No        | The Wise address that commissions should be paid to.                                                                                                                                                                                       |
| `receive_new_commission_notifications` | No        | Whether or not the affiliate should receive emails when new rewards and commissions are earned. Accepts `true` or `false`.                                                                                                                 |

### Example

<pre class="language-bash"><code class="lang-bash"><strong>curl --request PUT \
</strong>  --url https://api.getrewardful.com/v1/affiliates/d0ed8392-8880-4f39-8715-60230f9eceab \
  -u YOUR_API_SECRET: \
  -d first_name=Jamie \
  -d email=james.bond@mi6.co.uk
</code></pre>

## Response

{% tabs %}
{% tab title="Success" %}

| Response code | Body                                                         |
| ------------- | ------------------------------------------------------------ |
| `200`         | An [affiliate object](/rest-api/affiliates/object.md) (JSON) |
| {% endtab %}  |                                                              |

{% tab title="Failures" %}

### Not found

| Response code | Body                              |
| ------------- | --------------------------------- |
| `404`         | JSON object describing the error. |

```javascript
{  "error": "Affiliate not found: " }
```

### Authentication failure

| Response code | Body                                       |
| ------------- | ------------------------------------------ |
| `401`         | Description of the authentication failure. |

```javascript
{  "error": "Invalid API Secret." }
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.rewardful.com/rest-api/affiliates/update.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
