> For the complete documentation index, see [llms.txt](https://docs.sprinthub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sprinthub.com/topicos/api/api-alterando-dados-do-lead-usando-qualquer-campo-como-referencia.md).

# 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
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 dynamically by asking a question.

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

```
GET https://docs.sprinthub.com/topicos/api/api-alterando-dados-do-lead-usando-qualquer-campo-como-referencia.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
