Pipelines
Gestionar pipelines de ventas y sus etapas
Endpoints
| Metodo | Ruta | Descripcion |
|---|---|---|
GET | /crm/organizations/{organization_id}/pipelines | Listar pipelines con etapas |
POST | /crm/organizations/{organization_id}/pipelines | Crear pipeline |
PATCH | /crm/organizations/{organization_id}/pipelines/:id | Actualizar pipeline |
DELETE | /crm/organizations/{organization_id}/pipelines/:id | Eliminar pipeline |
POST | /crm/organizations/{organization_id}/pipelines/:id/stages | Agregar etapa |
PATCH | /crm/organizations/{organization_id}/pipelines/stages/:id | Actualizar etapa |
DELETE | /crm/organizations/{organization_id}/pipelines/stages/:id | Eliminar etapa |
GET | /crm/organizations/{organization_id}/currency | Obtener configuracion de monedas |
PATCH | /crm/organizations/{organization_id}/currency/base | Cambiar moneda base |
POST | /crm/organizations/{organization_id}/currency/rates | Agregar tipo de cambio |
GET | /crm/organizations/{organization_id}/currency/pipeline/:id/summary | Totales del pipeline en moneda base |
Listar pipelines
GET /crm/organizations/{organization_id}/pipelinesRetorna todos los pipelines de la organizacion con sus etapas. Si no existe ningun pipeline, se crea automaticamente uno por defecto ("General" con key "VNT").
curl "https://api.mirlo.com/v1/crm/organizations/{organization_id}/pipelines" \
-H "X-API-Key: <YOUR_API_KEY>"Respuesta
{
"data": [
{
"id": "878132de-...",
"name": "Ventas",
"key": "VNT",
"is_default": true,
"deal_counter": 10,
"stages": [
{ "id": "...", "name": "Prospecto", "stage_order": 0, "probability": 10, "status": "open" },
{ "id": "...", "name": "Contactado", "stage_order": 1, "probability": 25, "status": "open" },
{ "id": "...", "name": "Propuesta", "stage_order": 2, "probability": 50, "status": "open" },
{ "id": "...", "name": "Negociacion", "stage_order": 3, "probability": 75, "status": "open" },
{ "id": "...", "name": "Ganado", "stage_order": 4, "probability": 100, "status": "won" },
{ "id": "...", "name": "Perdido", "stage_order": 5, "probability": 0, "status": "lost" }
]
}
],
"total": 1
}Crear pipeline
POST /crm/organizations/{organization_id}/pipelines| Campo | Tipo | Requerido | Descripcion |
|---|---|---|---|
name | string | Si | Nombre del pipeline |
key | string | Si | Clave unica de 2-5 letras (ej: VNT, ENT). Se usa como prefijo de las referencias de los deals |
is_default | boolean | No | Marcar como pipeline por defecto |
curl -X POST https://api.mirlo.com/v1/crm/organizations/{organization_id}/pipelines \
-H "X-API-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Enterprise",
"key": "ENT",
"is_default": false
}'Agregar etapa
POST /crm/organizations/{organization_id}/pipelines/:id/stages| Campo | Tipo | Requerido | Descripcion |
|---|---|---|---|
name | string | Si | Nombre de la etapa |
stage_order | number | Si | Posicion (0-based) |
probability | number | No | Probabilidad de cierre 0-100 |
status | string | No | open (default), won, lost |
curl -X POST https://api.mirlo.com/v1/crm/organizations/{organization_id}/pipelines/{id}/stages \
-H "X-API-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"name": "Calificacion",
"stage_order": 1,
"probability": 25,
"status": "open"
}'Multi-moneda
Configuracion de monedas
GET /crm/organizations/{organization_id}/currencyRetorna la moneda base y los tipos de cambio configurados.
curl "https://api.mirlo.com/v1/crm/organizations/{organization_id}/currency" \
-H "X-API-Key: <YOUR_API_KEY>"Cambiar moneda base
PATCH /crm/organizations/{organization_id}/currency/basecurl -X PATCH https://api.mirlo.com/v1/crm/organizations/{organization_id}/currency/base \
-H "X-API-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{ "base_currency": "USD" }'Agregar tipo de cambio
POST /crm/organizations/{organization_id}/currency/rates| Campo | Tipo | Requerido | Descripcion |
|---|---|---|---|
from_currency | string | Si | Moneda origen (ej: USD) |
to_currency | string | Si | Moneda destino (ej: MXN) |
rate | number | Si | 1 unidad de from = rate unidades de to |
curl -X POST https://api.mirlo.com/v1/crm/organizations/{organization_id}/currency/rates \
-H "X-API-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"from_currency": "USD",
"to_currency": "MXN",
"rate": 17.50
}'Totales del pipeline
GET /crm/organizations/{organization_id}/currency/pipeline/:pipelineId/summaryRetorna los totales de cada etapa convertidos a la moneda base.
curl "https://api.mirlo.com/v1/crm/organizations/{organization_id}/currency/pipeline/{pipelineId}/summary" \
-H "X-API-Key: <YOUR_API_KEY>"Respuesta
{
"pipeline_id": "...",
"base_currency": "MXN",
"total_amount": 845000,
"total_deals": 10,
"stages": [
{ "stage_name": "Prospecto", "deal_count": 3, "total_amount": 185000, "currency": "MXN" },
{ "stage_name": "Propuesta", "deal_count": 2, "total_amount": 335000, "currency": "MXN" },
{ "stage_name": "Negociacion", "deal_count": 2, "total_amount": 325000, "currency": "MXN" }
]
}