Lifecycle Overview
Step 1 — Onboard a Brand
Register your brand (Shopify store) to create a workspace with billing configuration. All subsequent API operations are scoped to this workspace.POST /v2/workspace/onboard/shopify
Authentication
| Header | Description |
|---|---|
x-public-key | Your public API key |
x-private-key | Your private API key |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Your store/brand name |
currencyCode | string | Yes | Store currency (e.g., INR, USD) |
timezone | string | Yes | Store timezone (e.g., Asia/Kolkata) |
supportContacts.phoneNumber | string | Yes | Support phone number in E.164 format |
supportContacts.email | string | No | Support email address |
trustSignals.valuePropositionOneLiner | string | Yes | One-line brand value proposition |
trustSignals.customersTillDate | integer | No | Total customers served |
trustSignals.totalOrdersFulfilled | integer | No | Total orders fulfilled |
trustSignals.storeRating | number | No | Store rating (e.g., 4.8) |
policyFramework.returnPolicy | object | No | Return window, processing fee, refund timeline |
policyFramework.shippingPolicy | object | No | Delivery timeline, free shipping threshold |
policyFramework.codPolicy | object | No | COD availability and additional fee |
200 OK)
Step 2 — Create an AI Agent
Create a voice assistant configured with a persona, language, voice, call settings, and optionally a knowledge base.POST /v1/admin/assistant/create
Headers
| Header | Required | Description |
|---|---|---|
x-public-key | Yes | Your public API key |
x-private-key | Yes | Your private API key |
workspace | Yes | Your workspace ID |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Assistant display name (max 40 chars) |
variant.type | string | Yes | Assistant type: abandoned_cart or custom |
variant.config.systemPrompt | string | No | Custom system prompt (for custom variant) |
agent.identity.name | string | Yes | Agent’s spoken name (e.g., Priya) |
agent.identity.gender | string | Yes | male or female |
agent.identity.voice | string | Yes | Voice identifier (see Voice Gallery) |
icpContext.language | string | Yes | Call language: hinglish, english, hindi, tamil, telugu, and more |
icpContext.targetAgeGroups | array | No | gen_z, millennials, gen_x, boomers |
icpContext.locationTiers | array | No | metro_urban, tier1, tier2, tier3, rural |
callSettings.slots | array | No | Time windows when calls can be made (e.g., 10:00–17:30) |
callSettings.maxCallDuration | number | No | Maximum call duration in seconds |
callSettings.concurrentCallCount | number | No | Max concurrent calls (up to 10) |
callSettings.retryProtocol | object | No | Retry behavior for no-pick-up and low-engagement calls |
analysisPlan | object | No | Success criteria and summary instructions for post-call AI analysis |
knowledgeBase.faq | array | No | FAQ pairs (question + answer) |
knowledgeBase.documents | array | No | External documents by URL (pdf, txt, docx, markdown) |
200 OK)
assistantId — it is required when initiating calls.
variant.type is immutable after creation. Choose abandoned_cart for cart recovery flows or custom for fully flexible prompts.Step 3 — Initiate a Call
Trigger an outbound call to a customer using the assistant you created.POST /v2/call/initiate
Headers
| Header | Required | Description |
|---|---|---|
x-public-key | Yes | Your public API key |
x-private-key | Yes | Your private API key |
workspace | Yes | Your workspace ID |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
phoneNumber | string | Yes | Customer’s phone number in E.164 format (e.g., +919876543210) |
assistant | string | Yes | The assistantId from Step 2 |
callbackUrl | string | Yes | HTTPS URL to receive webhook events for this call |
priority | boolean | No | Set true to jump the call queue |
payload | object | No | Call context data (customer info, cart items, pricing) passed to the AI during the call |
metadata | object | No | Arbitrary key-value pairs echoed back in every webhook event |
metadata.discount | object | No | Discount code to offer during the call (code, value, codeType, applyAs) |
payload Object
The payload provides the AI with context about the customer and their cart. All fields are optional but recommended for abandoned_cart assistants.
| Field | Type | Description |
|---|---|---|
customer.firstName | string | Customer’s first name |
customer.lastName | string | Customer’s last name |
customer.email | string | Customer’s email |
customer.phone | string | Customer’s phone |
lineItems | array | Cart items — each with title, quantity, and variant.id + variant.title |
subtotalPriceSet.shopMoney.amount | string | Cart subtotal |
totalPriceSet.shopMoney.amount | string | Cart total |
abandonedCheckoutUrl | string | Direct URL to the abandoned checkout |
shippingAddress | object | Customer’s shipping address |
200 OK)
The call is placed asynchronously. The
callId is returned immediately — real-time status updates are delivered to your callbackUrl.Step 4 — Abort a Call
Cancel a queued or in-progress call using thecallId returned during initiation.
POST /v2/call/abort
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
callId | string | Yes | The callId returned when the call was initiated |
200 OK)
callbackUrl will receive a call.aborted event.
Step 5 — Handle Callback URL & Lifecycle Events
ThecallbackUrl you provided when initiating the call receives real-time webhook events as the call progresses. Your custom metadata is echoed back in every event so you can correlate events to your internal records.
Call Lifecycle
Lifecycle Events Reference
| Event | Trigger |
|---|---|
call.initiate | Call has been queued and is dialing |
call.in-progress | Customer answered — AI conversation started |
call.ended | Phone connection dropped |
call.completed | Recording, transcript, and duration are ready |
call.timeout | Call exceeded maximum allowed duration |
end-of-call | AI analysis complete — summary and structured data available |
call.lifecycle-ended | Final event — all processing finished |
call.failed | Call could not connect |
call.busy | Customer’s line was busy |
call.no-answer | Customer did not pick up |
call.aborted | Call was cancelled via the abort API |
call.rescheduled | Retry scheduled for a later time |
Webhook Payload Structure
Every event uses the same envelope with yourmetadata echoed back:
end-of-call event additionally includes AI analysis and credit usage:
Handling Webhooks — Example
Callback URL Tips
- HTTPS required — plain HTTP endpoints are rejected.
- Respond with
200 OKimmediately — Voice Agents does not wait for your processing; slow responses may trigger retries. - Use
metadatafor correlation — pass your internal IDs (e.g.,customerId,orderId) when initiating the call; they are echoed in every event. - Verify signatures — validate the webhook signature on every incoming request. See Webhook Signature Verification.
API Summary
| Step | Method | Endpoint | Purpose |
|---|---|---|---|
| Onboard | POST | /v2/workspace/onboard/shopify | Register a brand and create a workspace |
| Create Agent | POST | /v1/admin/assistant/create | Create a voice assistant |
| Initiate Call | POST | /v2/call/initiate | Trigger an outbound call |
| Abort Call | POST | /v2/call/abort | Cancel a queued or active call |
| Receive Events | — | your callbackUrl | Handle real-time call lifecycle events |