mirlo

Pipelines

Gestionar pipelines de ventas y sus etapas

Endpoints

MetodoRutaDescripcion
GET/crm/organizations/{organization_id}/pipelinesListar pipelines con etapas
POST/crm/organizations/{organization_id}/pipelinesCrear pipeline
PATCH/crm/organizations/{organization_id}/pipelines/:idActualizar pipeline
DELETE/crm/organizations/{organization_id}/pipelines/:idEliminar pipeline
POST/crm/organizations/{organization_id}/pipelines/:id/stagesAgregar etapa
PATCH/crm/organizations/{organization_id}/pipelines/stages/:idActualizar etapa
DELETE/crm/organizations/{organization_id}/pipelines/stages/:idEliminar etapa
GET/crm/organizations/{organization_id}/currencyObtener configuracion de monedas
PATCH/crm/organizations/{organization_id}/currency/baseCambiar moneda base
POST/crm/organizations/{organization_id}/currency/ratesAgregar tipo de cambio
GET/crm/organizations/{organization_id}/currency/pipeline/:id/summaryTotales del pipeline en moneda base

Listar pipelines

GET /crm/organizations/{organization_id}/pipelines

Retorna 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
CampoTipoRequeridoDescripcion
namestringSiNombre del pipeline
keystringSiClave unica de 2-5 letras (ej: VNT, ENT). Se usa como prefijo de las referencias de los deals
is_defaultbooleanNoMarcar 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
CampoTipoRequeridoDescripcion
namestringSiNombre de la etapa
stage_ordernumberSiPosicion (0-based)
probabilitynumberNoProbabilidad de cierre 0-100
statusstringNoopen (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}/currency

Retorna 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/base
curl -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
CampoTipoRequeridoDescripcion
from_currencystringSiMoneda origen (ej: USD)
to_currencystringSiMoneda destino (ej: MXN)
ratenumberSi1 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/summary

Retorna 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" }
  ]
}

En esta pagina