POST /api/v1/pipelines/{seq}/stages
Acrescenta uma etapa ativa antes das etapas finais de ganho e perda e retorna o funil atualizado. isWon/isLost são definidos pelo sistema: enviá-los resulta em 400. Exige settings.pipelines.
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/ $SEQ /stages" \
--header "Authorization: Bearer $PIPEFACIL_API_KEY " \
--header "Content-Type: application/json" \
--data '{
"name": "Proposta",
"color": "#2563eb"
}' JavaScript const response = await fetch ( `https://pipefacil-server.matchsales.com.br/api/v1/pipelines/${ process . env . SEQ }/stages` , {
method: "POST" ,
headers: {
Authorization: `Bearer ${ process . env . PIPEFACIL_API_KEY }` ,
"Content-Type" : "application/json" ,
},
body: JSON . stringify ({
"name" : "Proposta" ,
"color" : "#2563eb"
}),
});
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/ { os.environ[ 'SEQ' ] } /stages" ,
headers = { "Authorization" : f "Bearer { os.environ[ 'PIPEFACIL_API_KEY' ] } " },
json = json.loads( "{ \n \" name \" : \" Proposta \" , \n \" color \" : \" #2563eb \"\n }" ),
)
response.raise_for_status()
data = response.json() if response.content else None Parâmetros Nome Local Tipo Obrigatório Descrição seqpathintegerSim Número sequencial do funil no workspace (seq).
Corpo da requisição Content-Type: application/json · obrigatório
{
"name" : "Proposta" ,
"color" : "#2563eb"
} Campo Tipo Obrigatório no objeto Descrição namestringSim Até 255 caracteres. colorstringNão Cor hexadecimal. Padrão: #6366f1. descriptionstringNão Opcional. Condição esperada para o negócio estar nesta etapa; usada como contexto pela CIA. Aceita null. Até 2000 caracteres.
Esquema OpenAPI {
"type" : "object" ,
"required" : [
"name"
],
"properties" : {
"name" : {
"type" : "string" ,
"minLength" : 1 ,
"maxLength" : 255
},
"color" : {
"type" : "string" ,
"pattern" : "^#[0-9a-fA-F]{6}$" ,
"example" : "#6366f1" ,
"description" : "Cor hexadecimal. Padrão: `#6366f1`."
},
"description" : {
"type" : "string" ,
"nullable" : true ,
"maxLength" : 2000 ,
"description" : "Opcional. Condição esperada para o negócio estar nesta etapa; usada como contexto pela CIA."
}
},
"example" : {
"name" : "Proposta" ,
"color" : "#2563eb"
}
} Respostas 201 Criado: funil com todas as etapas. Campo Tipo Descrição dataPipeline— data.idstring— data.seqintegerNúmero sequencial no workspace usado em /api/v1/pipelines/{seq}. data.positionintegerOrdem de exibição entre os funis ativos. data.namestring— data.descriptionstringAceita null. data.isDefaultboolean— data.isArchivedboolean— data.exitStageIdstringAceita null. data.pipelineTypestringDerivado de behaviors; mantido por compatibilidade. Valores: standard, recurring_clients. data.behaviorsarray— data.attendanceQueueStageIdstringAceita null. data.stagesarrayEtapas em ordem: ativas primeiro, seguidas das etapas finais de ganho e perda. data.stages[].idstringIdentificador da etapa usado em stageId na API, por exemplo, em POST /api/v1/deals. data.stages[].seqinteger— data.stages[].orderinteger— data.stages[].namestring— data.stages[].colorstring— data.stages[].descriptionstringCondição esperada para o negócio estar nesta etapa. Usada como contexto pela CIA. Aceita null. data.stages[].isWonboolean— data.stages[].isLostboolean— data.stages[].isRequiredboolean— data.stages[].requiredMilestoneFieldIdstringAceita null. data.stages[].dealCountintegerFormato: int64. data.createdAtstringFormato: date-time. data.updatedAtstringFormato: date-time. messagestringAceita null.
Esquema OpenAPI {
"type" : "object" ,
"properties" : {
"data" : {
"$ref" : "#/components/schemas/Pipeline"
},
"message" : {
"type" : "string" ,
"nullable" : true
}
}
} 400 Falha de validação dos campos; `fieldErrors` contém os erros. Campo Tipo Descrição errorstring— codestringValores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. requestIdstring— detailsstringAceita null. fieldErrorsarrayAceita null. fieldErrors[].fieldstring— fieldErrors[].messagestring—
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"
]
} 401 Chave ausente, malformada, desconhecida, revogada ou expirada, ou membro emissor inativo. Campo Tipo Descrição errorstring— codestringValores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. requestIdstring— detailsstringAceita null. fieldErrorsarrayAceita null. fieldErrors[].fieldstring— fieldErrors[].messagestring—
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"
]
} 403 Autenticado, 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 errorstring— codestringValores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. requestIdstring— detailsstringAceita null. fieldErrorsarrayAceita null. fieldErrors[].fieldstring— fieldErrors[].messagestring—
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"
]
} 404 Recurso não encontrado ou fora da visibilidade do membro. Campo Tipo Descrição errorstring— codestringValores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. requestIdstring— detailsstringAceita null. fieldErrorsarrayAceita null. fieldErrors[].fieldstring— fieldErrors[].messagestring—
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"
]
} 429 Limite de requisições excedido por workspace ou IP. Campo Tipo Descrição errorstring— codestringValores: BAD_REQUEST, VALIDATION_ERROR, UNAUTHORIZED, FORBIDDEN, FEATURE_DISABLED, NOT_FOUND, CONFLICT, QUOTA_EXCEEDED, UNPROCESSABLE_ENTITY, INTERNAL_ERROR, SERVICE_UNAVAILABLE. requestIdstring— detailsstringAceita null. fieldErrorsarrayAceita null. fieldErrors[].fieldstring— fieldErrors[].messagestring—
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"
]
}