# API - Alterando dados do Lead usando qualquer campo como referência

Geralmente, para se alterar dados de um Lead via API, você precisa saber o ID deste Lead, passar o parâmetro do ID e o parâmetro do campo que deseja alterar.

Uma maneira mais simples de fazer isso sem precisar saber o ID do lead, é usar a chamada "*leadsbyfield*".

Usando "*leadsbyfield*" você poderá buscar o Lead pelo Email, Whatsapp, Mobile, etc.. O ideal é que seja um campo ÚNICO para não correr o risco de você alterar vários Leads que possuam a mesma informação.

Vamos pegar como exemplo o Lead Bill Gates.

<figure><img src="https://lh3.googleusercontent.com/FRYaaXvmAuieWk4p5zB7fxeLXOWEuy5M3Z5dfDFcesdWdMimPw0mjjP8CLmtFpscJ5EAKUZaysZGFdQy599wQ0NIsWSkXy0MHkjoAsa3niXHZQaEK3Q6pVNtqilMqNsUVWtQVy4yaB7XraOfmiPEohs" alt=""><figcaption></figcaption></figure>

Via API, queremos alterar o primeiro nome do Bill para William. Logo, iremos usar o alias "firstname"

No exemplo do Postman abaixo:

Método = PUT

URL =  <https://sprinthub-api-master.sprinthub.app/leadsbyfield/email/billgates@teste.com?i=licenca\\&apitoken=XX>

Não esquecer de adicionar o nome da sua licença em "i" e o seu token em "apitoken".

<figure><img src="https://lh3.googleusercontent.com/RTQj8ptpHW6Orm7AbMgjdId-0ohhE-G7P1xY74Kzg6eQw9v2Nl5tHSdIxNXXjMepKkAGJjPR-dv2nsZlsVth3Iq9JHYVVx3sp10MYZ04L5WhrpQiH9Qr-HUZ58AkwoQFSJThMhHgSYsfx_Rc3dzeZME" alt=""><figcaption></figcaption></figure>

Ao executar, o retorno deverá ser **success: true**.

<figure><img src="https://lh6.googleusercontent.com/r9PhWbvezy9qNGwSlhl-hmzUm1M6wOdIP9qfIlfd7cEB2WkMS08CYBuA9QGsLejOnD6gVvpCeV_zSsrO2ZRCj-8ahBtStK7XNygBdBtYpd8eS-q8grSLy4QXl1-ajPc2GYmPxPxQNAOIKvXpeZXJfHA" alt=""><figcaption></figcaption></figure>

Agora, basta olhar o Lead e verá que o campo foi alterado:

<figure><img src="https://lh5.googleusercontent.com/BVGI_dzq1teUt5fLv8yziamPJKv3-ut-z6b7LYbP5lzUgGeu6c2eQBbLIE332OKXJYe1e_opP6HEfSOglt2NvqmLMT1M42K2831AEzqED89SUQk3ati2w88rOOQXiK1qH7V5wW4oK_6PONYLHznLZXY" alt=""><figcaption></figcaption></figure>


---

# 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://docs.sprinthub.com/topicos/api/api-alterando-dados-do-lead-usando-qualquer-campo-como-referencia.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.
