> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ondial.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Lead setup

> Copy call.lead / email.lead / whatsapp.lead for this campaign.

1. Try it with `campaignId`
2. `readyFor.email` / `whatsapp` / `call` tells you what you can send
3. Copy `email.lead` or `whatsapp.lead` or `call.lead`
4. Fill blanks → POST `/api/v1/leads`


## OpenAPI

````yaml /openapi.json get /api/v1/campaigns/{campaignId}/lead-setup
openapi: 3.0.3
info:
  title: Ondial Public API
  version: 1.0.0
  description: >-
    Tenant API-key surface for lead ingest, contacts (including dial
    conversation + analysis), events, inbound agents, company profiles, and
    knowledge-base documents.


    **Campaign definition is UI-only** — create and start an API-ingest campaign
    in the dashboard, then push leads here.


    **Auth:** `Authorization: Bearer ond_live_…` or `ond_test_…` (or
    `X-API-Key`). Keys are requested in **API Access** with a friendly **key
    name**, then approved by Super Admin (not self-serve). Tenants can rename
    keys later without rotating the secret.


    **Scopes:** Company and knowledge-base routes require opt-in scopes
    (`companies:read`, `companies:write`, `knowledge:read`, `knowledge:write`)
    granted at key approval. Missing scope → `403 forbidden`.


    **Sandbox** keys never place PSTN dials or live WhatsApp/email and do not
    burn credits (KB upload skips debit).


    **Security:** Company responses never include SMTP/WhatsApp credentials. KB
    v1 is metadata-only — no file download.


    **Kill switch:** Super Admin can disable all `/api/v1/*` (`503` /
    `api_globally_disabled`) without stopping UI CSV campaigns.


    **Compliance:** Call channel requires `consent.outboundCall: true` and phone
    not on tenant/platform DNC.
servers:
  - url: https://dashboard.ondial.ai
    description: Production
  - url: http://localhost:3001
    description: Local
security:
  - BearerAuth: []
tags:
  - name: Core
    description: Auth check and lead ingest
  - name: Contacts
    description: Status, dials/conversation/analysis, cancel, delete, follow-ups, list
  - name: Events
    description: ERP event bus slice — eventType → campaign
  - name: Outbound
    description: >-
      Read-only campaign lookup for API / Custom CRM. Create and start campaigns
      in the dashboard.
  - name: Inbound agents
    description: Configure inbound agents; list/buy pool numbers; read credits
  - name: Companies
    description: >-
      Company profile CRUD (requires companies:read / companies:write scopes).
      Never returns SMTP or WhatsApp credentials.
  - name: Knowledge bases
    description: >-
      Knowledge document upload/list/delete (requires knowledge:read /
      knowledge:write scopes). Metadata only — no file download via API.
paths:
  /api/v1/campaigns/{campaignId}/lead-setup:
    get:
      tags:
        - Outbound
      summary: Lead setup for a campaign
      description: >-
        Paste a `campaignId`. Returns a small payload: `readyFor` plus
        copy-paste `call.lead` / `email.lead` / `whatsapp.lead`.


        Fill the empty strings and POST `/api/v1/leads`. WhatsApp `paramLabels`
        maps `whatsappParams[0]` → `{{1}}`.
      operationId: getCampaignLeadSetup
      parameters:
        - name: campaignId
          in: path
          required: true
          schema:
            type: string
          example: 6a7afae1e1cf2999568febc4
      responses:
        '200':
          description: Setup checklist + copy-paste lead bodies
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeadSetup'
              example:
                ok: true
                campaignId: 6a7afae1e1cf2999568febc4
                name: TEst API
                status: active
                readyFor:
                  call: true
                  email: true
                  whatsapp: true
                call:
                  ok: true
                  lead:
                    campaignId: 6a7afae1e1cf2999568febc4
                    channel: call
                    phone: ''
                    name: ''
                    consent:
                      outboundCall: true
                email:
                  ok: true
                  lead:
                    campaignId: 6a7afae1e1cf2999568febc4
                    channel: email
                    email: ''
                    name: ''
                    emailProfileId: YOUR_EMAIL_PROFILE_ID
                    emailTemplateId: YOUR_EMAIL_TEMPLATE_ID
                whatsapp:
                  ok: true
                  paramLabels:
                    - Name
                    - Order ID
                    - Product
                    - Amount
                    - Expected Delivery
                    - Tracking URL
                  lead:
                    campaignId: 6a7afae1e1cf2999568febc4
                    channel: whatsapp
                    phone: ''
                    name: ''
                    whatsappProfileId: YOUR_WHATSAPP_PROFILE_ID
                    whatsappTemplateId: YOUR_WHATSAPP_TEMPLATE_ID
                    whatsappParams:
                      - ''
                      - ''
                      - ''
                      - ''
                      - ''
                      - ''
        '400':
          description: Invalid campaignId
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '503':
          $ref: '#/components/responses/ApiDisabled'
      security:
        - BearerAuth: []
components:
  schemas:
    LeadSetup:
      type: object
      properties:
        ok:
          type: boolean
        campaignId:
          type: string
        name:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
        paused:
          type: boolean
        readyFor:
          type: object
          properties:
            call:
              type: boolean
            email:
              type: boolean
            whatsapp:
              type: boolean
        call:
          type: object
          additionalProperties: true
        email:
          type: object
          additionalProperties: true
        whatsapp:
          type: object
          additionalProperties: true
        errors:
          type: array
          items:
            type: string
    ErrorBody:
      type: object
      properties:
        error:
          type: string
        reasonCode:
          type: string
        missing:
          type: array
          items:
            type: string
  responses:
    Unauthorized:
      description: Missing, invalid, or inactive API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            error: Invalid or inactive API key
            reasonCode: unauthorized
    NotFound:
      description: Not found or not owned
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            error: Not found
            reasonCode: not_found
    ApiDisabled:
      description: Global kill switch or insufficient credits
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            killSwitch:
              value:
                error: API temporarily disabled
                reasonCode: api_globally_disabled
            credits:
              value:
                error: Insufficient credits
                reasonCode: insufficient_credits
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: ond_live | ond_test
      description: >-
        Paste only your API key (`ond_live_…` or `ond_test_…`). Do not type the
        word Bearer — the playground adds it.

````