PUT
/api/v1/automations/{id}Substitui toda a definição. Campos ausentes são redefinidos, as ações recebem novos identificadores e version é incrementada. A exceção é enabled: omitir preserva o estado atual. Para alterar somente o estado, use PATCH /{id}/enabled. Exige automations.edit.
Exemplos
A URL usa o servidor de produção. Defina PIPEFACIL_API_KEY e as variáveis de caminho (como SEQ ou ID) com os identificadores reais. Ajuste o corpo antes de executar: requisições de escrita alteram dados do workspace.
cURL
curl --request PUT \
--url "https://pipefacil-server.matchsales.com.br/api/v1/automations/$ID" \
--header "Authorization: Bearer $PIPEFACIL_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"name": "Fluxo manual de exemplo",
"triggerType": "manual",
"scope": "global",
"enabled": false,
"graphDefinition": {
"version": 2,
"nodes": [
{
"id": "inicio",
"type": "trigger"
},
{
"id": "fim",
"type": "end"
}
],
"edges": [
{
"id": "inicio-fim",
"source": "inicio",
"target": "fim",
"sourceHandle": "next"
}
]
}
}'JavaScript
const response = await fetch(`https://pipefacil-server.matchsales.com.br/api/v1/automations/${process.env.ID}`, {
method: "PUT",
headers: {
Authorization: `Bearer ${process.env.PIPEFACIL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Fluxo manual de exemplo",
"triggerType": "manual",
"scope": "global",
"enabled": false,
"graphDefinition": {
"version": 2,
"nodes": [
{
"id": "inicio",
"type": "trigger"
},
{
"id": "fim",
"type": "end"
}
],
"edges": [
{
"id": "inicio-fim",
"source": "inicio",
"target": "fim",
"sourceHandle": "next"
}
]
}
}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const text = await response.text();
const data = text ? JSON.parse(text) : null;Python
import os
import json
import requests
response = requests.request(
"PUT",
f"https://pipefacil-server.matchsales.com.br/api/v1/automations/{os.environ['ID']}",
headers={"Authorization": f"Bearer {os.environ['PIPEFACIL_API_KEY']}"},
json=json.loads("{\n \"name\": \"Fluxo manual de exemplo\",\n \"triggerType\": \"manual\",\n \"scope\": \"global\",\n \"enabled\": false,\n \"graphDefinition\": {\n \"version\": 2,\n \"nodes\": [\n {\n \"id\": \"inicio\",\n \"type\": \"trigger\"\n },\n {\n \"id\": \"fim\",\n \"type\": \"end\"\n }\n ],\n \"edges\": [\n {\n \"id\": \"inicio-fim\",\n \"source\": \"inicio\",\n \"target\": \"fim\",\n \"sourceHandle\": \"next\"\n }\n ]\n }\n}"),
)
response.raise_for_status()
data = response.json() if response.content else NoneParâmetros
| Nome | Local | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
id | path | string | Sim | Identificador da automação. |
Corpo da requisição
Content-Type: application/json · obrigatório
{
"name": "Fluxo manual de exemplo",
"triggerType": "manual",
"scope": "global",
"enabled": false,
"graphDefinition": {
"version": 2,
"nodes": [
{
"id": "inicio",
"type": "trigger"
},
{
"id": "fim",
"type": "end"
}
],
"edges": [
{
"id": "inicio-fim",
"source": "inicio",
"target": "fim",
"sourceHandle": "next"
}
]
}
}| Campo | Tipo | Obrigatório no objeto | Descrição |
|---|---|---|---|
name | string | Sim | Até 255 caracteres. |
triggerType | string | Sim | Um dos valores de GET /api/v1/automations/triggers. Valores: deal_created, deal_stage_changed, deal_won, deal_lost, deal_assigned, message_received, conversation_closed, contact_no_reply, team_no_reply, field_filled, timer, instagram_comment_received, manual, webhook. |
scope | string | Sim | Valores: global, pipeline, stage. |
pipelineId | string | Não | Aceita null. |
stageId | string | Não | Aceita null. |
outboundChannelId | string | Não | Não existe rota pública para listar canais; obtenha o identificador por outro meio. Aceita null. |
graphDefinition | AutomationGraph | Não | Grafo do fluxo: até 50 nós e 30 esperas, exatamente um nó trigger, sem ciclos e com todos os nós alcançáveis pelo gatilho. Cada tipo tem regras de saída: condition exige uma aresta branch_ |
graphDefinition.version | integer | Sim | Valores: 2. |
graphDefinition.nodes | array | Sim | — |
graphDefinition.nodes[].id | string | Sim | — |
graphDefinition.nodes[].type | string | Sim | Valores: trigger, action, condition, wait, round_robin, end. |
graphDefinition.nodes[].actionType | string | Não | Valores: webhook, send_whatsapp, move_stage, add_tag, remove_tag, set_custom_field, wait, create_task, assign_responsible, add_co_owner, send_meta_conversion, create_lead, send_email, reply_instagram_comment, send_instagram_private_reply, hide_instagram_comment, cia_deal_analysis, create_calendar_event, close_conversation, stop_automations. Aceita null. |
graphDefinition.nodes[].config | object | Não | As propriedades obrigatórias dependem de actionType: webhook exige url; move_stage exige targetStageId; add_tag/remove_tag exigem tagIds não vazio; set_custom_field exige exatamente um entre fieldId e fieldSlug, além de value; assign_responsible exige userId; wait exige delaySeconds, com mínimo de 5. |
graphDefinition.nodes[].condition | object | Não | Aceita null. |
graphDefinition.edges | array | Não | — |
graphDefinition.edges[].id | string | Não | — |
graphDefinition.edges[].source | string | Sim | — |
graphDefinition.edges[].target | string | Sim | — |
graphDefinition.edges[].sourceHandle | string | Não | next, fallback, branch_<id>, rr_<id>, btn_<id>, replied, timeout ou text_reply. |
respectBusinessHours | boolean | Não | Aceita null. |
triggerWindow | object | Não | Aceita null. |
conditions | object | Não | Aceita null. |
triggerConfig | object | Não | O formato depende de triggerType. field_filled usa {fieldSlug, fillMode}; timer aceita {mode: date_field, dateFieldSlug, offsetMinutes, onPastDate} ou {mode: recurring, cron}; contact_no_reply e team_no_reply usam {timeoutSeconds} entre 60 e 2592000; webhook usa {path, httpMethod, authentication e outras propriedades}. Aceita null. |
enabled | boolean | Não | Na criação, omitir significa true: o fluxo começa a reagir aos gatilhos. Na substituição, omitir preserva o estado atual. Aceita null. |
actions | array | Não | Ações do formato legado. Para novos fluxos, use graphDefinition. Aceita null. |
actions[].type | string | Não | Tipo de ação legado. |
actions[].order | integer | Não | — |
actions[].config | object | Não | — |
webhookUrl | string | Não | URL de webhook do formato legado. Aceita null. |
webhookHeaders | object | Não | Cabeçalhos de webhook do formato legado. Aceita null. |
Esquema OpenAPI
{
"type": "object",
"description": "Corpo de criação ou substituição. `scope: pipeline` exige `pipelineId`; `scope: stage` exige `stageId`. Gatilhos manual e webhook usam obrigatoriamente o escopo global. `respectBusinessHours` e uma triggerWindow não vazia são incompatíveis. O gatilho manual não aceita conditions, triggerWindow nem respectBusinessHours.",
"properties": {
"name": {
"type": "string",
"maxLength": 255
},
"triggerType": {
"type": "string",
"description": "Um dos valores de `GET /api/v1/automations/triggers`.",
"enum": [
"deal_created",
"deal_stage_changed",
"deal_won",
"deal_lost",
"deal_assigned",
"message_received",
"conversation_closed",
"contact_no_reply",
"team_no_reply",
"field_filled",
"timer",
"instagram_comment_received",
"manual",
"webhook"
]
},
"scope": {
"type": "string",
"enum": [
"global",
"pipeline",
"stage"
]
},
"pipelineId": {
"type": "string",
"nullable": true
},
"stageId": {
"type": "string",
"nullable": true
},
"outboundChannelId": {
"type": "string",
"nullable": true,
"description": "Não existe rota pública para listar canais; obtenha o identificador por outro meio."
},
"graphDefinition": {
"$ref": "#/components/schemas/AutomationGraph"
},
"respectBusinessHours": {
"type": "boolean",
"nullable": true
},
"triggerWindow": {
"type": "object",
"nullable": true,
"additionalProperties": true
},
"conditions": {
"type": "object",
"nullable": true,
"additionalProperties": true
},
"triggerConfig": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "O formato depende de triggerType. field_filled usa {fieldSlug, fillMode}; timer aceita {mode: date_field, dateFieldSlug, offsetMinutes, onPastDate} ou {mode: recurring, cron}; contact_no_reply e team_no_reply usam {timeoutSeconds} entre 60 e 2592000; webhook usa {path, httpMethod, authentication e outras propriedades}."
},
"enabled": {
"type": "boolean",
"nullable": true,
"description": "Na criação, omitir significa **true**: o fluxo começa a reagir aos gatilhos. Na substituição, omitir preserva o estado atual."
},
"actions": {
"type": "array",
"nullable": true,
"items": {
"$ref": "#/components/schemas/AutomationActionRequest"
},
"description": "Ações do formato legado. Para novos fluxos, use graphDefinition."
},
"webhookUrl": {
"type": "string",
"description": "URL de webhook do formato legado.",
"nullable": true
},
"webhookHeaders": {
"type": "object",
"nullable": true,
"additionalProperties": true,
"description": "Cabeçalhos de webhook do formato legado."
}
},
"required": [
"name",
"triggerType",
"scope"
],
"example": {
"name": "Fluxo manual de exemplo",
"triggerType": "manual",
"scope": "global",
"enabled": false,
"graphDefinition": {
"version": 2,
"nodes": [
{
"id": "inicio",
"type": "trigger"
},
{
"id": "fim",
"type": "end"
}
],
"edges": [
{
"id": "inicio-fim",
"source": "inicio",
"target": "fim",
"sourceHandle": "next"
}
]
}
}
}Respostas
200Sucesso
| Campo | Tipo | Descrição |
|---|---|---|
data | Automation | — |
data.id | string | — |
data.name | string | — |
data.version | integer | Versão da definição. A troca de enabled não incrementa a versão. |
data.enabled | boolean | — |
data.triggerType | string | — |
data.scope | string | Valores: global, pipeline, stage. |
data.pipelineId | string | Aceita null. |
data.stageId | string | Aceita null. |
data.outboundChannelId | string | Aceita null. |
data.respectBusinessHours | boolean | — |
data.triggerWindow | object | Aceita null. |
data.conditions | object | Aceita null. |
data.triggerConfig | object | As credenciais de webhook (headerValue, password) são removidas. Aceita null. |
data.graphDefinition | AutomationGraph | Grafo do fluxo: até 50 nós e 30 esperas, exatamente um nó trigger, sem ciclos e com todos os nós alcançáveis pelo gatilho. Cada tipo tem regras de saída: condition exige uma aresta branch_ |
data.graphDefinition.version | integer | Valores: 2. |
data.graphDefinition.nodes | array | — |
data.graphDefinition.nodes[].id | string | — |
data.graphDefinition.nodes[].type | string | Valores: trigger, action, condition, wait, round_robin, end. |
data.graphDefinition.nodes[].actionType | string | Valores: webhook, send_whatsapp, move_stage, add_tag, remove_tag, set_custom_field, wait, create_task, assign_responsible, add_co_owner, send_meta_conversion, create_lead, send_email, reply_instagram_comment, send_instagram_private_reply, hide_instagram_comment, cia_deal_analysis, create_calendar_event, close_conversation, stop_automations. Aceita null. |
data.graphDefinition.nodes[].config | object | As propriedades obrigatórias dependem de actionType: webhook exige url; move_stage exige targetStageId; add_tag/remove_tag exigem tagIds não vazio; set_custom_field exige exatamente um entre fieldId e fieldSlug, além de value; assign_responsible exige userId; wait exige delaySeconds, com mínimo de 5. |
data.graphDefinition.nodes[].condition | object | Aceita null. |
data.graphDefinition.edges | array | — |
data.graphDefinition.edges[].id | string | — |
data.graphDefinition.edges[].source | string | — |
data.graphDefinition.edges[].target | string | — |
data.graphDefinition.edges[].sourceHandle | string | next, fallback, branch_<id>, rr_<id>, btn_<id>, replied, timeout ou text_reply. |
data.actions | array | — |
data.actions[].id | string | ID da ação. As ações são substituídas na atualização, não alteradas individualmente. |
data.actions[].type | string | — |
data.actions[].order | integer | — |
data.actions[].config | object | O secret do webhook é removido. |
data.createdAt | string | Formato: date-time. |
data.updatedAt | string | Formato: date-time. |
data.secret | string | Presente somente na resposta de criação ou substituição que gerou o segredo. Nunca aparece na leitura. Salve-o: assina X-PipeFacil-Signature-256 e não pode ser consultado depois. Aceita null. |
message | string | Aceita null. |
Esquema OpenAPI
{
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/Automation"
},
"message": {
"type": "string",
"nullable": true
}
}
}400Falha de validação dos campos; `fieldErrors` contém os erros.
| Campo | Tipo | Descrição |
|---|---|---|
error | string | — |
code | string | Valores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. |
requestId | string | — |
details | string | Aceita null. |
fieldErrors | array | Aceita null. |
fieldErrors[].field | string | — |
fieldErrors[].message | string | — |
Esquema OpenAPI
{
"type": "object",
"description": "Formato padrão de erro. `details` e `fieldErrors` são omitidos quando ausentes.",
"properties": {
"error": {
"type": "string"
},
"code": {
"type": "string",
"enum": [
"BAD_REQUEST",
"VALIDATION_ERROR",
"UNAUTHORIZED",
"FORBIDDEN",
"FEATURE_DISABLED",
"NOT_FOUND",
"CONFLICT",
"QUOTA_EXCEEDED",
"UNPROCESSABLE_ENTITY",
"INTERNAL_ERROR",
"SERVICE_UNAVAILABLE"
]
},
"requestId": {
"type": "string"
},
"details": {
"type": "string",
"nullable": true
},
"fieldErrors": {
"type": "array",
"nullable": true,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
},
"required": [
"error",
"code",
"requestId"
]
}401Chave ausente, malformada, desconhecida, revogada ou expirada, ou membro emissor inativo.
| Campo | Tipo | Descrição |
|---|---|---|
error | string | — |
code | string | Valores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. |
requestId | string | — |
details | string | Aceita null. |
fieldErrors | array | Aceita null. |
fieldErrors[].field | string | — |
fieldErrors[].message | string | — |
Esquema OpenAPI
{
"type": "object",
"description": "Formato padrão de erro. `details` e `fieldErrors` são omitidos quando ausentes.",
"properties": {
"error": {
"type": "string"
},
"code": {
"type": "string",
"enum": [
"BAD_REQUEST",
"VALIDATION_ERROR",
"UNAUTHORIZED",
"FORBIDDEN",
"FEATURE_DISABLED",
"NOT_FOUND",
"CONFLICT",
"QUOTA_EXCEEDED",
"UNPROCESSABLE_ENTITY",
"INTERNAL_ERROR",
"SERVICE_UNAVAILABLE"
]
},
"requestId": {
"type": "string"
},
"details": {
"type": "string",
"nullable": true
},
"fieldErrors": {
"type": "array",
"nullable": true,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
},
"required": [
"error",
"code",
"requestId"
]
}403Autenticado, mas sem acesso: falta de permissão (`FORBIDDEN`), recurso desligado no workspace (`FEATURE_DISABLED`) ou tentativa de acessar uma agenda não permitida.
| Campo | Tipo | Descrição |
|---|---|---|
error | string | — |
code | string | Valores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. |
requestId | string | — |
details | string | Aceita null. |
fieldErrors | array | Aceita null. |
fieldErrors[].field | string | — |
fieldErrors[].message | string | — |
Esquema OpenAPI
{
"type": "object",
"description": "Formato padrão de erro. `details` e `fieldErrors` são omitidos quando ausentes.",
"properties": {
"error": {
"type": "string"
},
"code": {
"type": "string",
"enum": [
"BAD_REQUEST",
"VALIDATION_ERROR",
"UNAUTHORIZED",
"FORBIDDEN",
"FEATURE_DISABLED",
"NOT_FOUND",
"CONFLICT",
"QUOTA_EXCEEDED",
"UNPROCESSABLE_ENTITY",
"INTERNAL_ERROR",
"SERVICE_UNAVAILABLE"
]
},
"requestId": {
"type": "string"
},
"details": {
"type": "string",
"nullable": true
},
"fieldErrors": {
"type": "array",
"nullable": true,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
},
"required": [
"error",
"code",
"requestId"
]
}404Recurso não encontrado ou fora da visibilidade do membro.
| Campo | Tipo | Descrição |
|---|---|---|
error | string | — |
code | string | Valores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. |
requestId | string | — |
details | string | Aceita null. |
fieldErrors | array | Aceita null. |
fieldErrors[].field | string | — |
fieldErrors[].message | string | — |
Esquema OpenAPI
{
"type": "object",
"description": "Formato padrão de erro. `details` e `fieldErrors` são omitidos quando ausentes.",
"properties": {
"error": {
"type": "string"
},
"code": {
"type": "string",
"enum": [
"BAD_REQUEST",
"VALIDATION_ERROR",
"UNAUTHORIZED",
"FORBIDDEN",
"FEATURE_DISABLED",
"NOT_FOUND",
"CONFLICT",
"QUOTA_EXCEEDED",
"UNPROCESSABLE_ENTITY",
"INTERNAL_ERROR",
"SERVICE_UNAVAILABLE"
]
},
"requestId": {
"type": "string"
},
"details": {
"type": "string",
"nullable": true
},
"fieldErrors": {
"type": "array",
"nullable": true,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
},
"required": [
"error",
"code",
"requestId"
]
}422Requisição válida que o recurso não pode atender, por exemplo, um identificador de calendário que não representa uma reunião nativa.
| Campo | Tipo | Descrição |
|---|---|---|
error | string | — |
code | string | Valores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. |
requestId | string | — |
details | string | Aceita null. |
fieldErrors | array | Aceita null. |
fieldErrors[].field | string | — |
fieldErrors[].message | string | — |
Esquema OpenAPI
{
"type": "object",
"description": "Formato padrão de erro. `details` e `fieldErrors` são omitidos quando ausentes.",
"properties": {
"error": {
"type": "string"
},
"code": {
"type": "string",
"enum": [
"BAD_REQUEST",
"VALIDATION_ERROR",
"UNAUTHORIZED",
"FORBIDDEN",
"FEATURE_DISABLED",
"NOT_FOUND",
"CONFLICT",
"QUOTA_EXCEEDED",
"UNPROCESSABLE_ENTITY",
"INTERNAL_ERROR",
"SERVICE_UNAVAILABLE"
]
},
"requestId": {
"type": "string"
},
"details": {
"type": "string",
"nullable": true
},
"fieldErrors": {
"type": "array",
"nullable": true,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
},
"required": [
"error",
"code",
"requestId"
]
}429Limite de requisições excedido por workspace ou IP.
| Campo | Tipo | Descrição |
|---|---|---|
error | string | — |
code | string | Valores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. |
requestId | string | — |
details | string | Aceita null. |
fieldErrors | array | Aceita null. |
fieldErrors[].field | string | — |
fieldErrors[].message | string | — |
Esquema OpenAPI
{
"type": "object",
"description": "Formato padrão de erro. `details` e `fieldErrors` são omitidos quando ausentes.",
"properties": {
"error": {
"type": "string"
},
"code": {
"type": "string",
"enum": [
"BAD_REQUEST",
"VALIDATION_ERROR",
"UNAUTHORIZED",
"FORBIDDEN",
"FEATURE_DISABLED",
"NOT_FOUND",
"CONFLICT",
"QUOTA_EXCEEDED",
"UNPROCESSABLE_ENTITY",
"INTERNAL_ERROR",
"SERVICE_UNAVAILABLE"
]
},
"requestId": {
"type": "string"
},
"details": {
"type": "string",
"nullable": true
},
"fieldErrors": {
"type": "array",
"nullable": true,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
},
"required": [
"error",
"code",
"requestId"
]
}