IAGENTE SDR REST API

Integrate your CRM, ERP or automations with the IAGENTE SDR platform. Manage leads, send messages and receive events in real time.

Base URL

https://lp.webpro.com.br/api/v1

Version

v1.0.0

Format

JSON

Quick Start

1

Create an API Key

Go to API Keys in the dashboard and create your first key.

2

Set up authentication

Add your API Key to the Authorization header of all requests.

3

Make your first request

Use the example below to list your leads.

curl -X GET "https://lp.webpro.com.br/api/v1/leads" \
  -H "Authorization: Bearer sk_live_sua_chave_aqui" \
  -H "Content-Type: application/json"
import requests

response = requests.get(
    "https://lp.webpro.com.br/api/v1/leads",
    headers={"Authorization": "Bearer sk_live_sua_chave_aqui"}
)
leads = response.json()
const response = await fetch("https://lp.webpro.com.br/api/v1/leads", {
    headers: {
        "Authorization": "Bearer sk_live_sua_chave_aqui"
    }
});
const leads = await response.json();
$ch = curl_init("https://lp.webpro.com.br/api/v1/leads");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer sk_live_sua_chave_aqui"
    ]
]);
$leads = json_decode(curl_exec($ch), true);
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer sk_live_sua_chave_aqui");

var response = await client.GetAsync("https://lp.webpro.com.br/api/v1/leads");
var leads = await response.Content.ReadAsStringAsync();

Authentication

The API uses API Keys for authentication. Include your key in all requests using one of the methods below:

Authorization Header (Recommended)

Authorization: Bearer sk_live_xxxxxxxxxxxxx

X-API-Key Header (Alternative)

X-API-Key: sk_live_xxxxxxxxxxxxx

Keep your API Key secure

Never expose your API Key in client-side code, public repositories or logs. If compromised, regenerate the key immediately.

Errors

The API uses standard HTTP codes to indicate request success or failure.

Code Description
400 Bad request - Check the parameters sent
401 Unauthorized - Invalid or missing API Key
404 Not found - The requested resource does not exist
409 Conflict - The resource already exists (e.g., duplicate lead)
422 Unprocessable entity - Invalid data
429 Too many requests - Rate limit exceeded
500 Internal error - Something went wrong on the server
Error Format
{
  "error": {
    "code": "validation_error",
    "message": "The given data was invalid.",
    "details": {
      "phone": ["O campo phone é obrigatório."]
    }
  }
}

Rate Limits

To ensure API stability, we apply request limits:

60

requests per minute

10.000

requests per day

The X-RateLimit-Limit and X-RateLimit-Remaining headers indicate your current usage.

Leads

GET /api/v1/leads List leads

Returns a paginated list of leads from your organization.

Query Parameters

Parameter Type Description
page integer Page number (default: 1)
per_page integer Items per page (default: 25, max: 100)
phone string Filter by phone
email string Filter by email
temperature string hot, warm, cool, cold, frozen
sort string Sort field (prefix - for desc)
Response
{
  "data": [
    {
      "id": 123,
      "phone": "5511999999999",
      "name": "Joao Silva",
      "email": "joao@empresa.com",
      "company_name": "Empresa LTDA",
      "temperature": "hot",
      "lead_score": 85
    }
  ],
  "meta": {
    "current_page": 1,
    "per_page": 25,
    "total": 150,
    "total_pages": 6
  }
}
POST /api/v1/leads Create lead

Creates a new lead in your organization.

Body Parameters

Field Type Required Description
phone string Yes Phone with area code
name string No Contact name
email string No Contact email
company_name string No Company name
deal_value number No Deal value
curl -X POST "https://lp.webpro.com.br/api/v1/leads" \
  -H "Authorization: Bearer sk_live_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "11999999999",
    "name": "Maria Santos",
    "email": "maria@empresa.com",
    "company_name": "Tech Corp",
    "deal_value": 15000
  }'
import requests

response = requests.post(
    "https://lp.webpro.com.br/api/v1/leads",
    headers={"Authorization": "Bearer sk_live_sua_chave"},
    json={
        "phone": "11999999999",
        "name": "Maria Santos",
        "email": "maria@empresa.com",
        "company_name": "Tech Corp",
        "deal_value": 15000
    }
)
lead = response.json()
const response = await fetch("https://lp.webpro.com.br/api/v1/leads", {
    method: "POST",
    headers: {
        "Authorization": "Bearer sk_live_sua_chave",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        phone: "11999999999",
        name: "Maria Santos",
        email: "maria@empresa.com",
        company_name: "Tech Corp",
        deal_value: 15000
    })
});
const lead = await response.json();
$ch = curl_init("https://lp.webpro.com.br/api/v1/leads");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer sk_live_sua_chave",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "phone" => "11999999999",
        "name" => "Maria Santos",
        "email" => "maria@empresa.com",
        "company_name" => "Tech Corp",
        "deal_value" => 15000
    ])
]);
$lead = json_decode(curl_exec($ch), true);
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer sk_live_sua_chave");

var payload = new {
    phone = "11999999999",
    name = "Maria Santos",
    email = "maria@empresa.com",
    company_name = "Tech Corp",
    deal_value = 15000
};

var response = await client.PostAsync(
    "https://lp.webpro.com.br/api/v1/leads",
    new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json")
);
var lead = await response.Content.ReadAsStringAsync();
GET /api/v1/leads/{id} Get lead

Returns the details of a specific lead.

PUT /api/v1/leads/{id} Update lead

Updates an existing lead.

DELETE /api/v1/leads/{id} Delete lead

Removes a lead from your organization.

WhatsApp

Send messages via WhatsApp Business API. Supports texts, HSM templates, images, videos, documents and audios.

POST /api/v1/whatsapp/messages Send WhatsApp message

Message Types

text template image video document audio

Body Parameters

Field Type Description
integration_id required integer WhatsApp integration ID to use
lead_id integer Lead ID (or use phone)
phone string Phone (or use lead_id)
type string text, template, image, video, document, audio
text string Message text (for type=text)
template_id integer Template ID (for type=template)
template_name string Template name (alternative to ID)
variables array Template variables ["value1", "value2"]
media_url string Media URL (for media types)
caption string Media caption (optional)
filename string File name (for document)
# Enviar texto
curl -X POST "https://lp.webpro.com.br/api/v1/whatsapp/messages" \
  -H "Authorization: Bearer sk_live_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{
    "integration_id": 1,
    "phone": "5511999999999",
    "type": "text",
    "text": "Ola! Como posso ajudar?"
  }'

# Enviar template
curl -X POST "https://lp.webpro.com.br/api/v1/whatsapp/messages" \
  -H "Authorization: Bearer sk_live_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{
    "integration_id": 1,
    "phone": "5511999999999",
    "type": "template",
    "template_name": "boas_vindas",
    "variables": ["Joao"]
  }'
import requests

# Enviar texto
response = requests.post(
    "https://lp.webpro.com.br/api/v1/whatsapp/messages",
    headers={"Authorization": "Bearer sk_live_sua_chave"},
    json={
        "integration_id": 1,
        "phone": "5511999999999",
        "type": "text",
        "text": "Ola! Como posso ajudar?"
    }
)

# Enviar template
response = requests.post(
    "https://lp.webpro.com.br/api/v1/whatsapp/messages",
    headers={"Authorization": "Bearer sk_live_sua_chave"},
    json={
        "integration_id": 1,
        "phone": "5511999999999",
        "type": "template",
        "template_name": "boas_vindas",
        "variables": ["Joao"]
    }
)
// Enviar texto
const response = await fetch("https://lp.webpro.com.br/api/v1/whatsapp/messages", {
    method: "POST",
    headers: {
        "Authorization": "Bearer sk_live_sua_chave",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        integration_id: 1,
        phone: "5511999999999",
        type: "text",
        text: "Ola! Como posso ajudar?"
    })
});

// Enviar template
const response = await fetch("https://lp.webpro.com.br/api/v1/whatsapp/messages", {
    method: "POST",
    headers: {
        "Authorization": "Bearer sk_live_sua_chave",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        integration_id: 1,
        phone: "5511999999999",
        type: "template",
        template_name: "boas_vindas",
        variables: ["Joao"]
    })
});
// Enviar texto
$ch = curl_init("https://lp.webpro.com.br/api/v1/whatsapp/messages");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer sk_live_sua_chave",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "integration_id" => 1,
        "phone" => "5511999999999",
        "type" => "text",
        "text" => "Ola! Como posso ajudar?"
    ])
]);
$result = json_decode(curl_exec($ch), true);

// Enviar template
$payload = [
    "integration_id" => 1,
    "phone" => "5511999999999",
    "type" => "template",
    "template_name" => "boas_vindas",
    "variables" => ["Joao"]
];

Specific Errors

HTTP Code Description
422 validation_error integration_id not provided or invalid
404 integration_not_found WhatsApp integration not found or inactive
404 not_found Lead not found
500 send_failed Failed to send the WhatsApp message
GET /api/v1/whatsapp/templates List templates

Lists the HSM templates approved by Meta for your WhatsApp Business account.

RCS (Rich Communication Services)

Send rich messages via RCS with cards, carousels, buttons and quick replies. Offers a more interactive experience than traditional SMS.

POST /api/v1/rcs/messages Send RCS message

Message Types

text file card carousel replyable_text location

Body Parameters

Field Type Description
lead_id integer Lead ID (or use phone)
phone string Phone (or use lead_id)
type string text, file, card, carousel, replyable_text, location
Text (type=text)
text string Message text (max: 4096 characters)
File (type=file)
file_url string File URL (image, video, document)
mime_type string MIME type (e.g.: image/jpeg, video/mp4)
Card (type=card)
title string Card title (max: 200 characters)
description string Card description
media_url string Card image URL
buttons array Card buttons (max: 4)
Carousel (type=carousel)
cards array Array of cards (min: 2, max: 10)
card_width string SMALL or MEDIUM (default: MEDIUM)
Text with Quick Replies (type=replyable_text)
text string Message text
quick_replies array Quick reply buttons (max: 11)
Location (type=location)
latitude number Latitude (-90 to 90)
longitude number Longitude (-180 to 180)
label string Location name (optional)
curl -X POST "https://lp.webpro.com.br/api/v1/rcs/messages" \
  -H "Authorization: Bearer sk_live_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "5511999999999",
    "type": "text",
    "text": "Ola! Como posso ajudar?"
  }'
import requests

response = requests.post(
    "https://lp.webpro.com.br/api/v1/rcs/messages",
    headers={"Authorization": "Bearer sk_live_sua_chave"},
    json={
        "phone": "5511999999999",
        "type": "text",
        "text": "Ola! Como posso ajudar?"
    }
)
const response = await fetch("https://lp.webpro.com.br/api/v1/rcs/messages", {
    method: "POST",
    headers: {
        "Authorization": "Bearer sk_live_sua_chave",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        phone: "5511999999999",
        type: "text",
        text: "Ola! Como posso ajudar?"
    })
});
curl -X POST "https://lp.webpro.com.br/api/v1/rcs/messages" \
  -H "Authorization: Bearer sk_live_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "5511999999999",
    "type": "card",
    "title": "Produto em Destaque",
    "description": "Confira nossa oferta especial!",
    "media_url": "https://exemplo.com/imagem.jpg",
    "buttons": [
      {"type": "url", "text": "Ver Mais", "url": "https://exemplo.com"},
      {"type": "call", "text": "Ligar", "phone_number": "+5511999999999"}
    ]
  }'
import requests

response = requests.post(
    "https://lp.webpro.com.br/api/v1/rcs/messages",
    headers={"Authorization": "Bearer sk_live_sua_chave"},
    json={
        "phone": "5511999999999",
        "type": "card",
        "title": "Produto em Destaque",
        "description": "Confira nossa oferta especial!",
        "media_url": "https://exemplo.com/imagem.jpg",
        "buttons": [
            {"type": "url", "text": "Ver Mais", "url": "https://exemplo.com"},
            {"type": "call", "text": "Ligar", "phone_number": "+5511999999999"}
        ]
    }
)
const response = await fetch("https://lp.webpro.com.br/api/v1/rcs/messages", {
    method: "POST",
    headers: {
        "Authorization": "Bearer sk_live_sua_chave",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        phone: "5511999999999",
        type: "card",
        title: "Produto em Destaque",
        description: "Confira nossa oferta especial!",
        media_url: "https://exemplo.com/imagem.jpg",
        buttons: [
            {type: "url", text: "Ver Mais", url: "https://exemplo.com"},
            {type: "call", text: "Ligar", phone_number: "+5511999999999"}
        ]
    })
});
curl -X POST "https://lp.webpro.com.br/api/v1/rcs/messages" \
  -H "Authorization: Bearer sk_live_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "5511999999999",
    "type": "carousel",
    "card_width": "MEDIUM",
    "cards": [
      {
        "title": "Produto A",
        "description": "Descricao do produto A",
        "media_url": "https://exemplo.com/a.jpg",
        "buttons": [{"type": "url", "text": "Comprar", "url": "https://exemplo.com/a"}]
      },
      {
        "title": "Produto B",
        "description": "Descricao do produto B",
        "media_url": "https://exemplo.com/b.jpg",
        "buttons": [{"type": "url", "text": "Comprar", "url": "https://exemplo.com/b"}]
      }
    ]
  }'
import requests

response = requests.post(
    "https://lp.webpro.com.br/api/v1/rcs/messages",
    headers={"Authorization": "Bearer sk_live_sua_chave"},
    json={
        "phone": "5511999999999",
        "type": "carousel",
        "card_width": "MEDIUM",
        "cards": [
            {
                "title": "Produto A",
                "description": "Descricao do produto A",
                "media_url": "https://exemplo.com/a.jpg",
                "buttons": [{"type": "url", "text": "Comprar", "url": "https://exemplo.com/a"}]
            },
            {
                "title": "Produto B",
                "description": "Descricao do produto B",
                "media_url": "https://exemplo.com/b.jpg",
                "buttons": [{"type": "url", "text": "Comprar", "url": "https://exemplo.com/b"}]
            }
        ]
    }
)
const response = await fetch("https://lp.webpro.com.br/api/v1/rcs/messages", {
    method: "POST",
    headers: {
        "Authorization": "Bearer sk_live_sua_chave",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        phone: "5511999999999",
        type: "carousel",
        card_width: "MEDIUM",
        cards: [
            {
                title: "Produto A",
                description: "Descricao do produto A",
                media_url: "https://exemplo.com/a.jpg",
                buttons: [{type: "url", text: "Comprar", url: "https://exemplo.com/a"}]
            },
            {
                title: "Produto B",
                description: "Descricao do produto B",
                media_url: "https://exemplo.com/b.jpg",
                buttons: [{type: "url", text: "Comprar", url: "https://exemplo.com/b"}]
            }
        ]
    })
});
curl -X POST "https://lp.webpro.com.br/api/v1/rcs/messages" \
  -H "Authorization: Bearer sk_live_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "5511999999999",
    "type": "replyable_text",
    "text": "Qual opcao voce prefere?",
    "quick_replies": [
      {"text": "Opcao A", "payload": "option_a"},
      {"text": "Opcao B", "payload": "option_b"},
      {"text": "Falar com atendente", "payload": "human"}
    ]
  }'
import requests

response = requests.post(
    "https://lp.webpro.com.br/api/v1/rcs/messages",
    headers={"Authorization": "Bearer sk_live_sua_chave"},
    json={
        "phone": "5511999999999",
        "type": "replyable_text",
        "text": "Qual opcao voce prefere?",
        "quick_replies": [
            {"text": "Opcao A", "payload": "option_a"},
            {"text": "Opcao B", "payload": "option_b"},
            {"text": "Falar com atendente", "payload": "human"}
        ]
    }
)
const response = await fetch("https://lp.webpro.com.br/api/v1/rcs/messages", {
    method: "POST",
    headers: {
        "Authorization": "Bearer sk_live_sua_chave",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        phone: "5511999999999",
        type: "replyable_text",
        text: "Qual opcao voce prefere?",
        quick_replies: [
            {text: "Opcao A", payload: "option_a"},
            {text: "Opcao B", payload: "option_b"},
            {text: "Falar com atendente", payload: "human"}
        ]
    })
});

Templates

GET /api/v1/whatsapp/templates List templates

Returns available message templates for use.

Query Parameters

category Filter by category
context Filter by context
meta_approved Meta approved only (true/false)

Webhooks

Configure Webhooks to receive real-time notifications about events in your account.

POST /api/v1/webhooks Create webhook

Registers a new webhook to receive events.

curl -X POST "https://lp.webpro.com.br/api/v1/webhooks" \
  -H "Authorization: Bearer sk_live_sua_chave" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Meu Webhook",
    "url": "https://meusite.com/webhook",
    "events": ["lead.created", "lead.qualified", "message.received"]
  }'
import requests

response = requests.post(
    "https://lp.webpro.com.br/api/v1/webhooks",
    headers={"Authorization": "Bearer sk_live_sua_chave"},
    json={
        "name": "Meu Webhook",
        "url": "https://meusite.com/webhook",
        "events": ["lead.created", "lead.qualified", "message.received"]
    }
)
webhook = response.json()
# Guarde o signing_secret retornado!
const response = await fetch("https://lp.webpro.com.br/api/v1/webhooks", {
    method: "POST",
    headers: {
        "Authorization": "Bearer sk_live_sua_chave",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        name: "Meu Webhook",
        url: "https://meusite.com/webhook",
        events: ["lead.created", "lead.qualified", "message.received"]
    })
});
const webhook = await response.json();
// Guarde o signing_secret retornado!
$ch = curl_init("https://lp.webpro.com.br/api/v1/webhooks");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer sk_live_sua_chave",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "name" => "Meu Webhook",
        "url" => "https://meusite.com/webhook",
        "events" => ["lead.created", "lead.qualified", "message.received"]
    ])
]);
$webhook = json_decode(curl_exec($ch), true);
// Guarde o signing_secret retornado!
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer sk_live_sua_chave");

var payload = new {
    name = "Meu Webhook",
    url = "https://meusite.com/webhook",
    events = new[] { "lead.created", "lead.qualified", "message.received" }
};

var response = await client.PostAsync(
    "https://lp.webpro.com.br/api/v1/webhooks",
    new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json")
);
var webhook = await response.Content.ReadAsStringAsync();
// Guarde o signing_secret retornado!

Important: Save the returned signing_secret. It is used to validate incoming requests.

GET /api/v1/webhooks List webhooks

Returns all configured webhooks.

POST /api/v1/webhooks/{id}/test Test webhook

Sends a test event to the webhook.

Webhook Events

Event Description
lead.created A new lead was created
lead.updated A lead was updated
lead.qualified A lead was qualified
message.received A message was received
message.sent A message was sent
handoff.created A handoff was created
handoff.closed A handoff was closed

Verify Signature

Validate the X-Webhook-Signature header to ensure the request was sent by IAGENTE.

$payload = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'];
$secret = 'whsec_seu_secret_aqui';

$expected = 'sha256=' . hash_hmac('sha256', $payload, $secret);

if (hash_equals($expected, $signature)) {
    // Assinatura valida - processar evento
    $event = json_decode($payload, true);
} else {
    // Assinatura invalida - rejeitar
    http_response_code(401);
}
import hmac
import hashlib
from flask import request, abort

def verify_webhook():
    payload = request.get_data()
    signature = request.headers.get('X-Webhook-Signature')
    secret = 'whsec_seu_secret_aqui'

    expected = 'sha256=' + hmac.new(
        secret.encode(),
        payload,
        hashlib.sha256
    ).hexdigest()

    if hmac.compare_digest(expected, signature):
        # Assinatura valida - processar evento
        event = request.get_json()
        return event
    else:
        # Assinatura invalida - rejeitar
        abort(401)
const crypto = require('crypto');

function verifyWebhook(req) {
    const payload = req.rawBody; // Buffer do body
    const signature = req.headers['x-webhook-signature'];
    const secret = 'whsec_seu_secret_aqui';

    const expected = 'sha256=' + crypto
        .createHmac('sha256', secret)
        .update(payload)
        .digest('hex');

    if (crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature))) {
        // Assinatura valida - processar evento
        const event = JSON.parse(payload);
        return event;
    } else {
        // Assinatura invalida - rejeitar
        throw new Error('Invalid signature');
    }
}
using System.Security.Cryptography;
using System.Text;

public bool VerifyWebhook(string payload, string signature)
{
    var secret = "whsec_seu_secret_aqui";

    using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
    var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(payload));
    var expected = "sha256=" + BitConverter.ToString(hash).Replace("-", "").ToLower();

    if (CryptographicOperations.FixedTimeEquals(
        Encoding.UTF8.GetBytes(expected),
        Encoding.UTF8.GetBytes(signature)))
    {
        // Assinatura valida - processar evento
        return true;
    }

    // Assinatura invalida - rejeitar
    return false;
}