Registrar endpoint de Flow en Meta
Registra NUESTRO proxy como endpoint_uri de este Flow en Meta: el acto deliberado que el PUT sobre este mismo recurso se niega a realizar. Sin él, data_exchange es inalcanzable: Meta se niega a publicar un Flow cuyo modelo de enrutamiento necesita un endpoint, con “Publishing without specifying ‘endpoint_uri’ is forbidden”.
⛔ Es un verbo distinto y no un efecto secundario del PUT porque los dos actos tienen sujetos diferentes. Guardar un destino es el tenant describiendo SU webhook; esto es nosotros diciéndole a META que enrute el Flow a través de nosotros. Fusionarlos significaría que un tenant que opera su propio endpoint de Flow pierde todos los intercambios la próxima vez que corrija un error de tipeo en una URL.
⚠️ El cuerpo es OPCIONAL: a diferencia de PUT, este verbo no tiene campos obligatorios, así que sin cuerpo, un string vacío y {} se aceptan. Un cuerpo truncado se sigue rechazando (400 FLOW_BODY_INVALID), y confirmOverwrite es el único campo aceptado.
⛔ confirmOverwrite no es una formalidad. El endpoint_uri actual se lee EN VIVO desde el Graph, no desde metaEndpointUri, que escribe una sincronización horaria y por lo tanto no sabe nada de un URI registrado en la última hora. Si el Flow ya apunta a otro lugar, registrar le quita todos los intercambios a quien responde hoy, así que el comportamiento por defecto es 409 FLOW_ENDPOINT_URI_WOULD_OVERWRITE, cuyo cuerpo trae un CUARTO campo de nivel superior, currentEndpointUri, que indica el endpoint que sería desplazado. El nuestro nunca se devuelve: incluye el token de ruta del endpoint del número. Un valor no booleano se rechaza y nunca se convierte (400 FLOW_ENDPOINT_CONFIRM_INVALID), porque "false" leído como verdadero tomaría un endpoint en vivo en una solicitud cuyo autor creía haber declinado.
Idempotente: un Flow que ya apunta a nosotros responde 200 sin escribir en el Graph, y metaEndpointUri se actualiza en cualquier caso. Un número sin par de claves de endpoint se rechaza con 422 FLOW_ENDPOINT_NUMBER_HAS_NO_KEY: registrar de todos modos le dice a Meta que cifre para un par de claves que no existe, y cada intercambio del Flow publicado daría 421. Permiso flows:manage.
⚠️ Escribir endpoint_uri en un Flow PUBLISHED hace que Meta lo regrese a DRAFT. Cuando eso ocurre, el Flow se vuelve a publicar en la misma solicitud, y la respuesta lo indica: republished: true, finalStatus: "PUBLISHED". Si la republicación falla, o Meta no informa PUBLISHED después, la respuesta es 502 FLOW_REPUBLISH_FAILED con finalStatus en el cuerpo: el endpoint SÍ se registró y el Flow queda en DRAFT: publícalo de nuevo. Cuando no se escribió nada, republished es false y finalStatus es el estado que informó Meta.
Requiere una clave con alcance de número. Una clave con alcance de tenant debe indicar el número con el header x-whatsapp-number-id, o recibe 403 TENANT_SCOPE_NOT_ALLOWED.
curl --request POST \
--url https://pilotstatus.com.br/v1/flows/{id}/endpoint \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"confirmOverwrite": true
}
'import requests
url = "https://pilotstatus.com.br/v1/flows/{id}/endpoint"
payload = { "confirmOverwrite": True }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({confirmOverwrite: true})
};
fetch('https://pilotstatus.com.br/v1/flows/{id}/endpoint', 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://pilotstatus.com.br/v1/flows/{id}/endpoint",
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([
'confirmOverwrite' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/v1/flows/{id}/endpoint"
payload := strings.NewReader("{\n \"confirmOverwrite\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://pilotstatus.com.br/v1/flows/{id}/endpoint")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"confirmOverwrite\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/flows/{id}/endpoint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"confirmOverwrite\": true\n}"
response = http.request(request)
puts response.read_body{
"flowId": "cmf1a2b3c4d5e6f7g8h9i0j1",
"url": "https://hooks.acme.com/flows/data-exchange",
"hasSecret": true,
"endpointUri": "https://pilotstatus.com.br/api/flows/endpoint/AbC123.../1122334455",
"metaEndpointUri": "https://pilotstatus.com.br/api/flows/endpoint/AbC123.../1122334455",
"drift": false,
"numberHasKey": true,
"numberKeyUploadedAt": "2026-09-01T18:04:00.000Z",
"warnings": [],
"republished": false,
"finalStatus": "DRAFT"
}{
"error": "confirmOverwrite deve ser um booleano (true ou false).",
"errorEN": "confirmOverwrite must be a boolean (true or false).",
"code": "FLOW_ENDPOINT_CONFIRM_INVALID"
}{
"error": "Unauthorized"
}{
"error": "This endpoint acts on a single WhatsApp number: send the x-whatsapp-number-id header naming the number to act on (its id or instance id from GET /v1/numbers) | Este endpoint atua sobre um único número de WhatsApp: envie o header x-whatsapp-number-id indicando o número desejado (o id dele ou o id da instância, obtidos em GET /v1/numbers)",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "Flow não encontrado para o número desta chave.",
"errorEN": "Flow not found for this key's number.",
"code": "FLOW_NOT_FOUND"
}{
"error": "A Meta já aponta este Flow para outro endpoint. Registrar o nosso passaria TODAS as trocas deste Flow para a Pilot Status. Reenvie com confirmOverwrite para assumir.",
"errorEN": "Meta already points this Flow at another endpoint. Registering ours would take EVERY exchange of this Flow over to Pilot Status. Re-send with confirmOverwrite to take it over.",
"code": "FLOW_ENDPOINT_URI_WOULD_OVERWRITE",
"currentEndpointUri": "https://flows.acme.com/data-exchange"
}{
"error": "Este número ainda não tem chave de endpoint de Flow, por isso não existe URL para registrar na Meta. Gere a chave do número primeiro.",
"errorEN": "This number has no Flow endpoint key yet, so there is no URL to register at Meta. Generate the number's key first.",
"code": "FLOW_ENDPOINT_NUMBER_HAS_NO_KEY"
}{
"error": "Too many requests"
}{
"error": "Erro interno do servidor.",
"errorEN": "Internal server error.",
"code": "INTERNAL_ERROR"
}{
"error": "O endpoint foi registrado, mas a Meta voltou o Flow para rascunho e a republicação falhou. O Flow está em DRAFT: publique-o de novo.",
"errorEN": "The endpoint was registered, but Meta moved the Flow back to draft and re-publishing failed. The Flow is in DRAFT: publish it again.",
"code": "FLOW_REPUBLISH_FAILED",
"finalStatus": "DRAFT"
}Parámetros de ruta
Cuerpo
Respuesta
Meta ahora apunta este Flow a nuestro proxy. metaEndpointUri se actualiza a partir de lo que se acaba de escribir, no del espejo horario. Sin secret: el registro no genera nada. republished indica si un Flow que Meta devolvió a DRAFT se volvió a publicar; finalStatus es el estado del Flow en Meta al final de la solicitud
¿Esta página le ayudó?
curl --request POST \
--url https://pilotstatus.com.br/v1/flows/{id}/endpoint \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"confirmOverwrite": true
}
'import requests
url = "https://pilotstatus.com.br/v1/flows/{id}/endpoint"
payload = { "confirmOverwrite": True }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({confirmOverwrite: true})
};
fetch('https://pilotstatus.com.br/v1/flows/{id}/endpoint', 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://pilotstatus.com.br/v1/flows/{id}/endpoint",
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([
'confirmOverwrite' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://pilotstatus.com.br/v1/flows/{id}/endpoint"
payload := strings.NewReader("{\n \"confirmOverwrite\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://pilotstatus.com.br/v1/flows/{id}/endpoint")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"confirmOverwrite\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/flows/{id}/endpoint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"confirmOverwrite\": true\n}"
response = http.request(request)
puts response.read_body{
"flowId": "cmf1a2b3c4d5e6f7g8h9i0j1",
"url": "https://hooks.acme.com/flows/data-exchange",
"hasSecret": true,
"endpointUri": "https://pilotstatus.com.br/api/flows/endpoint/AbC123.../1122334455",
"metaEndpointUri": "https://pilotstatus.com.br/api/flows/endpoint/AbC123.../1122334455",
"drift": false,
"numberHasKey": true,
"numberKeyUploadedAt": "2026-09-01T18:04:00.000Z",
"warnings": [],
"republished": false,
"finalStatus": "DRAFT"
}{
"error": "confirmOverwrite deve ser um booleano (true ou false).",
"errorEN": "confirmOverwrite must be a boolean (true or false).",
"code": "FLOW_ENDPOINT_CONFIRM_INVALID"
}{
"error": "Unauthorized"
}{
"error": "This endpoint acts on a single WhatsApp number: send the x-whatsapp-number-id header naming the number to act on (its id or instance id from GET /v1/numbers) | Este endpoint atua sobre um único número de WhatsApp: envie o header x-whatsapp-number-id indicando o número desejado (o id dele ou o id da instância, obtidos em GET /v1/numbers)",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "Flow não encontrado para o número desta chave.",
"errorEN": "Flow not found for this key's number.",
"code": "FLOW_NOT_FOUND"
}{
"error": "A Meta já aponta este Flow para outro endpoint. Registrar o nosso passaria TODAS as trocas deste Flow para a Pilot Status. Reenvie com confirmOverwrite para assumir.",
"errorEN": "Meta already points this Flow at another endpoint. Registering ours would take EVERY exchange of this Flow over to Pilot Status. Re-send with confirmOverwrite to take it over.",
"code": "FLOW_ENDPOINT_URI_WOULD_OVERWRITE",
"currentEndpointUri": "https://flows.acme.com/data-exchange"
}{
"error": "Este número ainda não tem chave de endpoint de Flow, por isso não existe URL para registrar na Meta. Gere a chave do número primeiro.",
"errorEN": "This number has no Flow endpoint key yet, so there is no URL to register at Meta. Generate the number's key first.",
"code": "FLOW_ENDPOINT_NUMBER_HAS_NO_KEY"
}{
"error": "Too many requests"
}{
"error": "Erro interno do servidor.",
"errorEN": "Internal server error.",
"code": "INTERNAL_ERROR"
}{
"error": "O endpoint foi registrado, mas a Meta voltou o Flow para rascunho e a republicação falhou. O Flow está em DRAFT: publique-o de novo.",
"errorEN": "The endpoint was registered, but Meta moved the Flow back to draft and re-publishing failed. The Flow is in DRAFT: publish it again.",
"code": "FLOW_REPUBLISH_FAILED",
"finalStatus": "DRAFT"
}