> ## 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.

# List Omni templates

> Copy email.templates[].lead or whatsapp.templates[].lead into POST /leads.

Same API key as Create lead. Never returns SMTP passwords or WhatsApp/AiSensy keys.

| Call                                     | What you get                                                                                |
| ---------------------------------------- | ------------------------------------------------------------------------------------------- |
| `GET /api/v1/omni/templates`             | Full catalog. No `selected`. Copy any `templates[].lead`.                                   |
| `GET /api/v1/omni/templates?campaignId=` | Same lists. `selected: true` = this campaign’s template. Each `lead` includes `campaignId`. |

1. Copy **`email.templates[].lead`** (the row with `"selected": true`, or another template)
2. Fill `email` / `name` and `templateVariables`
3. Or copy **`whatsapp.templates[].lead`** and fill `phone` + `whatsappParams` (`paramLabels[i]` = `{{i+1}}`)
4. `POST /api/v1/leads`

Invalid `campaignId` → `400`. Not yours → `404`.


## OpenAPI

````yaml GET /api/v1/omni/templates
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/omni/templates:
    get:
      tags:
        - Core
      summary: List Omni templates
      description: >-
        Lists email and WhatsApp profiles/templates. Copy
        `email.templates[].lead` or `whatsapp.templates[].lead` into POST
        `/api/v1/leads`.


        - Omit `campaignId` — full catalog, no `selected`.

        - Pass `campaignId` — `selected: true` is that campaign’s template; each
        `lead` includes `campaignId`.


        Email `templateVariables` are the `{{keys}}` in that template. WhatsApp
        `paramLabels` / `whatsappParams` match `{{1}}`…`{{n}}`. Never returns
        SMTP passwords or WhatsApp API keys.
      operationId: listOmniTemplates
      parameters:
        - in: query
          name: campaignId
          required: false
          schema:
            type: string
          description: >-
            Optional. Omit for all profiles/templates. Pass a campaign you own
            to see which profile + template that campaign uses.
      responses:
        '200':
          description: Profiles and templates
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OmniTemplates'
              example:
                campaignId: 6a7afae1e1cf2999568febc4
                name: TEst API
                email:
                  profileId: YOUR_EMAIL_PROFILE_ID
                  templateId: YOUR_EMAIL_TEMPLATE_ID
                  profiles:
                    - id: YOUR_EMAIL_PROFILE_ID
                      name: Test
                      fromEmail: support@example.com
                  templates:
                    - id: YOUR_EMAIL_TEMPLATE_ID
                      name: Product Information
                      subject: Product information from {{company_name}}
                      selected: true
                      lead:
                        campaignId: 6a7afae1e1cf2999568febc4
                        channel: email
                        email: ''
                        name: ''
                        emailProfileId: YOUR_EMAIL_PROFILE_ID
                        emailTemplateId: YOUR_EMAIL_TEMPLATE_ID
                        templateVariables:
                          company_name: ''
                          contact_name: ''
                          agent_name: ''
                whatsapp:
                  profileId: YOUR_WHATSAPP_PROFILE_ID
                  templateId: YOUR_WHATSAPP_TEMPLATE_ID
                  profiles:
                    - id: YOUR_WHATSAPP_PROFILE_ID
                      name: Ondial WhatsApp
                      phone: '917567240879'
                  templates:
                    - id: YOUR_WHATSAPP_TEMPLATE_ID
                      name: order_confirmation_demo
                      selected: 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'
components:
  schemas:
    OmniTemplates:
      type: object
      properties:
        campaignId:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        email:
          type: object
          additionalProperties: true
        whatsapp:
          type: object
          additionalProperties: true
    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.

````