curl --request POST \
--url https://app.metricaas.com.br/v1/sales \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": 67,
"sold_at": "2026-08-07T11:49:12-03:00",
"currency": "BRL",
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_source": "hotmart",
"external_id": "HP2346486658"
}
'import requests
url = "https://app.metricaas.com.br/v1/sales"
payload = {
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": 67,
"sold_at": "2026-08-07T11:49:12-03:00",
"currency": "BRL",
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_source": "hotmart",
"external_id": "HP2346486658"
}
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({
lead_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
value: 67,
sold_at: '2026-08-07T11:49:12-03:00',
currency: 'BRL',
product_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
external_source: 'hotmart',
external_id: 'HP2346486658'
})
};
fetch('https://app.metricaas.com.br/v1/sales', 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/sales",
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([
'lead_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'value' => 67,
'sold_at' => '2026-08-07T11:49:12-03:00',
'currency' => 'BRL',
'product_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'external_source' => 'hotmart',
'external_id' => 'HP2346486658'
]),
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/sales"
payload := strings.NewReader("{\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": 67,\n \"sold_at\": \"2026-08-07T11:49:12-03:00\",\n \"currency\": \"BRL\",\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_source\": \"hotmart\",\n \"external_id\": \"HP2346486658\"\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/sales")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": 67,\n \"sold_at\": \"2026-08-07T11:49:12-03:00\",\n \"currency\": \"BRL\",\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_source\": \"hotmart\",\n \"external_id\": \"HP2346486658\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.metricaas.com.br/v1/sales")
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 \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": 67,\n \"sold_at\": \"2026-08-07T11:49:12-03:00\",\n \"currency\": \"BRL\",\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_source\": \"hotmart\",\n \"external_id\": \"HP2346486658\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": 123,
"sold_at": "2023-11-07T05:31:56Z",
"stage": "<string>",
"duplicate": true
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": 123,
"sold_at": "2023-11-07T05:31:56Z",
"stage": "<string>",
"duplicate": true
}{
"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>"
}
]
}Registra uma venda
Cria a venda e move o lead para a etapa de ganho.
Um lead pode ter várias vendas. Recompra é uma chamada nova, não uma atualização da anterior.
Idempotência: mande external_source + external_id (o id da transação
na origem, ex. HP2346486658). O reenvio do mesmo par devolve 200 com
duplicate: true em vez de criar outra — é o que torna o replay de um
webhook de pagamento inofensivo. Sem external_id não há idempotência e
duas chamadas viram duas vendas.
curl --request POST \
--url https://app.metricaas.com.br/v1/sales \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": 67,
"sold_at": "2026-08-07T11:49:12-03:00",
"currency": "BRL",
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_source": "hotmart",
"external_id": "HP2346486658"
}
'import requests
url = "https://app.metricaas.com.br/v1/sales"
payload = {
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": 67,
"sold_at": "2026-08-07T11:49:12-03:00",
"currency": "BRL",
"product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_source": "hotmart",
"external_id": "HP2346486658"
}
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({
lead_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
value: 67,
sold_at: '2026-08-07T11:49:12-03:00',
currency: 'BRL',
product_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
external_source: 'hotmart',
external_id: 'HP2346486658'
})
};
fetch('https://app.metricaas.com.br/v1/sales', 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/sales",
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([
'lead_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'value' => 67,
'sold_at' => '2026-08-07T11:49:12-03:00',
'currency' => 'BRL',
'product_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'external_source' => 'hotmart',
'external_id' => 'HP2346486658'
]),
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/sales"
payload := strings.NewReader("{\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": 67,\n \"sold_at\": \"2026-08-07T11:49:12-03:00\",\n \"currency\": \"BRL\",\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_source\": \"hotmart\",\n \"external_id\": \"HP2346486658\"\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/sales")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": 67,\n \"sold_at\": \"2026-08-07T11:49:12-03:00\",\n \"currency\": \"BRL\",\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_source\": \"hotmart\",\n \"external_id\": \"HP2346486658\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.metricaas.com.br/v1/sales")
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 \"lead_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": 67,\n \"sold_at\": \"2026-08-07T11:49:12-03:00\",\n \"currency\": \"BRL\",\n \"product_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"external_source\": \"hotmart\",\n \"external_id\": \"HP2346486658\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": 123,
"sold_at": "2023-11-07T05:31:56Z",
"stage": "<string>",
"duplicate": true
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lead_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": 123,
"sold_at": "2023-11-07T05:31:56Z",
"stage": "<string>",
"duplicate": true
}{
"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 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 que o emitiu: se ela perder acesso na
grade de Equipe, o token perde junto, sem ninguém revogar nada.
Body
67
Quando o cliente comprou, não quando você está lançando.
O offset é obrigatório. O Metricaas grava em UTC; se você
mandar 2026-08-07T00:52:14 sem fuso, a compra da madrugada
vira o dia anterior em todo relatório. Sem offset a API
responde 422 em vez de adivinhar.
"2026-08-07T11:49:12-03:00"
"hotmart"
"HP2346486658"