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

# Initiate AI Call



## OpenAPI

````yaml https://api.voice-agents.miraiminds.co/swagger.yaml post /v2/call/initiate
openapi: 3.0.3
info:
  title: Voice Agent by Mirai Minds
  version: 1.1.0
  contact:
    name: API Architecture Team
    url: https://miraiminds.co
  license:
    name: Mirai Minds Proprietary License
    url: >-
      https://github.com/MiraiMinds/voice-agent-integration-specs/blob/main/LICENSE.md
servers:
  - url: https://api.voice-agents.miraiminds.co
    description: Production Server
  - url: https://api.stage.voice-agent.miraiminds.co
    description: Staging Server
  - url: http://localhost:3000
    description: Local Server
security:
  - PublicKeyAuth: []
    PrivateKeyAuth: []
paths:
  /v2/call/initiate:
    post:
      tags:
        - Call
      summary: Initiate AI Call
      operationId: initiateCall
      parameters:
        - $ref: '#/components/parameters/PublicKeyHeader'
        - $ref: '#/components/parameters/PrivateKeyHeader'
        - $ref: '#/components/parameters/WorkspaceHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiateCallRequest'
            examples:
              abandoned_cart:
                summary: Example for abandoned_cart variant
                description: Use this example when the assistant variant is abandoned_cart
                value:
                  phoneNumber: '+919876543210'
                  assistant: assistant_123
                  callbackUrl: https://example.com/webhooks/call-events
                  payload:
                    id: gid://shopify/AbandonedCheckout/66509168181329
                    abandonedCheckoutUrl: >-
                      https://example-store.myshopify.com/checkouts/ac/abc123xyz/recover?key=sample_recovery_key&locale=en-IN
                    customer:
                      firstName: John
                      lastName: Doe
                      email: null
                      phone: '+919876543210'
                    discountCodes: []
                    totalLineItemsPrice: '1895.0'
                    totalDiscountSet:
                      shopMoney:
                        amount: '0.0'
                    subtotalPriceSet:
                      shopMoney:
                        amount: '1895.0'
                    totalPriceSet:
                      shopMoney:
                        amount: '1895.0'
                    taxesIncluded: true
                    taxLines:
                      - rate: 0.05
                        ratePercentage: 5
                        source: null
                        title: IGST
                        price: '90.24'
                    lineItems:
                      - title: Sample Product Name
                        quantity: 1
                        variant:
                          id: gid://shopify/ProductVariant/58523289485393
                          title: Default / Standard / Regular
                    billingAddress:
                      country: India
                      phone: '+919876543211'
                    shippingAddress:
                      country: India
                      address1: 123 Sample Street, Sample Area
                      address2: Apt 4B
                      city: Delhi
                      province: DL
                      provinceCode: DL
                      zip: '110001'
                      phone: '+919876543211'
              custom:
                summary: Example for custom variant
                description: >-
                  Use this example when the assistant variant is custom or any
                  other variant
                value:
                  phoneNumber: '+919876543210'
                  assistant: assistant_456
                  callbackUrl: https://example.com/webhooks/call-events
                  payload:
                    orderId: ORD-12345
                    customerName: Jane Smith
                    orderValue: 2500
                    status: pending
                    notes: Customer requested callback
      responses:
        '200':
          description: Call queued
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InitiateCallResponse'
        '400':
          description: Validation Error
        '404':
          description: Assistant not found
components:
  parameters:
    PublicKeyHeader:
      name: x-public-key
      in: header
      required: true
      schema:
        type: string
    PrivateKeyHeader:
      name: x-private-key
      in: header
      required: true
      schema:
        type: string
    WorkspaceHeader:
      name: workspace
      in: header
      required: true
      schema:
        type: string
  schemas:
    InitiateCallRequest:
      type: object
      required:
        - phoneNumber
        - assistant
      properties:
        phoneNumber:
          type: string
          description: Phone number (E.164 recommended)
          example: '+919876543210'
        assistant:
          type: string
          description: Assistant ID
        payload:
          anyOf:
            - $ref: '#/components/schemas/AbandonedCartPayload'
            - $ref: '#/components/schemas/CustomPayload'
          description: >-
            Payload structure depends on the assistant variant. Use
            AbandonedCartPayload for abandoned_cart assistants, CustomPayload
            for custom assistants.
        callbackUrl:
          type: string
          format: uri
          description: HTTPS webhook URL
        priority:
          type: boolean
          description: Call priority level
          example: true
        metadata:
          type: object
          properties:
            discount:
              type: object
              properties:
                code:
                  type: string
                description:
                  type: string
                value:
                  type: number
                codeType:
                  type: string
                  description: '%tage or fixed'
                applyAs:
                  type: string
                  enum:
                    - additional
                    - override
                  description: how discount is going to be applied
          additionalProperties: true
    InitiateCallResponse:
      type: object
      properties:
        status:
          $ref: '#/components/schemas/CallStatus'
        callId:
          type: string
    AbandonedCartPayload:
      type: object
      description: >-
        Payload structure for abandoned cart recovery calls. Based on Shopify
        abandoned checkout webhook.
      additionalProperties: false
      required:
        - customer
        - lineItems
        - subtotalPriceSet
        - totalDiscountSet
        - totalPriceSet
      properties:
        id:
          type: string
          description: >-
            Shopify abandoned checkout ID (e.g.,
            gid://shopify/AbandonedCheckout/...)
          example: gid://shopify/AbandonedCheckout/66509168181329
        abandonedCheckoutUrl:
          type: string
          format: uri
          description: Recovery URL for the abandoned checkout
          example: >-
            https://example-store.myshopify.com/checkouts/ac/abc123xyz/recover?key=sample_recovery_key&locale=en-IN
        customer:
          type: object
          additionalProperties: false
          required:
            - firstName
            - phone
          properties:
            firstName:
              type: string
              example: John
            lastName:
              type: string
              example: Doe
            email:
              type: string
              format: email
              nullable: true
            phone:
              type: string
              description: Customer phone number (E.164 recommended)
              example: '+919876543210'
        discountCodes:
          type: array
          description: Array of discount codes applied to the cart
          items:
            type: string
          default: []
        totalDiscountSet:
          type: object
          additionalProperties: false
          properties:
            shopMoney:
              type: object
              additionalProperties: false
              properties:
                amount:
                  type: string
                  example: '0.0'
        subtotalPriceSet:
          type: object
          additionalProperties: false
          properties:
            shopMoney:
              type: object
              additionalProperties: false
              properties:
                amount:
                  type: string
                  example: '1895.0'
        totalPriceSet:
          type: object
          additionalProperties: false
          properties:
            shopMoney:
              type: object
              additionalProperties: false
              properties:
                amount:
                  type: string
                  example: '1895.0'
        taxesIncluded:
          type: boolean
          example: true
        taxLines:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              rate:
                type: number
                example: 0.05
              ratePercentage:
                type: number
                example: 5
              source:
                type: string
                nullable: true
              title:
                type: string
                example: IGST
              price:
                type: string
                example: '90.24'
        lineItems:
          type: array
          description: Products in the abandoned cart
          minItems: 1
          items:
            type: object
            additionalProperties: false
            required:
              - title
              - quantity
            properties:
              title:
                type: string
                example: Sample Product Name
              quantity:
                type: integer
                minimum: 1
                example: 1
              variant:
                type: object
                additionalProperties: false
                required:
                  - id
                  - title
                properties:
                  id:
                    type: string
                    example: gid://shopify/ProductVariant/58523289485393
                  title:
                    type: string
                    example: Default / Standard / Regular
        billingAddress:
          type: object
          additionalProperties: false
          properties:
            country:
              type: string
              example: India
            phone:
              type: string
              example: '+919876543211'
        shippingAddress:
          type: object
          additionalProperties: false
          properties:
            country:
              type: string
              example: India
            address1:
              type: string
              example: 123 Sample Street, Sample Area
            address2:
              type: string
              example: Apt 4B
            city:
              type: string
              example: Delhi
            province:
              type: string
              example: DL
            provinceCode:
              type: string
              example: DL
            zip:
              type: string
              example: '110001'
            phone:
              type: string
              example: '+919876543211'
    CustomPayload:
      type: object
      description: >-
        Flexible payload structure for custom assistant variants. Can include
        any fields relevant to the call.
      additionalProperties: true
      example:
        orderId: ORD-12345
        customerName: Jane Smith
        orderValue: 2500
        status: pending
        notes: Customer requested callback
    CallStatus:
      type: string
      description: Current call status
      enum:
        - initiate
        - in-progress
        - ended
        - completed
        - timeout
        - failed
        - validation-failed
        - busy
        - no-answer
        - skip
        - rescheduled
        - aborted
  securitySchemes:
    PublicKeyAuth:
      type: apiKey
      in: header
      name: x-public-key
    PrivateKeyAuth:
      type: apiKey
      in: header
      name: x-private-key

````