> For the complete documentation index, see [llms.txt](https://developers.rewardful.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.rewardful.com/rest-api/referrals/convert-a-referral-to-a-lead.md).

# Convert a referral to a lead

This endpoint can be used to update a referral in visitor status to a lead by providing basic information about the customer associated with it.

Providing the `became_lead_at` attribute will update the timestamp that signifies when the event occurred, thus allowing the event to be logged any time in the past. If this attribute is omitted, then the current timestamp will be used as a default value.

Note that this endpoint cannot be used to roll back a converted referral to lead status.

## Request

| Method | URL                                                  |
| ------ | ---------------------------------------------------- |
| `POST` | `https://api.getrewardful.com/v1/referrals/:id/lead` |

### Parameters

| Parameter        | Required? | Description                              |
| ---------------- | --------- | ---------------------------------------- |
| `became_lead_at` | No        | The timestamp of conversion into a lead. |
| `customer_name`  | No        | The name of the referral.                |
| `customer_email` | No        | The email address of the referral        |

### Example

<pre class="language-bash"><code class="lang-bash"><strong>curl --request POST \
</strong>  --url https://api.getrewardful.com/v1/referrals/d0ed8392-8880-4f39-8715-60230f9eceab/lead \
  -u YOUR_API_SECRET: \
  -d became_lead_at=2020-10-18T16:13:12.109Z \
  -d customer_name=John \
  -d customer_email=john@smith.com
</code></pre>

## Response

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

| Response code | Body                     |
| ------------- | ------------------------ |
| `200`         | A referral object (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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.rewardful.com/rest-api/referrals/convert-a-referral-to-a-lead.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
