curl --request PATCH \
--url https://app.metricaas.com.br/v1/leads/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"etapa": "Proposta",
"campos": {
"plano": "Anual"
},
"tags_add": [
"vip"
],
"tags_remove": [
"frio"
]
}
'import requests
url = "https://app.metricaas.com.br/v1/leads/{id}"
payload = {
"etapa": "Proposta",
"campos": { "plano": "Anual" },
"tags_add": ["vip"],
"tags_remove": ["frio"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
etapa: 'Proposta',
campos: {plano: 'Anual'},
tags_add: ['vip'],
tags_remove: ['frio']
})
};
fetch('https://app.metricaas.com.br/v1/leads/{id}', 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/leads/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'etapa' => 'Proposta',
'campos' => [
'plano' => 'Anual'
],
'tags_add' => [
'vip'
],
'tags_remove' => [
'frio'
]
]),
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/leads/{id}"
payload := strings.NewReader("{\n \"etapa\": \"Proposta\",\n \"campos\": {\n \"plano\": \"Anual\"\n },\n \"tags_add\": [\n \"vip\"\n ],\n \"tags_remove\": [\n \"frio\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.metricaas.com.br/v1/leads/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"etapa\": \"Proposta\",\n \"campos\": {\n \"plano\": \"Anual\"\n },\n \"tags_add\": [\n \"vip\"\n ],\n \"tags_remove\": [\n \"frio\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.metricaas.com.br/v1/leads/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"etapa\": \"Proposta\",\n \"campos\": {\n \"plano\": \"Anual\"\n },\n \"tags_add\": [\n \"vip\"\n ],\n \"tags_remove\": [\n \"frio\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "0f6c8e1a-1b2c-4d5e-8f90-1234567890ab",
"mudou": [
"stage",
"campos.plano",
"tags"
],
"etapa": {
"de": "Lead",
"para": "Proposta"
},
"campos_ignorados": [],
"tags_ignoradas": []
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "about:blank",
"title": "Limite da API",
"status": 429,
"retry_after": 17,
"detail": "Limite de 120 escritas por minuto para este token. Tente de novo em 17 s."
}Muda etapa, campos e tags do lead, numa chamada
O lead pelo id: etapa (pelo etapa_id ou pelo nome em etapa),
campos personalizados e tags — pôr (tags_add) e tirar
(tags_remove). As regras são as de POST /v1/leads:
- Só etapa aberta. Ganho é
POST /v1/sales(cria a venda e manda o Purchase); perdido pede o motivo (ficha ou MCP). Os dois são422. Lead em Ganho/Perdido não sai da etapa pela API. - Campos só de chave que existe (
GET /v1/campos); as outras voltam emcampos_ignorados.nullou vazio limpa. Valor inválido é422e nada é gravado. - Tags só as que existem (as outras em
tags_ignoradas). A tagnao-contatarnão sai por aqui: é o pedido do lead para parar. - Campo desconhecido no corpo é
422(ostagedo upsert não vale aqui).
Webhooks: lead.updated quando algo mudou e lead.stage_changed quando a
etapa mudou. O mesmo pedido de novo responde 200 com mudou: [].
Pede crm:operate. Lead de outra empresa ou fora do alcance do token: 404.
curl --request PATCH \
--url https://app.metricaas.com.br/v1/leads/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"etapa": "Proposta",
"campos": {
"plano": "Anual"
},
"tags_add": [
"vip"
],
"tags_remove": [
"frio"
]
}
'import requests
url = "https://app.metricaas.com.br/v1/leads/{id}"
payload = {
"etapa": "Proposta",
"campos": { "plano": "Anual" },
"tags_add": ["vip"],
"tags_remove": ["frio"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
etapa: 'Proposta',
campos: {plano: 'Anual'},
tags_add: ['vip'],
tags_remove: ['frio']
})
};
fetch('https://app.metricaas.com.br/v1/leads/{id}', 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/leads/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'etapa' => 'Proposta',
'campos' => [
'plano' => 'Anual'
],
'tags_add' => [
'vip'
],
'tags_remove' => [
'frio'
]
]),
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/leads/{id}"
payload := strings.NewReader("{\n \"etapa\": \"Proposta\",\n \"campos\": {\n \"plano\": \"Anual\"\n },\n \"tags_add\": [\n \"vip\"\n ],\n \"tags_remove\": [\n \"frio\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://app.metricaas.com.br/v1/leads/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"etapa\": \"Proposta\",\n \"campos\": {\n \"plano\": \"Anual\"\n },\n \"tags_add\": [\n \"vip\"\n ],\n \"tags_remove\": [\n \"frio\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.metricaas.com.br/v1/leads/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"etapa\": \"Proposta\",\n \"campos\": {\n \"plano\": \"Anual\"\n },\n \"tags_add\": [\n \"vip\"\n ],\n \"tags_remove\": [\n \"frio\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "0f6c8e1a-1b2c-4d5e-8f90-1234567890ab",
"mudou": [
"stage",
"campos.plano",
"tags"
],
"etapa": {
"de": "Lead",
"para": "Proposta"
},
"campos_ignorados": [],
"tags_ignoradas": []
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"retry_after": 123,
"errors": [
{
"field": "<string>",
"message": "<string>"
}
]
}{
"type": "about:blank",
"title": "Limite da API",
"status": 429,
"retry_after": 17,
"detail": "Limite de 120 escritas por minuto para este token. Tente de novo em 17 s."
}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.
Headers
Opcional. A mesma chave com o mesmo pedido (método, caminho e corpo) em
24 h devolve a mesma resposta sem repetir, com
Idempotency-Replayed: true. A mesma chave com outro pedido é 422; com
o primeiro ainda rodando, 409. Só a resposta de sucesso fica guardada:
depois de um 422, corrija e repita com a mesma chave.
1 - 200"crm-7f3a-etapa-proposta"
Body
Response
Aplicado (mudou diz o que mudou; vazio = nada)