curl --request POST \
--url https://public-api.beeven.com.br/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Maria Souza",
"phone_number": "+5511987654321",
"email": "[email protected]",
"custom_fields": [
{
"key": "cpf",
"value": "123.456.789-09"
}
]
}
'import requests
url = "https://public-api.beeven.com.br/v1/contacts"
payload = {
"name": "Maria Souza",
"phone_number": "+5511987654321",
"email": "[email protected]",
"custom_fields": [
{
"key": "cpf",
"value": "123.456.789-09"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Maria Souza',
phone_number: '+5511987654321',
email: '[email protected]',
custom_fields: [{key: 'cpf', value: '123.456.789-09'}]
})
};
fetch('https://public-api.beeven.com.br/v1/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public-api.beeven.com.br/v1/contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Maria Souza',
'phone_number' => '+5511987654321',
'email' => '[email protected]',
'custom_fields' => [
[
'key' => 'cpf',
'value' => '123.456.789-09'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-api.beeven.com.br/v1/contacts"
payload := strings.NewReader("{\n \"name\": \"Maria Souza\",\n \"phone_number\": \"+5511987654321\",\n \"email\": \"[email protected]\",\n \"custom_fields\": [\n {\n \"key\": \"cpf\",\n \"value\": \"123.456.789-09\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public-api.beeven.com.br/v1/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Maria Souza\",\n \"phone_number\": \"+5511987654321\",\n \"email\": \"[email protected]\",\n \"custom_fields\": [\n {\n \"key\": \"cpf\",\n \"value\": \"123.456.789-09\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.beeven.com.br/v1/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Maria Souza\",\n \"phone_number\": \"+5511987654321\",\n \"email\": \"[email protected]\",\n \"custom_fields\": [\n {\n \"key\": \"cpf\",\n \"value\": \"123.456.789-09\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"phone_number": "<string>",
"email": "<string>",
"custom_fields": [
{
"field_id": 123,
"key": "<string>",
"value": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "invalid_parameter",
"message": "O parâmetro limit deve ser um número inteiro de 1 a 100.",
"doc_url": "https://docs.beeven.com.br/erros#invalid_parameter"
}
}{
"error": {
"code": "invalid_api_key",
"message": "Chave de API ausente, inválida ou revogada.",
"doc_url": "https://docs.beeven.com.br/erros#invalid_api_key"
}
}{
"error": {
"code": "subscription_inactive",
"message": "Sua assinatura está com pagamento em atraso. Regularize para continuar.",
"doc_url": "https://docs.beeven.com.br/erros#subscription_inactive"
}
}{
"error": {
"code": "insufficient_scope",
"message": "Esta chave não tem o escopo leads:read.",
"doc_url": "https://docs.beeven.com.br/erros#insufficient_scope"
}
}{
"error": {
"code": "not_found",
"message": "Recurso não encontrado.",
"doc_url": "https://docs.beeven.com.br/erros#not_found"
}
}{
"error": {
"code": "contact_already_exists",
"message": "Já existe um contato com este telefone ou e-mail. Envie contact_id para criar o lead nele.",
"doc_url": "https://docs.beeven.com.br/erros#contact_already_exists",
"contact_id": 554
}
}{
"error": {
"code": "validation_failed",
"message": "Preencha os campos obrigatórios desta etapa.",
"doc_url": "https://docs.beeven.com.br/erros#validation_failed",
"fields": {
"custom_fields.orcamento": [
"Este campo é obrigatório."
]
}
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Muitas requisições por segundo para esta chave. Aguarde um instante e tente novamente.",
"doc_url": "https://docs.beeven.com.br/erros#rate_limit_exceeded"
}
}Criar um contato
Cria um contato. Como em qualquer canal do Beeven, o novo contato ganha automaticamente um lead
no funil principal da empresa, alguns segundos depois. Para escolher o funil, a etapa ou o
responsável, crie o contato junto com o lead em POST /v1/leads.
Se o telefone ou o e-mail já pertencem a um contato, a resposta é 409 contact_already_exists
com o contact_id dele. Nada é mesclado.
Aceita Idempotency-Key. Escopo exigido: contacts:write.
curl --request POST \
--url https://public-api.beeven.com.br/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Maria Souza",
"phone_number": "+5511987654321",
"email": "[email protected]",
"custom_fields": [
{
"key": "cpf",
"value": "123.456.789-09"
}
]
}
'import requests
url = "https://public-api.beeven.com.br/v1/contacts"
payload = {
"name": "Maria Souza",
"phone_number": "+5511987654321",
"email": "[email protected]",
"custom_fields": [
{
"key": "cpf",
"value": "123.456.789-09"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Maria Souza',
phone_number: '+5511987654321',
email: '[email protected]',
custom_fields: [{key: 'cpf', value: '123.456.789-09'}]
})
};
fetch('https://public-api.beeven.com.br/v1/contacts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public-api.beeven.com.br/v1/contacts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Maria Souza',
'phone_number' => '+5511987654321',
'email' => '[email protected]',
'custom_fields' => [
[
'key' => 'cpf',
'value' => '123.456.789-09'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-api.beeven.com.br/v1/contacts"
payload := strings.NewReader("{\n \"name\": \"Maria Souza\",\n \"phone_number\": \"+5511987654321\",\n \"email\": \"[email protected]\",\n \"custom_fields\": [\n {\n \"key\": \"cpf\",\n \"value\": \"123.456.789-09\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://public-api.beeven.com.br/v1/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Maria Souza\",\n \"phone_number\": \"+5511987654321\",\n \"email\": \"[email protected]\",\n \"custom_fields\": [\n {\n \"key\": \"cpf\",\n \"value\": \"123.456.789-09\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.beeven.com.br/v1/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Maria Souza\",\n \"phone_number\": \"+5511987654321\",\n \"email\": \"[email protected]\",\n \"custom_fields\": [\n {\n \"key\": \"cpf\",\n \"value\": \"123.456.789-09\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"phone_number": "<string>",
"email": "<string>",
"custom_fields": [
{
"field_id": 123,
"key": "<string>",
"value": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "invalid_parameter",
"message": "O parâmetro limit deve ser um número inteiro de 1 a 100.",
"doc_url": "https://docs.beeven.com.br/erros#invalid_parameter"
}
}{
"error": {
"code": "invalid_api_key",
"message": "Chave de API ausente, inválida ou revogada.",
"doc_url": "https://docs.beeven.com.br/erros#invalid_api_key"
}
}{
"error": {
"code": "subscription_inactive",
"message": "Sua assinatura está com pagamento em atraso. Regularize para continuar.",
"doc_url": "https://docs.beeven.com.br/erros#subscription_inactive"
}
}{
"error": {
"code": "insufficient_scope",
"message": "Esta chave não tem o escopo leads:read.",
"doc_url": "https://docs.beeven.com.br/erros#insufficient_scope"
}
}{
"error": {
"code": "not_found",
"message": "Recurso não encontrado.",
"doc_url": "https://docs.beeven.com.br/erros#not_found"
}
}{
"error": {
"code": "contact_already_exists",
"message": "Já existe um contato com este telefone ou e-mail. Envie contact_id para criar o lead nele.",
"doc_url": "https://docs.beeven.com.br/erros#contact_already_exists",
"contact_id": 554
}
}{
"error": {
"code": "validation_failed",
"message": "Preencha os campos obrigatórios desta etapa.",
"doc_url": "https://docs.beeven.com.br/erros#validation_failed",
"fields": {
"custom_fields.orcamento": [
"Este campo é obrigatório."
]
}
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Muitas requisições por segundo para esta chave. Aguarde um instante e tente novamente.",
"doc_url": "https://docs.beeven.com.br/erros#rate_limit_exceeded"
}
}Autorizações
Chave de API da empresa, enviada como Authorization: Bearer bv_live_....
A chave completa é exibida uma única vez, logo depois de criada. Guarde-a num cofre de segredos e nunca a coloque em código que rode no navegador ou no celular do cliente final. Se ela vazar, revogue-a em Configurações → Desenvolvedores e crie outra.
Cabeçalhos
Corpo
Resposta
O contato criado.