SurvX

Listening…

Developers

API documentation

Trigger a SurvX voice-feedback invite from your own website, HIS, PMS, or booking tool. Every key, secret, phone number, and email on this page is a dummy example — they will not authenticate.

POST/api/v1/trigger-voice

Trigger voice feedback

Create a unique SurvX feedback link and deliver it to a customer from your website or backend. SurvX does not need to host that portal — you call this API at checkout, discharge, or appointment close.

Snippets use YOUR_API_KEY / YOUR_API_SECRET as placeholders. Running them unchanged returns 401 Invalid API credentials. Paste live keys from the dashboard (Integration → API Keys). Call this API from your server, not a public browser page.

How it works

  1. Your system already knows the customer (phone or email) after a visit, order, or appointment.
  2. Your server (never a public browser bundle) sends POST /api/v1/trigger-voice with API credentials stored as environment variables.
  3. SurvX creates a short-lived feedback URL. Send now, or pass delayMinutes / scheduledAt so SMS/email goes later. One credit is deducted only after delivery succeeds.
  4. The customer opens the link and records voice. Results appear in the SurvX dashboard under Voices.
Keep X-API-Secret on the server. Do not embed keys in a public website, mobile app, or GitHub. If the frontend must fire the invite, proxy through your own backend.

Prerequisites

  • An active API key for the same branch you send in business_unit — generate it in the dashboard under Integration → API Keys.
  • Available invite credits for that channel (SMS or email) on the branch.
  • SMS: an active DLT Feedback template selected in Business settings. DLT variable slots are ~30 characters; SurvX keeps the feedback URL short (no www).
  • Email: no DLT template. A valid email is enough (demo: customer@example.com).

Authentication

Send both headers on every request. The key is bound to one business unit; the body must use that same unit.

Header

X-API-Key

Required

Yes

Replace with

YOUR_API_KEY

Header

X-API-Secret

Required

Yes

Replace with

YOUR_API_SECRET

Header

Content-Type

Required

Yes

Replace with

application/json

Endpoint

Production base URL: https://api.survx.co

Method

POST

Path

/api/v1/trigger-voice

Notes

Partner alias — use this from external systems.

Method

POST

Path

/v1/integration/trigger-voice

Notes

Same handler under the integration router.

Request body

JSON object. Fields are validated before any message is sent.

Field

channel

Type

string

Required

Yes

Description

Delivery channel. One of sms or email.

Field

msg_template

Type

string

Required

Yes

Description

Voice form shown after the customer opens the link. One of basic, t1, or t2 (case-insensitive).

Field

business_unit

Type

string

Required

Yes

Description

Five-character branch code that owns the API key. Demo value: ABC12.

Field

mobile

Type

string

Required

sms

Description

Customer mobile. 10-digit Indian number, or +91 / 91 prefix. Demo value: 9000012345.

Field

email

Type

string

Required

email

Description

Recipient email. Required when channel is email. Demo value: customer@example.com.

Field

campaignName

Type

string

Required

No

Description

Optional label in SurvX (2–120 characters). Defaults to Triggered Voice Invite.

Field

expiresInHours

Type

integer

Required

No

Description

Link lifetime in hours, 1–168 (7 days). Starts when the invite is actually sent. Defaults to 168 hours.

Field

delayMinutes

Type

integer

Required

No

Description

Wait this many minutes, then send SMS/email. 1–43200 (30 days). Ignored if scheduledAt is set. Omit or 0 to send now.

Field

scheduledAt

Type

string

Required

No

Description

ISO date-time to send the invite (must be in the future, max 30 days). Example: 2026-09-10T18:30:00.000Z. SMS/email is not sent until this time.

msg_template values

  • basic — voice note, star rating, written comment, photo/video.
  • t1 — hold-to-record voice plus a single overall rating.
  • t2 — custom question groups configured for the branch.

Code samples

Replace YOUR_API_KEY, YOUR_API_SECRET, ABC12, and the sample mobile/email with values from your dashboard and your customer. Placeholders never send a real invite (401).

cURL
curl -sS -X POST "https://api.survx.co/api/v1/trigger-voice" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-API-Secret: YOUR_API_SECRET" \
  -d '{"channel":"sms","mobile":"9000012345","msg_template":"basic","business_unit":"ABC12"}'

Email channel

Use channel: "email" and email instead of mobile.

Email body
{
  "channel": "email",
  "email": "customer@example.com",
  "msg_template": "basic",
  "business_unit": "ABC12"
}

Delay and schedule

Same as dashboard Outreach → When to send. Call the API from your server when the visit ends; SurvX waits, then sends SMS/email. Credits and daily limits apply at send time. The feedback URL stays inactive until then. If many invites are due at once, SurvX sends them at the branch pace and retries for up to 24 hours.

  • delayMinutes — wait this many minutes (dashboard presets: 5, 15, 30, 60, 120, 360, 1440).
  • scheduledAt — ISO UTC clock time, must be in the future, max 30 days. If both are sent, scheduledAt wins.
  • Success is still HTTP 201 with scheduled: true and deliveredVia: null.
cURL — delay 30 minutes
curl -sS -X POST "https://api.survx.co/api/v1/trigger-voice" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-API-Secret: YOUR_API_SECRET" \
  -d '{"channel":"sms","mobile":"9000012345","msg_template":"basic","business_unit":"ABC12","delayMinutes":30}'

cURL — schedule at a UTC time
curl -sS -X POST "https://api.survx.co/api/v1/trigger-voice" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "X-API-Secret: YOUR_API_SECRET" \
  -d '{"channel":"email","email":"customer@example.com","msg_template":"basic","business_unit":"ABC12","scheduledAt":"2026-09-12T18:30:00.000Z"}'

Success — 201 Created

Immediate send: HTTP 201 and deliveredVia is sms or email. Delayed/scheduled send: also 201, with scheduled: true, scheduledAt, and deliveredVia: null until the worker sends the message (checks every 15 seconds).

201 JSON — sent now
{
  "ok": true,
  "scheduled": false,
  "business_unit": "ABC12",
  "channel": "sms",
  "msg_template": "basic",
  "feedbackUrl": "https://survx.co/?V=XXXXX",
  "broadcastId": "0000000000000000001",
  "linkId": "0000000000000000002",
  "expiresAt": "2026-08-30T12:00:00.000Z",
  "deliveredVia": "sms"
}

201 JSON — scheduled
{
  "ok": true,
  "scheduled": true,
  "scheduledAt": "2026-09-10T18:30:00.000Z",
  "business_unit": "ABC12",
  "channel": "sms",
  "msg_template": "basic",
  "feedbackUrl": "https://survx.co/?V=XXXXX",
  "broadcastId": "0000000000000000001",
  "linkId": "0000000000000000002",
  "expiresAt": "2026-09-17T18:30:00.000Z",
  "deliveredVia": null
}

Error format

Failures return JSON { "error": string, "code"?: string }. Do not retry blindly on 400 / 401 / 403.

HTTP

401

code

When it happens

Missing or invalid X-API-Key / X-API-Secret, or the key is expired or inactive.

HTTP

400

code

VALIDATION_ERROR

When it happens

JSON body fails schema (wrong channel, missing mobile/email, invalid BU format, etc.).

HTTP

403

code

BU_MISMATCH

When it happens

business_unit does not match the branch scoped to this API key.

HTTP

404

code

BU_NOT_FOUND

When it happens

The business unit is missing or inactive.

HTTP

402

code

CREDITS_EXHAUSTED

When it happens

This branch has no remaining SMS or email credits. The invite is not sent.

HTTP

429

code

SEND_RATE_LIMITED

When it happens

This branch is sending SMS/email faster than its paced rate. Wait retryAfterSeconds (typically 1–5s) and retry.

HTTP

429

code

DAILY_RATE_LIMIT_EXCEEDED

When it happens

This branch used its rolling 24-hour SMS or email quota (default 2000 each). Wait until the window resets.

HTTP

429

code

When it happens

More than 300 requests per minute for this IP + API key.

HTTP

502

code

DELIVERY_FAILED / SMS_PROVIDER_ERROR

When it happens

Invite was created but SMS or email delivery failed. Credits are not charged in that case.
Example error
{
  "error": "business_unit does not match the business unit scoped to this API key",
  "code": "BU_MISMATCH"
}

Limits and billing

  • Per-branch pacing: a short burst, then about one SMS/email every 1–5 seconds (configurable). Faster calls return 429 with SEND_RATE_LIMITED and retryAfterSeconds.
  • Per-branch daily quota: default 2000 SMS and 2000 emails per rolling 24 hours. Over the quota you receive 429 with DAILY_RATE_LIMIT_EXCEEDED.
  • Edge rate limit: 300 requests per minute per client IP and API key (429 when exceeded).
  • One invite credit is charged only after delivery succeeds.
  • Typical pattern: after checkout or discharge, your backend calls SurvX once per customer — not on every page view.

Need access? Request a demo and generate live keys in the dashboard.