Skip to content

crm

← All modules

35 endpoints.

GET /api/v1/crm/campaigns

List Campaigns

The ad campaigns represented among this pipeline's open deals, with a deal count each — drives the pipeline's "filter by campaign" dropdown. Names are resolved from the social site; campaign_id is the filter value.

Parameters

NameInRequiredTypeDescription
pipeline_idqueryno

200 — Successful Response

json
{
  "type": "array",
  "items": {
    "type": "object",
    "additionalProperties": true
  },
  "title": "Response List Campaigns Api V1 Crm Campaigns Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/pipelines

List Pipelines

200 — Successful Response

json
{
  "items": {
    "additionalProperties": true,
    "type": "object"
  },
  "type": "array",
  "title": "Response List Pipelines Api V1 Crm Pipelines Get"
}

GET /api/v1/crm/board

Get Board

Stages of a pipeline, each with its open deals — drives the kanban board. Optionally scoped to a single ad campaign (campaign_id) — matched via each deal's linked lead — and/or a single lead category.

Parameters

NameInRequiredTypeDescription
pipeline_idqueryno
campaign_idqueryno
categoryqueryno

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Get Board Api V1 Crm Board Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/deals

Create Deal

Manually add a deal to the pipeline, with an optional linked contact (a phone makes it callable). Lands in the requested stage, or the pipeline's first stage by default.

Request body

json
{
  "properties": {
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Title"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description"
    },
    "category": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Category"
    },
    "value": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Value"
    },
    "currency": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Currency"
    },
    "probability": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Probability"
    },
    "expected_close": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expected Close"
    },
    "stage_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stage Id"
    },
    "contact_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Contact Name"
    },
    "phone": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Phone"
    },
    "email": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Email"
    },
    "company": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Company"
    }
  },
  "type": "object",
  "title": "CreateDeal"
}

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Create Deal Api V1 Crm Deals Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/deals/{deal_id}/move

Move Deal

Parameters

NameInRequiredTypeDescription
deal_idpathyesstring

Request body

json
{
  "properties": {
    "stage_id": {
      "type": "string",
      "title": "Stage Id"
    }
  },
  "type": "object",
  "required": [
    "stage_id"
  ],
  "title": "MoveDeal"
}

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Move Deal Api V1 Crm Deals  Deal Id  Move Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/deals/{deal_id}

Deal Detail

Parameters

NameInRequiredTypeDescription
deal_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Deal Detail Api V1 Crm Deals  Deal Id  Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

PATCH /api/v1/crm/deals/{deal_id}

Update Deal

Parameters

NameInRequiredTypeDescription
deal_idpathyesstring

Request body

json
{
  "properties": {
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Title"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description"
    },
    "value": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Value"
    },
    "currency": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Currency"
    },
    "probability": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Probability"
    },
    "expected_close": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expected Close"
    }
  },
  "type": "object",
  "title": "DealPatch"
}

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Update Deal Api V1 Crm Deals  Deal Id  Patch"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/deals/{deal_id}/interactions

Deal Interactions

Merged calls/emails/Chatwoot timeline for a deal's contact — see app.services.interactions. Distinct from the activities already on deal_detail (CRM notes/stage-changes), which the drawer keeps showing separately; this only covers the OTHER channels.

Parameters

NameInRequiredTypeDescription
deal_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Deal Interactions Api V1 Crm Deals  Deal Id  Interactions Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/leads/{lead_id}/interactions

Lead Interactions

Parameters

NameInRequiredTypeDescription
lead_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Lead Interactions Api V1 Crm Leads  Lead Id  Interactions Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/contacts/{contact_id}/interactions

Contact Interactions

Parameters

NameInRequiredTypeDescription
contact_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Contact Interactions Api V1 Crm Contacts  Contact Id  Interactions Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/deals/{deal_id}/build-quote

Build Quote

Build (but do not send) a real AccQuotation from this deal's lead-form answers, matched against the admin-configured Quote Item Mapping — the "Build Quote" button on the deal drawer. Returns the quotation's location so the operator can open it in Accounting and use the existing preview+send email action there (no duplicate preview UI here — see app.grids.accounting._email_quote_like_pdf_handler, already wired to acc-quotations). Raises 400 with a clear message when nothing matched, so the operator knows to configure a mapping rather than getting a silent failure.

Parameters

NameInRequiredTypeDescription
deal_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Build Quote Api V1 Crm Deals  Deal Id  Build Quote Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/deals/{deal_id}/qualify

Qualify Deal

Place a real outbound call to the deal's contact and run the qualifier voice agent on it (reuses the org's Telephony SIP account + voice worker). Logs a call activity; the resulting qualification/callback links back by phone.

Parameters

NameInRequiredTypeDescription
deal_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Qualify Deal Api V1 Crm Deals  Deal Id  Qualify Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/campaign/status

Campaign Status

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Campaign Status Api V1 Crm Campaign Status Get"
}

POST /api/v1/crm/campaign/preview

Campaign Preview

The leads that "Start calling" would dial right now, given the filters — powers the confirmation modal so the operator sees the list before starting.

Request body

json
{
  "anyOf": [
    {
      "properties": {
        "fb_campaign_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Fb Campaign Id"
        },
        "crm_campaign_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Crm Campaign Id"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Category"
        },
        "search": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Search"
        }
      },
      "type": "object",
      "title": "CampaignFilters",
      "description": "Narrow the New-stage leads the campaign will dial. All optional — omitted\nmeans \"every callable New lead\" (the historical behaviour)."
    },
    {
      "type": "null"
    }
  ],
  "title": "Filters"
}

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Campaign Preview Api V1 Crm Campaign Preview Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/campaign/start

Campaign Start

Start a single-channel campaign: ring every callable deal in the pipeline's first ("New") stage one at a time, running the qualifier agent on each. Only one real call is ever live; the next dials when the prior call ends. filters (campaign/category/search) narrows the list — same selection the preview modal shows, so we dial exactly what the operator reviewed.

Request body

json
{
  "anyOf": [
    {
      "properties": {
        "fb_campaign_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Fb Campaign Id"
        },
        "crm_campaign_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Crm Campaign Id"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Category"
        },
        "search": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Search"
        }
      },
      "type": "object",
      "title": "CampaignFilters",
      "description": "Narrow the New-stage leads the campaign will dial. All optional — omitted\nmeans \"every callable New lead\" (the historical behaviour)."
    },
    {
      "type": "null"
    }
  ],
  "title": "Filters"
}

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Campaign Start Api V1 Crm Campaign Start Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/campaign/stop

Campaign Stop

Stop after the current call: the in-flight call drains, then no more dial.

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Campaign Stop Api V1 Crm Campaign Stop Post"
}

GET /api/v1/crm/email-list-job/status

Email List Job Status

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Email List Job Status Api V1 Crm Email List Job Status Get"
}

POST /api/v1/crm/email-list-job/start

Email List Job Start

Start the Leads grid's "Add to Email & SMS List" bulk action as a background job (see app.services.email_list_job) — the rate-limited external email API makes this take minutes for a large swimlane, so this returns immediately and the modal polls /email-list-job/status rather than blocking on one request. Leads that succeed at everything they had contact info for (email and/or phone) are soft-deleted from the grid once the copy is confirmed done.

Request body

json
{
  "properties": {
    "list_name": {
      "type": "string",
      "title": "List Name"
    },
    "lead_ids": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Lead Ids"
    }
  },
  "type": "object",
  "required": [
    "list_name",
    "lead_ids"
  ],
  "title": "EmailListJobStart"
}

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Email List Job Start Api V1 Crm Email List Job Start Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/ext-campaign/status

Ext Campaign Status

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Ext Campaign Status Api V1 Crm Ext Campaign Status Get"
}

POST /api/v1/crm/ext-campaign/preview

Ext Campaign Preview

The new leads "Start auto-dialler" would ring right now — powers the confirmation modal so the operator sees the list before starting.

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Ext Campaign Preview Api V1 Crm Ext Campaign Preview Post"
}

POST /api/v1/crm/ext-campaign/start

Ext Campaign Start

Ring the operator's own extension, then bridge them through every new lead one at a time once they pick up.

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Ext Campaign Start Api V1 Crm Ext Campaign Start Post"
}

POST /api/v1/crm/ext-campaign/stop

Ext Campaign Stop

Stop after the current call: the in-flight bridge drains, then no more dial.

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Ext Campaign Stop Api V1 Crm Ext Campaign Stop Post"
}

POST /api/v1/crm/deals/{deal_id}/notes

Add Note

Parameters

NameInRequiredTypeDescription
deal_idpathyesstring

Request body

json
{
  "properties": {
    "body": {
      "type": "string",
      "title": "Body"
    }
  },
  "type": "object",
  "required": [
    "body"
  ],
  "title": "NoteIn"
}

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Add Note Api V1 Crm Deals  Deal Id  Notes Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/deals/{deal_id}/reset-calls

Reset Deal Calls

Clear the deal's logged call attempts so it can be called again.

Call count is derived by counting CrmActivity(kind='call') rows, so we soft-delete those (preserving the audit row, just out of the count + timeline) and drop an activity noting the reset. This zeroes both the card badge and the campaign's max-attempts/cooldown gate.

Parameters

NameInRequiredTypeDescription
deal_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Reset Deal Calls Api V1 Crm Deals  Deal Id  Reset Calls Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/leads

List Leads

Parameters

NameInRequiredTypeDescription
pagequerynointeger
per_pagequerynointeger
categoryqueryno
statusqueryno
searchqueryno

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response List Leads Api V1 Crm Leads Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/leads/sync-to-pipeline

Sync Leads To Pipeline

Open a pipeline deal (in the "New" stage) for each filtered lead that isn't in the pipeline yet, and mark those leads pipelined. Idempotent: leads that already have an open deal are left in place (just normalised to pipelined).

Request body

json
{
  "anyOf": [
    {
      "properties": {
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Category"
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status"
        },
        "search": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Search"
        }
      },
      "type": "object",
      "title": "LeadsSyncFilters",
      "description": "Which leads to push into the pipeline — the Leads page's active filters."
    },
    {
      "type": "null"
    }
  ],
  "title": "Filters"
}

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Sync Leads To Pipeline Api V1 Crm Leads Sync To Pipeline Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/contacts

List Contacts

Parameters

NameInRequiredTypeDescription
pagequerynointeger
per_pagequerynointeger
searchqueryno

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response List Contacts Api V1 Crm Contacts Get"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/crm/stats

Crm Stats

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Crm Stats Api V1 Crm Stats Get"
}

GET /api/v1/crm/category-rules

List Rules

200 — Successful Response

json
{
  "items": {
    "additionalProperties": true,
    "type": "object"
  },
  "type": "array",
  "title": "Response List Rules Api V1 Crm Category Rules Get"
}

POST /api/v1/crm/category-rules

Create Rule

Request body

json
{
  "properties": {
    "match_type": {
      "type": "string",
      "title": "Match Type"
    },
    "match_value": {
      "type": "string",
      "title": "Match Value"
    },
    "category": {
      "type": "string",
      "title": "Category"
    },
    "sort_order": {
      "type": "integer",
      "title": "Sort Order",
      "default": 0
    }
  },
  "type": "object",
  "required": [
    "match_type",
    "match_value",
    "category"
  ],
  "title": "RuleIn"
}

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Create Rule Api V1 Crm Category Rules Post"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

DELETE /api/v1/crm/category-rules/{rule_id}

Delete Rule

Parameters

NameInRequiredTypeDescription
rule_idpathyesstring

200 — Successful Response

json
{
  "type": "object",
  "additionalProperties": true,
  "title": "Response Delete Rule Api V1 Crm Category Rules  Rule Id  Delete"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/recategorize

Recategorize

Re-apply category rules to every existing lead + its deal (after editing rules).

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Recategorize Api V1 Crm Recategorize Post"
}

GET /api/v1/crm/sync/config

Get Sync Config

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Get Sync Config Api V1 Crm Sync Config Get"
}

PUT /api/v1/crm/sync/config

Put Sync Config

Request body

json
{
  "properties": {
    "enabled": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Enabled"
    },
    "export_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Export Url"
    },
    "export_host": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Export Host"
    },
    "token": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Token"
    },
    "target_tenant_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Target Tenant Id"
    }
  },
  "type": "object",
  "title": "SyncConfigIn"
}

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Put Sync Config Api V1 Crm Sync Config Put"
}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/crm/sync/run

Run Sync Now

200 — Successful Response

json
{
  "additionalProperties": true,
  "type": "object",
  "title": "Response Run Sync Now Api V1 Crm Sync Run Post"
}

Lubb ERP Documentation