Criar lead
POST
/api/seller/external/v1/lead
curl --request POST \ "https://api.spelt.com.br/api/seller/external/v1/lead" \ --header "Authorization: Bearer splt_live_SUA_CHAVE" \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --data "{ \"name\": \"architecto\", \"kind\": \"architecto\", \"trade_name\": \"architecto\", \"phone\": \"architecto\", \"document_type\": \"architecto\", \"document_number\": \"architecto\", \"website\": \"architecto\", \"notes\": \"architecto\", \"owner_id\": \"architecto\", \"source\": \"architecto\", \"origin\": []}"const url = new URL( "https://api.spelt.com.br/api/seller/external/v1/lead");
const headers = { "Authorization": "Bearer splt_live_SUA_CHAVE", "Content-Type": "application/json", "Accept": "application/json",};
let body = { "name": "architecto", "kind": "architecto", "trade_name": "architecto", "phone": "architecto", "document_type": "architecto", "document_number": "architecto", "website": "architecto", "notes": "architecto", "owner_id": "architecto", "source": "architecto", "origin": []};
fetch(url, { method: "POST", headers, body: JSON.stringify(body),}).then(response => response.json());$client = new \GuzzleHttp\Client();$url = 'https://api.spelt.com.br/api/seller/external/v1/lead';$response = $client->post( $url, [ 'headers' => [ 'Authorization' => 'Bearer splt_live_SUA_CHAVE', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'json' => [ 'name' => 'architecto', 'kind' => 'architecto', 'trade_name' => 'architecto', 'phone' => 'architecto', 'document_type' => 'architecto', 'document_number' => 'architecto', 'website' => 'architecto', 'notes' => 'architecto', 'owner_id' => 'architecto', 'source' => 'architecto', 'origin' => [], ], ]);$body = $response->getBody();print_r(json_decode((string) $body));import requestsimport json
url = 'https://api.spelt.com.br/api/seller/external/v1/lead'payload = { "name": "architecto", "kind": "architecto", "trade_name": "architecto", "phone": "architecto", "document_type": "architecto", "document_number": "architecto", "website": "architecto", "notes": "architecto", "owner_id": "architecto", "source": "architecto", "origin": []}headers = { 'Authorization': 'Bearer splt_live_SUA_CHAVE', 'Content-Type': 'application/json', 'Accept': 'application/json'}
response = requests.request('POST', url, headers=headers, json=payload)response.json()Cadastra o lead em aberto. Se já existe uma pessoa na conta com o mesmo e-mail, telefone ou documento, responde
409 com code = person_exists e a pessoa existente em data, em vez de duplicar: use o id devolvido.
Authorizations
Seção intitulada “Authorizations”Request Bodyrequired
Seção intitulada “Request Bodyrequired”Media typeapplication/json
object
name
required
Nome completo ou razão social.
string
kind
individual (padrão) ou company.
string
trade_name
Apelido ou nome fantasia.
string
email
E-mail.
string
phone
Telefone, com DDD.
string
document_type
Tipo do documento (cpf, cnpj…).
string
document_number
Documento.
string
website
Site.
string
notes
Observação curta.
string
owner_id
ULID do usuário responsável. Padrão: o dono da chave.
string
source
Porta de entrada. Padrão: import.
string
origin
Contexto livre da entrada (canal, página, campanha).
object
Responses
Seção intitulada “Responses”Media typeapplication/json
object
data
object
object
string
id
string
name
string
status
string
source
string
Example
{ "data": { "object": "lead", "id": "01JA0000000000000000000020", "name": "Clínica Sorriso Ltda", "status": "open", "source": "import" }}Media typeapplication/json
object
message
string
code
string
Example
{ "message": "Tarefas e leads não têm modo de teste: a chave de homologação só lê. Use a chave de produção para gravar.", "code": "test_mode"}Media typeapplication/json
object
message
string
code
string
data
object
id
string
name
string
is_lead
boolean
status
string
Example
{ "message": "Já existe uma pessoa com este e-mail nesta conta.", "code": "person_exists", "data": { "id": "01JA0000000000000000000020", "name": "Clínica Sorriso", "is_lead": true, "status": "open" }}Media typeapplication/json
object
message
string
errors
object
name
Array<string>
Example
{ "message": "Erro de validação.", "errors": { "name": [ "O campo name é obrigatório." ] }}