curl --request POST \
--url https://app.metricaas.com.br/v1/funis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"nome": "Infoproduto",
"etapas": [
"Comentou",
"Abriu material",
"Lead",
"Clicou comprar",
{
"nome": "Comprou",
"tipo": "ganho"
},
"Entregue",
"Cliente recorrente",
{
"nome": "Perdido",
"tipo": "perdido"
}
]
}
'import requests
url = "https://app.metricaas.com.br/v1/funis"
payload = {
"nome": "Infoproduto",
"etapas": [
"Comentou",
"Abriu material",
"Lead",
"Clicou comprar",
{
"nome": "Comprou",
"tipo": "ganho"
},
"Entregue",
"Cliente recorrente",
{
"nome": "Perdido",
"tipo": "perdido"
}
]
}
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({
nome: 'Infoproduto',
etapas: [
'Comentou',
'Abriu material',
'Lead',
'Clicou comprar',
{nome: 'Comprou', tipo: 'ganho'},
'Entregue',
'Cliente recorrente',
{nome: 'Perdido', tipo: 'perdido'}
]
})
};
fetch('https://app.metricaas.com.br/v1/funis', 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://app.metricaas.com.br/v1/funis",
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([
'nome' => 'Infoproduto',
'etapas' => [
'Comentou',
'Abriu material',
'Lead',
'Clicou comprar',
[
'nome' => 'Comprou',
'tipo' => 'ganho'
],
'Entregue',
'Cliente recorrente',
[
'nome' => 'Perdido',
'tipo' => 'perdido'
]
]
]),
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://app.metricaas.com.br/v1/funis"
payload := strings.NewReader("{\n \"nome\": \"Infoproduto\",\n \"etapas\": [\n \"Comentou\",\n \"Abriu material\",\n \"Lead\",\n \"Clicou comprar\",\n {\n \"nome\": \"Comprou\",\n \"tipo\": \"ganho\"\n },\n \"Entregue\",\n \"Cliente recorrente\",\n {\n \"nome\": \"Perdido\",\n \"tipo\": \"perdido\"\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://app.metricaas.com.br/v1/funis")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"nome\": \"Infoproduto\",\n \"etapas\": [\n \"Comentou\",\n \"Abriu material\",\n \"Lead\",\n \"Clicou comprar\",\n {\n \"nome\": \"Comprou\",\n \"tipo\": \"ganho\"\n },\n \"Entregue\",\n \"Cliente recorrente\",\n {\n \"nome\": \"Perdido\",\n \"tipo\": \"perdido\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.metricaas.com.br/v1/funis")
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 \"nome\": \"Infoproduto\",\n \"etapas\": [\n \"Comentou\",\n \"Abriu material\",\n \"Lead\",\n \"Clicou comprar\",\n {\n \"nome\": \"Comprou\",\n \"tipo\": \"ganho\"\n },\n \"Entregue\",\n \"Cliente recorrente\",\n {\n \"nome\": \"Perdido\",\n \"tipo\": \"perdido\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"nome": "<string>",
"posicao": 123,
"principal": true,
"etapas": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"nome": "<string>",
"posicao": 123,
"tipo": "aberta"
}
],
"criado": true,
"avisos": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}Cria um funil (com as etapas do pedido)
Com etapas, o funil nasce exatamente com elas, na ordem; a primeira
é a de entrada e tem de ser aberta. Sem etapas, nasce com as padrão
da tela (Novo → Em contato → Qualificado → Proposta → Ganho · Perdido).
Já existe um funil com o nome (sem caixa) e com todas as etapas pedidas,
do mesmo tipo: 200 com criado: false. Falta alguma: 409 (crie com
POST /v1/funis/{id}/etapas). Sem etapa de ganho, a resposta avisa:
uma venda de um lead desse funil não o move.
curl --request POST \
--url https://app.metricaas.com.br/v1/funis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"nome": "Infoproduto",
"etapas": [
"Comentou",
"Abriu material",
"Lead",
"Clicou comprar",
{
"nome": "Comprou",
"tipo": "ganho"
},
"Entregue",
"Cliente recorrente",
{
"nome": "Perdido",
"tipo": "perdido"
}
]
}
'import requests
url = "https://app.metricaas.com.br/v1/funis"
payload = {
"nome": "Infoproduto",
"etapas": [
"Comentou",
"Abriu material",
"Lead",
"Clicou comprar",
{
"nome": "Comprou",
"tipo": "ganho"
},
"Entregue",
"Cliente recorrente",
{
"nome": "Perdido",
"tipo": "perdido"
}
]
}
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({
nome: 'Infoproduto',
etapas: [
'Comentou',
'Abriu material',
'Lead',
'Clicou comprar',
{nome: 'Comprou', tipo: 'ganho'},
'Entregue',
'Cliente recorrente',
{nome: 'Perdido', tipo: 'perdido'}
]
})
};
fetch('https://app.metricaas.com.br/v1/funis', 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://app.metricaas.com.br/v1/funis",
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([
'nome' => 'Infoproduto',
'etapas' => [
'Comentou',
'Abriu material',
'Lead',
'Clicou comprar',
[
'nome' => 'Comprou',
'tipo' => 'ganho'
],
'Entregue',
'Cliente recorrente',
[
'nome' => 'Perdido',
'tipo' => 'perdido'
]
]
]),
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://app.metricaas.com.br/v1/funis"
payload := strings.NewReader("{\n \"nome\": \"Infoproduto\",\n \"etapas\": [\n \"Comentou\",\n \"Abriu material\",\n \"Lead\",\n \"Clicou comprar\",\n {\n \"nome\": \"Comprou\",\n \"tipo\": \"ganho\"\n },\n \"Entregue\",\n \"Cliente recorrente\",\n {\n \"nome\": \"Perdido\",\n \"tipo\": \"perdido\"\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://app.metricaas.com.br/v1/funis")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"nome\": \"Infoproduto\",\n \"etapas\": [\n \"Comentou\",\n \"Abriu material\",\n \"Lead\",\n \"Clicou comprar\",\n {\n \"nome\": \"Comprou\",\n \"tipo\": \"ganho\"\n },\n \"Entregue\",\n \"Cliente recorrente\",\n {\n \"nome\": \"Perdido\",\n \"tipo\": \"perdido\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.metricaas.com.br/v1/funis")
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 \"nome\": \"Infoproduto\",\n \"etapas\": [\n \"Comentou\",\n \"Abriu material\",\n \"Lead\",\n \"Clicou comprar\",\n {\n \"nome\": \"Comprou\",\n \"tipo\": \"ganho\"\n },\n \"Entregue\",\n \"Cliente recorrente\",\n {\n \"nome\": \"Perdido\",\n \"tipo\": \"perdido\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"nome": "<string>",
"posicao": 123,
"principal": true,
"etapas": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"nome": "<string>",
"posicao": 123,
"tipo": "aberta"
}
],
"criado": true,
"avisos": [
"<string>"
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}Authorizations
Authorization: Bearer mcp_… — gere em Configurações → Tokens de API.
O token de API tem modo read ou write. Um token read responde 403
a qualquer verbo que não seja GET. As capacidades do token são a
interseção com as da pessoa de quem ele herda o papel: se ela perder
acesso na grade de Equipe, o token perde junto, sem ninguém revogar nada.
Token de agência (gerado no console da agência): vale para as
empresas da agência, e a empresa de cada chamada vai no header
X-Empresa: <slug da empresa>. Sem o header, 401. Num token de
empresa o header é opcional e, se vier, tem de ser a própria empresa. O
modo read vale igual: um token de agência de leitura só faz GET —
é o token para pôr numa função que só consulta.
Body
Response
Já existia com essas etapas (criado: false)