/api/v1/pipelinesCria um funil no workspace da chave e retorna suas etapas. Exige settings.pipelines.
stages define as etapas ativas, em ordem. Quando omitido ou vazio, cria Leads, Qualificação, Proposta, Negociação e Fechamento. O sistema acrescenta as etapas finais Ganho e Perda. Não envie etapas finais nem isWon/isLost: a API responde 400.
O primeiro funil ativo torna-se o padrão do workspace. O limite de funis do plano se aplica; quando atingido, a API responde 409 QUOTA_EXCEEDED. Qualquer behaviors exige PIPELINE_BEHAVIORS, ou a resposta será 400.
Para usar attendance_queue, crie o funil primeiro. Depois configure behaviors e attendanceQueueStageId em PATCH /api/v1/pipelines/{seq}, usando uma etapa do próprio funil.
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 POST \
--url "https://pipefacil-server.matchsales.com.br/api/v1/pipelines" \
--header "Authorization: Bearer $PIPEFACIL_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"name": "Pós-venda",
"description": "Clientes que já compraram",
"stages": [
{
"name": "Onboarding",
"color": "#3b82f6"
},
{
"name": "Acompanhamento"
}
]
}'JavaScript
const response = await fetch(`https://pipefacil-server.matchsales.com.br/api/v1/pipelines`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PIPEFACIL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"name": "Pós-venda",
"description": "Clientes que já compraram",
"stages": [
{
"name": "Onboarding",
"color": "#3b82f6"
},
{
"name": "Acompanhamento"
}
]
}),
});
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(
"POST",
f"https://pipefacil-server.matchsales.com.br/api/v1/pipelines",
headers={"Authorization": f"Bearer {os.environ['PIPEFACIL_API_KEY']}"},
json=json.loads("{\n \"name\": \"Pós-venda\",\n \"description\": \"Clientes que já compraram\",\n \"stages\": [\n {\n \"name\": \"Onboarding\",\n \"color\": \"#3b82f6\"\n },\n {\n \"name\": \"Acompanhamento\"\n }\n ]\n}"),
)
response.raise_for_status()
data = response.json() if response.content else NoneCorpo da requisição
Content-Type: application/json · obrigatório
{
"name": "Pós-venda",
"description": "Clientes que já compraram",
"stages": [
{
"name": "Onboarding",
"color": "#3b82f6"
},
{
"name": "Acompanhamento"
}
]
}| Campo | Tipo | Obrigatório no objeto | Descrição |
|---|---|---|---|
name | string | Sim | Até 255 caracteres. |
description | string | Não | Opcional. Objetivo do funil; usado como contexto pela CIA. Aceita null. Até 2000 caracteres. |
stages | array | Não | Etapas ativas em ordem. Omitir ou enviar lista vazia cria as etapas padrão. O sistema acrescenta as etapas de ganho e perda. Aceita null. |
stages[].name | string | Sim | Até 255 caracteres. |
stages[].color | string | Não | Cor hexadecimal. Padrão: #6366f1. |
stages[].description | string | Não | Opcional. Condição esperada para o negócio estar nesta etapa; usada como contexto pela CIA. Aceita null. Até 2000 caracteres. |
behaviors | array | Não | Não configure attendance_queue na criação: exige uma etapa do próprio funil. Configure por PATCH depois de criar. Aceita null. |
pipelineType | string | Não | Entrada legada, ignorada. Configure behaviors para definir o comportamento do funil. Valores: standard, recurring_clients. Aceita null. |
attendanceQueueStageId | string | Não | A fila exige uma etapa já existente neste funil. Configure após a criação, com PATCH e behaviors. Aceita null. |
Esquema OpenAPI
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 255
},
"description": {
"type": "string",
"nullable": true,
"maxLength": 2000,
"description": "Opcional. Objetivo do funil; usado como contexto pela CIA."
},
"stages": {
"type": "array",
"nullable": true,
"description": "Etapas ativas em ordem. Omitir ou enviar lista vazia cria as etapas padrão. O sistema acrescenta as etapas de ganho e perda.",
"items": {
"$ref": "#/components/schemas/PipelineStageRequest"
}
},
"behaviors": {
"type": "array",
"nullable": true,
"items": {
"$ref": "#/components/schemas/PipelineBehavior"
},
"description": "Não configure `attendance_queue` na criação: exige uma etapa do próprio funil. Configure por `PATCH` depois de criar."
},
"pipelineType": {
"type": "string",
"nullable": true,
"deprecated": true,
"enum": [
"standard",
"recurring_clients"
],
"description": "Entrada legada, ignorada. Configure behaviors para definir o comportamento do funil."
},
"attendanceQueueStageId": {
"type": "string",
"description": "A fila exige uma etapa já existente neste funil. Configure após a criação, com PATCH e behaviors.",
"nullable": true
}
},
"example": {
"name": "Vendas",
"description": "Qualificação e fechamento de novas oportunidades."
}
}Respostas
201Criado: funil com todas as etapas.
| Campo | Tipo | Descrição |
|---|---|---|
data | Pipeline | — |
data.id | string | — |
data.seq | integer | Número sequencial no workspace usado em /api/v1/pipelines/{seq}. |
data.position | integer | Ordem de exibição entre os funis ativos. |
data.name | string | — |
data.description | string | Aceita null. |
data.isDefault | boolean | — |
data.isArchived | boolean | — |
data.exitStageId | string | Aceita null. |
data.pipelineType | string | Derivado de behaviors; mantido por compatibilidade. Valores: standard, recurring_clients. |
data.behaviors | array | — |
data.attendanceQueueStageId | string | Aceita null. |
data.stages | array | Etapas em ordem: ativas primeiro, seguidas das etapas finais de ganho e perda. |
data.stages[].id | string | Identificador da etapa usado em stageId na API, por exemplo, em POST /api/v1/deals. |
data.stages[].seq | integer | — |
data.stages[].order | integer | — |
data.stages[].name | string | — |
data.stages[].color | string | — |
data.stages[].description | string | Condição esperada para o negócio estar nesta etapa. Usada como contexto pela CIA. Aceita null. |
data.stages[].isWon | boolean | — |
data.stages[].isLost | boolean | — |
data.stages[].isRequired | boolean | — |
data.stages[].requiredMilestoneFieldId | string | Aceita null. |
data.stages[].dealCount | integer | Formato: int64. |
data.createdAt | string | Formato: date-time. |
data.updatedAt | string | Formato: date-time. |
message | string | Aceita null. |
Esquema OpenAPI
{
"type": "object",
"properties": {
"data": {
"$ref": "#/components/schemas/Pipeline"
},
"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"
]
}409Conflito de estado, como um negócio aberto duplicado para o contato/funil, ou limite do plano atingido (`QUOTA_EXCEEDED`), como na criação de um funil além da cota.
| 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"
]
}