# API - Chamada API para listar Leads e Campos de Leads

## Listar todos os Leads

<mark style="color:green;">`GET`</mark> `/leads`

Endpoint completo: [https://sprinthub-api-master.sprinthub.app/leads?i=instancia](https://sprinthub-api-master.sprinthub.app/leadsadvanced?i=instancia)

i = nome da sua instância

**Body (abaixo exemplo em JSON)**

````json
{
    "data": {
        "total": 1134,
        "leads": [
            {
                "id": 2035,
                "fullname": "noreply-spamdigest via TeamDev",
                "email": "dev@sprinthub.com"
            },
            {
```

````

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |
| apitoken      | XXXXXXX            |

## Listar apenas UM Lead específico

<mark style="color:green;">`GET`</mark> `/leads/ID_DO_LEAD`

Endpoint completo: [https://sprinthub-api-master.sprinthub.app/leads/2065?i=instancia](https://sprinthub-api-master.sprinthub.app/leadsadvanced?i=instancia)

```json
{
    "data": {
        "lead": {
            "id": 2065,
            "fullname": "BRKSUEDUTHSHbvncvbn werwerwe",
            "email": null
        }
    }
}
```

## Listar TODOS os campos de apenas UM Lead específico

<mark style="color:green;">`GET`</mark> `/leads/ID_DO_LEAD&`**allFields=1**

Endpoint completo: [https://sprinthub-api-master.sprinthub.app/leads/2065?i=instancia](https://sprinthub-api-master.sprinthub.app/leadsadvanced?i=instancia)&**allFields=1**

````json
{
    "data": {
        "lead": {
            "points": 0,
            "owner": null,
            "stage": null,
            "photoUrl": "https://sprinthub.s3.amazonaws.com/unnamed_png.PNG",
            "company": null,
            "userAccess": [],
            "departmentAccess": [],
            "ignoreSubDepartments": false,
            "firstname": "BRKSUEDUTHSHbvncvbn",
            "lastname": "werwerwe",
            "email": null,
            "phone": null,
            "whatsapp": null,
            "mobile": null,
            "address": null,
            "city": null,
            "state": null,
            "country": null,
            "zipcode": null,
            "timezone": null,
```
````

.

## Listar somente ALGUNS campos de apenas UM Lead específico

<mark style="color:green;">`GET`</mark> `/leads/ID_DO_LEAD`**\&query={lead{firstname,lastname,email,mobile}}**

Endpoint completo: [https://sprinthub-api-master.sprinthub.app/leads/2065?i=instancia](https://sprinthub-api-master.sprinthub.app/leadsadvanced?i=instancia)**\&query={lead{firstname,lastname,email,mobile}}**

```json
{
    "data": {
        "lead": {
            "firstname": "BRKSUEDUTHSHbvncvbn",
            "lastname": "werwerwe",
            "email": null,
            "mobile": null
        }
    }
}

```

.

{% hint style="info" %}
Por se tratar de GRAPHQL, você só irá conseguir trazer campos específicos dos campos fixos do Lead. Para trazer os campos customizados, somente trazendo tudo com o parâmetro **\&allFields=1**
{% endhint %}


---

# 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-chamada-api-para-listar-leads-e-campos-de-leads.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.
