Live Direct Marketing Leads API

The Leads API from Live Direct Marketing — 21 operation(s) for leads.

Business capability
Opportunity & Pipeline Management BC-410.30

Operations 27

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /api/leads List leads · List leads with pagination, search, and pipeline/stage filters #
Ask an LLM
“Which leads are in a given pipeline stage?”
“Can I search my leads and sort them by a field?”
Tell an agent
List leads in pipeline {pipelineId}, includeDeleted {includeDeleted}, onlyDeleted {onlyDeleted}.
Search leads for {search} (includeDeleted {includeDeleted}, onlyDeleted {onlyDeleted}).
POST /api/leads Create a lead · Create a new lead #
Ask an LLM
“How do I add a new sales lead?”
“Can I set a deal amount and pipeline stage when creating a lead?”
Tell an agent
Create a lead titled {title}.
Add lead {title} worth {amount} {currency} for company {companyId} in stage {stageId}.
GET /api/leads/stats Get lead statistics · Get lead statistics, optionally scoped to a pipeline #
Ask an LLM
“How many leads do I have overall?”
“Can I see lead statistics for just one pipeline?”
Tell an agent
Show my lead statistics.
Get lead stats for pipeline {pipelineId}.
GET /api/leads/kanban/{pipelineId} Show a pipeline's kanban board · Get the kanban board for a pipeline #
Ask an LLM
“What does the kanban board look like for one of my pipelines?”
“Can I limit how many leads load per column on the board?”
Tell an agent
Show the kanban board for pipeline {pipelineId} matching {search}.
Load pipeline {pipelineId}'s board with {perStage} leads per stage, search {search}.
GET /api/leads/kanban/{pipelineId}/stage/{stageId} Load more leads in one kanban column · Load more leads for a single kanban stage #
Ask an LLM
“How do I load the next batch of leads in a single board column?”
“Can I page through one stage of the kanban without reloading the whole board?”
Tell an agent
Load more leads in stage {stageId} of pipeline {pipelineId} from offset {offset}, search {search}.
Fetch the next {limit} kanban cards in stage {stageId} of pipeline {pipelineId}, search {search}.
GET /api/leads/stages/{pipelineId} List a pipeline's stages for lead filtering · List stages of a pipeline (for lead filters) #
Ask an LLM
“Which stages can I filter leads by in a given pipeline?”
“What stage options exist for leads in one pipeline?”
Tell an agent
List lead filter stages for pipeline {pipelineId}.
Show which stages leads can be in for pipeline {pipelineId}.
GET /api/leads/duplicates Find duplicate leads across the workspace · Find duplicate leads across the workspace (by title/contact/company within a… #
Ask an LLM
“Do I have duplicate leads anywhere in my workspace?”
“Can I scan for duplicates by contact or company only within one pipeline?”
Tell an agent
Scan the whole workspace for duplicate leads.
Find duplicate leads by {field} in pipeline {pipelineId}.
GET /api/leads/{id} Get a lead · Get a single lead by ID #
Ask an LLM
“What are the details of a specific lead?”
“Can I look up a lead by its id?”
Tell an agent
Show lead {id}.
Get the record for lead {id}.
PATCH /api/leads/{id} Update a lead · Update an existing lead #
Ask an LLM
“How do I change a lead's title, priority or linked contact?”
“Can I set an expected close date on an existing lead?”
Tell an agent
Change lead {id}'s title to {title}.
Set lead {id} priority to {priority} and link contact {contactId}.
DELETE /api/leads/{id} Move a lead to trash · Soft-delete a lead #
Ask an LLM
“How do I delete a lead but keep the option to restore it?”
“What happens to a lead when I remove it from the pipeline?”
Tell an agent destructive · confirm first
Move lead {id} to the trash.
Soft-delete lead {id}.
GET /api/leads/{id}/duplicates Check one lead for duplicates · Check for duplicates of a specific lead #
Ask an LLM
“Does this particular lead already exist under another record?”
“Are there leads that duplicate the one I'm looking at?”
Tell an agent
Check whether lead {id} has duplicates.
Find leads that duplicate lead {id}.
GET /api/leads/{id}/dossier Get a lead's full dossier · Get the full dossier (company + contact + activity) for a lead #
Ask an LLM
“Can I see the company, contact and activity behind a lead in one view?”
“What's the full background dossier on a lead?”
Tell an agent
Pull the dossier for lead {id}.
Show company, contact and activity for lead {id}.
GET /api/leads/{id}/interest Get a lead's AI interest classification · Get the AI interest classification for a lead #
Ask an LLM
“Is a lead interested, according to the AI classification?”
“What interest status did the AI assign to a lead?”
Tell an agent
Show the AI interest classification for lead {id}.
Tell me how interested lead {id} is.
PATCH /api/leads/{id}/interest Manually set a lead's interest status · Manually set the interest status of a lead #
Ask an LLM
“Can I override the AI's interest status on a lead by hand?”
“How long can the note be when I set a lead's interest manually?”
Tell an agent
Set lead {id}'s interest status to {status}.
Mark lead {id} as {status} with note {note}.
GET /api/leads/interest/breakdown Break down leads by interest status · Get the breakdown of leads by interest status #
Ask an LLM
“How many of my leads are interested versus not interested?”
“Can I see the interest-status breakdown for one pipeline?”
Tell an agent
Show the breakdown of my leads by interest status.
Break down leads in pipeline {pipelineId} by interest.
GET /api/leads/{id}/deal Get a lead's deal projection · Get the deal projection (amount/probability/weighted) for a lead #
Ask an LLM
“What is a lead's deal worth once weighted by probability?”
“Which amount and win probability are set on a lead's deal?”
Tell an agent
Show the deal projection for lead {id}.
Get the weighted deal value of lead {id}.
PATCH /api/leads/{id}/deal Update a lead's deal amount and probability · Update deal fields (amount/currency/probability/close date) #
Ask an LLM
“How do I change the win probability on a lead's deal?”
“Can I update a deal's amount and expected close date together?”
Tell an agent
Set the deal on lead {id} to {amount} {currency} at {probability} probability.
Move lead {id}'s deal close date to {expectedCloseDate}.
GET /api/leads/deal/forecast Forecast weighted deal revenue · Compute the weighted-amount forecast across leads in scope #
Ask an LLM
“What's my weighted sales forecast across all open leads?”
“Can I forecast revenue for one pipeline within a date range?”
Tell an agent
Compute the weighted deal forecast for pipeline {pipelineId}.
Forecast weighted revenue from {dateFrom} to {dateTo}.
POST /api/leads/{id}/move Move a lead to another stage · Move a lead to a different stage (and optionally pipeline) #
Ask an LLM
“How do I move a single lead to the next stage of the pipeline?”
“Can I record a lost reason when moving a lead to a lost stage?”
Tell an agent
Move lead {id} to stage {stageId}.
Move lead {id} to stage {stageId} of pipeline {pipelineId} with lost reason {lostReason}.
POST /api/leads/bulk Run a bulk action on many leads · Enqueue a bulk action on multiple leads (async) #
Ask an LLM
“Can I tag or re-stage a whole batch of leads at once?”
“Which bulk actions can I queue up on a set of selected leads?”
Tell an agent
Run bulk action {action} on leads {ids}.
Bulk-add tags {tagIds} to leads {ids} with action {action}.
GET /api/leads/bulk/{jobId} Check the status of a bulk lead job · Get the status of a bulk lead job #
Ask an LLM
“Has my bulk lead update finished yet?”
“How far along is a queued bulk lead job?”
Tell an agent
Check progress of bulk lead job {jobId}.
Get the status of bulk job {jobId} on leads.
DELETE /api/leads/bulk/{jobId} Cancel a running bulk lead job · Cancel an in-progress bulk lead job #
Ask an LLM
“Can I stop a bulk lead action that's still in progress?”
“How do I abort a queued bulk update on leads?”
Tell an agent destructive · confirm first
Cancel bulk lead job {jobId}.
Stop the in-progress bulk job {jobId} on my leads.
POST /api/leads/{id}/restore Restore a trashed lead · Restore a soft-deleted lead #
Ask an LLM
“Can I bring back a lead I moved to the trash?”
“How do I undo deleting a lead?”
Tell an agent
Restore lead {id} from the trash.
Undelete lead {id}.
DELETE /api/leads/{id}/purge Permanently delete a trashed lead · PERMANENTLY delete a trashed lead (requires isDeleted). Irreversible #
Ask an LLM
“How do I permanently erase a lead that's already in the trash?”
“Can a purged lead ever be recovered?”
Tell an agent destructive · confirm first
Permanently purge trashed lead {id}.
Erase lead {id} for good from the trash.
POST /api/leads/export Export leads to a file · Export leads to a downloadable file #
Ask an LLM
“Can I download my leads as a CSV or Excel file?”
“How do I export only the leads in one pipeline stage?”
Tell an agent
Export leads with scope {scope} as {format}.
Export leads in stage {stageId} of pipeline {pipelineId} with scope {scope}.
POST /api/leads/import/preview Preview a lead import · Preview a leads import with proposed mapping #
Ask an LLM
“Can I check how my spreadsheet columns will map before importing leads?”
“What would a lead import look like with my proposed field mapping?”
Tell an agent
Preview importing rows {rows} as leads using mapping {mapping}.
Dry-run a lead import of {rows} with column mapping {mapping}.
POST /api/leads/import/start Start a lead import job · Start a leads import job #
Ask an LLM
“How do I actually import a batch of leads once the mapping looks right?”
“Can I pass options when kicking off a lead import?”
Tell an agent
Import leads from {rows} using mapping {mapping}.
Start a lead import of {rows} with mapping {mapping} and options {options}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/live-direct-marketing-online:live-direct-marketing-online-leads-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

live-direct-marketing-online-leads-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: LDM v3 Leads API
  description: 'Multi-tenant B2B outreach automation platform. Auth: JWT Bearer (15-min) or tenant API key (ldm_*) managed in CRM Settings → API Keys. All tenant-scoped endpoints require the X-Tenant-Id header.'
  version: 1.0.0
  contact: {}
servers:
- url: https://api.live-direct-marketing.online
  description: Production
- url: https://api.dev.live-direct-marketing.online
  description: Development
- url: http://127.0.0.1:3000
  description: Local
tags:
- name: Leads
paths:
  /api/leads:
    get:
      operationId: LeadsController_findAll
      parameters:
      - name: page
        required: false
        in: query
        description: 1-based page number
        schema:
          example: 1
          type: number
      - name: pageSize
        required: false
        in: query
        description: Items per page (default 25)
        schema:
          example: 25
          type: number
      - name: pipelineId
        required: false
        in: query
        description: Filter by pipeline ID
        schema:
          type: string
      - name: stageId
        required: false
        in: query
        description: Filter by stage ID within the pipeline
        schema:
          type: string
      - name: search
        required: false
        in: query
        description: Full-text search across title/description
        schema:
          type: string
      - name: sortBy
        required: false
        in: query
        description: Sort column (e.g. createdAt, amount)
        schema:
          type: string
      - name: sortDir
        required: false
        in: query
        description: Sort direction
        schema:
          enum:
          - asc
          - desc
          type: string
      - name: includeDeleted
        required: true
        in: query
        schema:
          type: string
      - name: onlyDeleted
        required: true
        in: query
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: List leads with pagination, search, and pipeline/stage filters
      tags:
      - Leads
    post:
      operationId: LeadsController_create
      parameters:
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLeadDto'
      responses:
        '201':
          description: ''
      security:
      - jwt: []
      summary: Create a new lead
      tags:
      - Leads
  /api/leads/stats:
    get:
      operationId: LeadsController_getStats
      parameters:
      - name: pipelineId
        required: false
        in: query
        description: Restrict stats to a single pipeline
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Get lead statistics, optionally scoped to a pipeline
      tags:
      - Leads
      x-required-scope:
      - leads:read
  /api/leads/kanban/{pipelineId}:
    get:
      operationId: LeadsController_kanban
      parameters:
      - name: pipelineId
        required: true
        in: path
        schema:
          type: string
      - name: perStage
        required: false
        in: query
        description: Max leads per stage (capped at 200)
        schema:
          example: 50
          type: number
      - name: search
        required: true
        in: query
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Get the kanban board for a pipeline
      tags:
      - Leads
  /api/leads/kanban/{pipelineId}/stage/{stageId}:
    get:
      operationId: LeadsController_kanbanStageMore
      parameters:
      - name: pipelineId
        required: true
        in: path
        schema:
          type: string
      - name: stageId
        required: true
        in: path
        schema:
          type: string
      - name: offset
        required: false
        in: query
        description: Number of items to skip
        schema:
          example: 0
          type: number
      - name: limit
        required: false
        in: query
        description: Items to load (capped at 100)
        schema:
          example: 25
          type: number
      - name: search
        required: true
        in: query
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Load more leads for a single kanban stage
      tags:
      - Leads
  /api/leads/stages/{pipelineId}:
    get:
      operationId: LeadsController_stages
      parameters:
      - name: pipelineId
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: List stages of a pipeline (for lead filters)
      tags:
      - Leads
  /api/leads/duplicates:
    get:
      operationId: LeadsController_findDuplicates
      parameters:
      - name: field
        required: false
        in: query
        description: Which signal to detect duplicates by (default all)
        schema:
          enum:
          - title
          - contact
          - company
          - all
          type: string
      - name: pipelineId
        required: false
        in: query
        description: Restrict scan to a single pipeline
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Find duplicate leads across the workspace (by title/contact/company within a…
      tags:
      - Leads
      x-required-scope:
      - leads:read
  /api/leads/{id}:
    get:
      operationId: LeadsController_findById
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Get a single lead by ID
      tags:
      - Leads
    patch:
      operationId: LeadsController_update
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateLeadDto'
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Update an existing lead
      tags:
      - Leads
    delete:
      operationId: LeadsController_softDelete
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Soft-delete a lead
      tags:
      - Leads
  /api/leads/{id}/duplicates:
    get:
      operationId: LeadsController_checkDuplicates
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Check for duplicates of a specific lead
      tags:
      - Leads
  /api/leads/{id}/dossier:
    get:
      operationId: LeadsController_dossier
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Get the full dossier (company + contact + activity) for a lead
      tags:
      - Leads
  /api/leads/{id}/interest:
    get:
      operationId: LeadsController_getInterest
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Get the AI interest classification for a lead
      tags:
      - Leads
    patch:
      operationId: LeadsController_setInterest
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetInterestDto'
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Manually set the interest status of a lead
      tags:
      - Leads
  /api/leads/interest/breakdown:
    get:
      operationId: LeadsController_interestBreakdown
      parameters:
      - name: pipelineId
        required: false
        in: query
        description: Restrict breakdown to a single pipeline
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Get the breakdown of leads by interest status
      tags:
      - Leads
      x-required-scope:
      - leads:read
  /api/leads/{id}/deal:
    get:
      operationId: LeadsController_getDeal
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Get the deal projection (amount/probability/weighted) for a lead
      tags:
      - Leads
    patch:
      operationId: LeadsController_updateDeal
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDealDto'
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Update deal fields (amount/currency/probability/close date)
      tags:
      - Leads
  /api/leads/deal/forecast:
    get:
      operationId: LeadsController_forecast
      parameters:
      - name: pipelineId
        required: false
        in: query
        description: Restrict forecast to a single pipeline
        schema:
          type: string
      - name: dateFrom
        required: false
        in: query
        description: Lower bound on expectedCloseDate (ISO)
        schema:
          example: '2026-01-01'
          type: string
      - name: dateTo
        required: false
        in: query
        description: Upper bound on expectedCloseDate (ISO)
        schema:
          example: '2026-12-31'
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Compute the weighted-amount forecast across leads in scope
      tags:
      - Leads
      x-required-scope:
      - leads:read
  /api/leads/{id}/move:
    post:
      operationId: LeadsController_move
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MoveLeadDto'
      responses:
        '201':
          description: ''
      security:
      - jwt: []
      summary: Move a lead to a different stage (and optionally pipeline)
      tags:
      - Leads
  /api/leads/bulk:
    post:
      operationId: LeadsController_bulk
      parameters:
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeadsBulkDto'
      responses:
        '201':
          description: ''
      security:
      - jwt: []
      summary: Enqueue a bulk action on multiple leads (async)
      tags:
      - Leads
      x-required-scope:
      - leads:write
  /api/leads/bulk/{jobId}:
    get:
      operationId: LeadsController_getBulkStatus
      parameters:
      - name: jobId
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Get the status of a bulk lead job
      tags:
      - Leads
    delete:
      operationId: LeadsController_cancelBulk
      parameters:
      - name: jobId
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: Cancel an in-progress bulk lead job
      tags:
      - Leads
  /api/leads/{id}/restore:
    post:
      operationId: LeadsController_restore
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '201':
          description: ''
      security:
      - jwt: []
      summary: Restore a soft-deleted lead
      tags:
      - Leads
  /api/leads/{id}/purge:
    delete:
      operationId: LeadsController_purge
      parameters:
      - name: id
        required: true
        in: path
        schema:
          type: string
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      responses:
        '200':
          description: ''
      security:
      - jwt: []
      summary: PERMANENTLY delete a trashed lead (requires isDeleted). Irreversible
      tags:
      - Leads
  /api/leads/export:
    post:
      operationId: LeadsController_exportLeads
      parameters:
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportLeadsDto'
      responses:
        '201':
          description: ''
      security:
      - jwt: []
      summary: Export leads to a downloadable file
      tags:
      - Leads
      x-required-scope:
      - leads:write
  /api/leads/import/preview:
    post:
      operationId: LeadsController_importPreview
      parameters:
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeadsImportPreviewDto'
      responses:
        '201':
          description: ''
      security:
      - jwt: []
      summary: Preview a leads import with proposed mapping
      tags:
      - Leads
      x-required-scope:
      - leads:write
  /api/leads/import/start:
    post:
      operationId: LeadsController_importStart
      parameters:
      - name: X-Tenant-Id
        in: header
        required: false
        schema:
          type: string
          format: uuid
        description: Tenant UUID — required for all tenant-scoped endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeadsImportStartDto'
      responses:
        '201':
          description: ''
      security:
      - jwt: []
      summary: Start a leads import job
      tags:
      - Leads
      x-required-scope:
      - leads:write
components:
  schemas:
    UpdateLeadDto:
      type: object
      properties:
        priority:
          type: string
          enum:
          - LOW
          - MEDIUM
          - HIGH
          - URGENT
        title:
          type: string
          maxLength: 255
        description:
          type: string
        amount:
          type: number
        currency:
          type: string
        companyId:
          type: string
        contactId:
          type: string
        source:
          type: string
        expectedCloseDate:
          type: string
    MoveLeadDto:
      type: object
      properties:
        stageId:
          type: string
        pipelineId:
          type: string
        lostReason:
          type: string
      required:
      - stageId
    LeadsImportPreviewDto:
      type: object
      properties:
        rows:
          description: Raw rows parsed from the source file/sheet
          type: array
          items:
            type: object
        mapping:
          type: object
          description: Column -> field mapping (csvColumn -> target field)
      required:
      - rows
      - mapping
    LeadsBulkDto:
      type: object
      properties:
        action:
          type: string
          description: Bulk action name (e.g. delete, addTags, removeTags, setField, moveStage)
        ids:
          description: Lead ids to act on
          type: array
          items:
            type: string
        leadIds:
          description: Alias for ids
          type: array
          items:
            type: string
        tagIds:
          description: Tag ids for addTags/removeTags actions
          type: array
          items:
            type: string
        fieldName:
          type: string
          description: Field name for a setField-style action
        fieldValue:
          type: object
          description: Field value for a setField-style action (shape depends on fieldName)
        stageId:
          type: string
          description: Target stage id for a moveStage-style action
        priority:
          type: object
          description: Priority value for a setPriority-style action
      required:
      - action
    UpdateDealDto:
      type: object
      properties:
        amount:
          type: number
        currency:
          type: string
        probability:
          type: number
        expectedCloseDate:
          type: string
          description: ISO date string
    ExportLeadsDto:
      type: object
      properties:
        scope:
          type: string
          description: Which leads to export
          enum:
          - all
          - filtered
          - selected
        leadIds:
          description: Lead ids to export when scope is "selected"
          type: array
          items:
            type: string
        pipelineId:
          type: string
          description: Restrict export to leads in this pipeline
        stageId:
          type: string
          description: Restrict export to leads in this stage
        format:
          type: string
          description: Export file format (e.g. csv, xlsx)
      required:
      - scope
    LeadsImportStartDto:
      type: object
      properties:
        rows:
          description: Raw rows parsed from the source file/sheet
          type: array
          items:
            type: object
        mapping:
          type: object
          description: Column -> field mapping (csvColumn -> target field)
        options:
          type: object
      required:
      - rows
      - mapping
    SetInterestDto:
      type: object
      properties:
        status:
          type: string
          description: Interest status value (validated against the allowed set in LeadsService)
        note:
          type: string
          description: Free-text note, max 500 chars (enforced in LeadsService)
      required:
      - status
    CreateLeadDto:
      type: object
      properties:
        priority:
          type: string
          enum:
          - LOW
          - MEDIUM
          - HIGH
          - URGENT
        title:
          type: string
          maxLength: 255
        description:
          type: string
        amount:
          type: number
        currency:
          type: string
        pipelineId:
          type: string
        stageId:
          type: string
        companyId:
          type: string
        contactId:
          type: string
        source:
          type: string
      required:
      - title
  securitySchemes:
    jwt:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: JWT access token from /auth/login (Bearer <token>)
    tenant-api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Tenant API key (Bearer ldm_*) for MCP/A2A clients. Issued via CRM Settings → API Keys.
    rpa-service:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Dedicated RPA service key. No tenant API-key or query-key authentication.