Iniciar lead
POST
/api/v1/smartflow/leads
Cria um lead no fluxo informado e retorna o primeiro passo e a nextStepUrl a chamar. O campo externalId funciona como chave de idempotência: repetir a chamada com o mesmo valor retorna o lead já criado. Se prefill trouxer dados de identidade (name, nationalId, birthDate), é obrigatório enviar acceptedTerms: true; caso contrário a resposta é 400 com o código terms_required. Os campos utm e metadata são gravados no lead e devolvidos nas leituras de status e no webhook.
Authorizations
Authentication v2
For more details, see Authentication v2
Type
HTTP (bearer)
Request Body
application/json
JSON "flowId": "string", "externalId": "string", "acceptedTerms": true, "prefill": { "name": "string", "nationalId": "string", "birthDate": "string", "phone": "string", "email": "string" }, "utm": { "additionalProperties": "string" }, "metadata": { "additionalProperties": "string" }
{
}
Responses
Lead criado (ou lead existente, quando externalId já foi usado).
application/json
JSON "leadId": "lead_01HZX", "status": "in_progress", "step": "email", "nextStep": "phone", "nextStepUrl": "/api/v1/smartflow/leads/lead_01HZX/phone", "progress": 40, "finished": false
{
}