API reference
Verify
How these fit together: the Verify guide.
Create verify
post
Sends a one-time code by SMS, WhatsApp, voice call or email.
Sends a codeLength-digit code to to, good for ttlSeconds (10 minutes by default; verify.expired fires after), and answers the verification — never the code. Billed at the channel’s message rate (a voice code is a call, rated per minute); a refused request sends and bills nothing, and a first send the provider refuses cancels the verification (502 VERIFY_DELIVERY_FAILED). Refused with 422 VERIFY_DESTINATION_INVALID or 422 VERIFY_DESTINATION_BLOCKED for a destination codes never reach, 422 VERIFY_CHANNEL_UNAVAILABLE when the channel cannot send here, 429 VERIFY_RATE_LIMITED past the per-destination or per-organization limits, and 402 BILLING_INSUFFICIENT_CREDIT when the balance cannot cover it. A test key’s verification sends and bills nothing, and its code is the first codeLength digits of 1234567890.
Access: an organization key with the verify:write scope.
Headers
Idempotency-KeystringMakes the request safe to retry: a repeat with the same key and the same body returns the stored success (with
Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. A 5xx is stored and replayed to every retry with the same key (Idempotent-Replayed: true): the first attempt may have taken effect, so check before retrying with a new key — except the errors that provably changed nothing (503 MESSAGING_TRANSPORT,503 WHATSAPP_CONNECT_UNAVAILABLE; see https://trovacast.com/developers/idempotency), which store nothing, so a retry with the same key runs again. 1–255 visible ASCII characters; kept for 24 hours.
Request body
channelstringRequiredHow the code reaches the person:
smsandwhatsapp(withtemplateId),voice(a call that speaks it), oremail.One of
smswhatsappvoiceemailcodeLengthintegerDigits in the code.
4–10default 6
metadataRecord<string, string>Your own reference strings, answered back on every read and event: at most 20 keys of 40 characters, values of 500.
senderIdstring (uuid)sms/whatsapp/email: which of your ACTIVE senders sends it; your only one when left out.templateIdstring (uuid)sms/whatsapp: one of your APPROVED templates that carries the code — an SMS template with exactly one variable (to India a DLT TRANSACTIONAL template with its DLT id), a WhatsApp AUTHENTICATION template (every variable takes the code).tostringRequiredA phone number in E.164 (
sms,whatsapp,voice) or an email address (email). Never answered back in full.at most 254 characters
ttlSecondsintegerSeconds the code is good for;
verify.expiredfires after.60–1800default 600
Response 201PublicVerify
Its fields are listed under Get verify.
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403An SMS, WhatsApp or email code passes the gates a/v1/messagessend passes: ENTITLEMENT_MESSAGING_DISABLED (the project has no messaging) or VERIFICATION_REQUIRED (its business verification is pending). A voice code is a call, held by the dial’s own gates. API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.409The channel’s send gate, as on/v1/messages: CHANNEL_NOT_CONFIGURED (no SMS settings, WhatsApp account or email account), MESSAGING_SENDER_RESTRICTED (a restricted sender, or a long code whose number is no longer the project’s), SMS_SENDER_NOT_ALLOWED / SMS_SENDER_REGISTRATION_REQUIRED (the destination country’s sender rules), SMS_HEADER_CATEGORY_MISMATCH, TEMPLATE_NOT_SENDABLE (India: no DLT template id), EMAIL_SENDING_SUSPENDED or FROM_NOT_ALLOWED. IDEMPOTENCY_KEY_IN_FLIGHT — the first request with this Idempotency-Key is still running (retry afterRetry-After); or CONFLICT.422VERIFY_DESTINATION_INVALID, VERIFY_DESTINATION_BLOCKED (premium-rate, shared-cost or high-risk number; your destination policy; a suppressed address), SMS_DESTINATION_NOT_ALLOWED (a country the project does not text), VERIFY_CHANNEL_UNAVAILABLE (no sender), VERIFY_TEMPLATE_INVALID, or a voice dial’s own refusal. IDEMPOTENCY_KEY_REUSED — this Idempotency-Key was used for a different request.429VERIFY_RATE_LIMITED — too many verifications to this destination (5 an hour, 10 a day) or by the organization (60 a minute, 10,000 a day).500INTERNAL_ERROR — our fault. With an Idempotency-Key, every retry with that key replays this answer (Idempotent-Replayed: true).502VERIFY_DELIVERY_FAILED — the channel’s provider did not accept the code; nothing was billed and the verification is canceled.
curl -X POST 'https://api.trovacast.com/v1/verify' \
-H "Authorization: Bearer $TROVACAST_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H 'Content-Type: application/json' \
-d '{
"channel": "sms",
"metadata": {
"userId": "u_123"
},
"to": "+919876543210"
}'{
"approvedAt": "2026-11-05T10:00:00.000Z",
"attempts": {
"max": 5,
"used": 0
},
"callId": "CALL_ID",
"channel": "sms",
"codeLength": 6,
"createdAt": "2026-11-05T10:00:00.000Z",
"endedAt": "2026-11-05T10:00:00.000Z",
"expiresAt": "2026-11-05T10:00:00.000Z",
"id": "ID",
"livemode": true,
"metadata": {},
"object": "verify",
"sends": {
"count": 1,
"lastSentAt": "2026-11-05T10:00:00.000Z",
"max": 5,
"nextResendAt": "2026-11-05T10:00:00.000Z"
},
"status": "pending",
"to": "•••• ••3210"
}Get verify
get
Reads a verification.
Its status (pending, approved, expired, failed or canceled), the masked destination, the attempts and sends used and when a resend is next accepted — never the code. A pending verification past expiresAt is closed as expired by this read if the sweep has not closed it yet (verify.expired fires once either way). A key reads only verifications of its own mode.
Access: an organization key with the verify:read scope.
Path parameters
verifyIdstringRequired
Response 200PublicVerify
Show the 15 fieldsHide the fields
approvedAtstring (date-time) | nullRequiredattemptsPublicVerifyAttemptsRequired2 fields of
attemptsmaxintegerRequiredusedintegerRequired
callIdstring (uuid) | nullRequiredvoice: the call that spoke the latest code.channelstringRequiredOne of
smswhatsappvoiceemailcodeLengthintegerRequiredcreatedAtstring (date-time)RequiredendedAtstring (date-time) | nullRequiredexpiresAtstring (date-time)Requiredidstring (uuid)RequiredlivemodebooleanRequiredFalse for a test key’s verification: nothing was sent or billed, and its code is the first
codeLengthdigits of 1234567890.metadataRecord<string, string>RequiredobjectstringRequiredOne of
verifysendsPublicVerifySendsRequired4 fields of
sendscountintegerRequiredlastSentAtstring (date-time) | nullRequiredmaxintegerRequirednextResendAtstring (date-time) | nullRequiredWhen a resend is accepted; null once none may be.
statusstringRequiredOne of
pendingapprovedexpiredfailedcanceledtostringRequiredThe destination masked: a phone’s last four digits, an email’s first letter and domain.
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404NOT_FOUND — no such verification.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault; retry with backoff (with the same Idempotency-Key on a write).
curl 'https://api.trovacast.com/v1/verify/VERIFY_ID' \
-H "Authorization: Bearer $TROVACAST_API_KEY"{
"approvedAt": "2026-11-05T10:00:00.000Z",
"attempts": {
"max": 5,
"used": 0
},
"callId": "CALL_ID",
"channel": "sms",
"codeLength": 6,
"createdAt": "2026-11-05T10:00:00.000Z",
"endedAt": "2026-11-05T10:00:00.000Z",
"expiresAt": "2026-11-05T10:00:00.000Z",
"id": "ID",
"livemode": true,
"metadata": {},
"object": "verify",
"sends": {
"count": 1,
"lastSentAt": "2026-11-05T10:00:00.000Z",
"max": 5,
"nextResendAt": "2026-11-05T10:00:00.000Z"
},
"status": "pending",
"to": "•••• ••3210"
}Check verify
post
Checks a one-time code.
Answers valid and the verification. A right code approves it (verify.approved fires); a wrong one counts an attempt and the fifth fails it — a wrong code is a 200 with valid: false, not an error. Refused with 409 VERIFY_NOT_PENDING once the verification is approved, expired, failed or canceled. Audited when it is approved or fails.
Access: an organization key with the verify:write scope.
Path parameters
verifyIdstringRequired
Headers
Idempotency-KeystringMakes the request safe to retry: a repeat with the same key and the same body returns the stored success (with
Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. A 5xx is stored and replayed to every retry with the same key (Idempotent-Replayed: true): the first attempt may have taken effect, so check before retrying with a new key — except the errors that provably changed nothing (503 MESSAGING_TRANSPORT,503 WHATSAPP_CONNECT_UNAVAILABLE; see https://trovacast.com/developers/idempotency), which store nothing, so a retry with the same key runs again. 1–255 visible ASCII characters; kept for 24 hours.
Request body
codestringRequiredThe code the person typed. A wrong one counts against the verification’s attempts.
Response 200PublicVerifyCheck
objectstringRequiredOne of
verify_checkvalidbooleanRequiredWhether the code was right. True approves the verification (
verify.approved); false counts an attempt, and the last allowed one fails it.verifyPublicVerifyRequiredIts fields are listed under Get verify
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404NOT_FOUND — no such verification.409VERIFY_NOT_PENDING — the verification is approved, expired, failed or canceled (statusnames which). IDEMPOTENCY_KEY_IN_FLIGHT — the first request with this Idempotency-Key is still running (retry afterRetry-After); or CONFLICT.422IDEMPOTENCY_KEY_REUSED — this Idempotency-Key was used for a different request.429RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault. With an Idempotency-Key, every retry with that key replays this answer (Idempotent-Replayed: true).
curl -X POST 'https://api.trovacast.com/v1/verify/VERIFY_ID/check' \
-H "Authorization: Bearer $TROVACAST_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H 'Content-Type: application/json' \
-d '{
"code": "123456"
}'{
"object": "verify_check",
"valid": true,
"verify": {
"approvedAt": "2026-11-05T10:00:00.000Z",
"attempts": {
"max": 5,
"used": 0
},
"callId": "CALL_ID",
"channel": "sms",
"codeLength": 6,
"createdAt": "2026-11-05T10:00:00.000Z",
"endedAt": "2026-11-05T10:00:00.000Z",
"expiresAt": "2026-11-05T10:00:00.000Z",
"id": "ID",
"livemode": true,
"metadata": {},
"object": "verify",
"sends": {
"count": 1,
"lastSentAt": "2026-11-05T10:00:00.000Z",
"max": 5,
"nextResendAt": "2026-11-05T10:00:00.000Z"
},
"status": "pending",
"to": "•••• ••3210"
}
}Resend verify
post
Sends a verification a new code.
A new code on the same channel and destination: the previous code stops working, wrong attempts still count and expiresAt does not move. At most five sends in all, thirty seconds apart, each billed. Refused with 409 VERIFY_SEND_LIMIT after five, 409 VERIFY_NOT_PENDING once it is no longer pending and 429 VERIFY_RESEND_TOO_SOON within thirty seconds of the last send (retryAfterSeconds); a 502 VERIFY_DELIVERY_FAILED leaves it pending, so resend again.
Access: an organization key with the verify:write scope.
Path parameters
verifyIdstringRequired
Headers
Idempotency-KeystringMakes the request safe to retry: a repeat with the same key and the same body returns the stored success (with
Idempotent-Replayed: true) instead of running again; a 4xx stores nothing. A 5xx is stored and replayed to every retry with the same key (Idempotent-Replayed: true): the first attempt may have taken effect, so check before retrying with a new key — except the errors that provably changed nothing (503 MESSAGING_TRANSPORT,503 WHATSAPP_CONNECT_UNAVAILABLE; see https://trovacast.com/developers/idempotency), which store nothing, so a retry with the same key runs again. 1–255 visible ASCII characters; kept for 24 hours.
Response 200PublicVerify
Its fields are listed under Get verify.
Errors
400VALIDATION_FAILED — the request is malformed.401API_KEY_INVALID — missing, unknown, revoked or expired key.403API_KEY_SCOPE_MISSING or API_KEY_KIND_MISMATCH — the key may not call this endpoint.404NOT_FOUND — no such verification.409VERIFY_NOT_PENDING (no longer pending), VERIFY_SEND_LIMIT (five codes sent already). IDEMPOTENCY_KEY_IN_FLIGHT — the first request with this Idempotency-Key is still running (retry afterRetry-After); or CONFLICT.422IDEMPOTENCY_KEY_REUSED — this Idempotency-Key was used for a different request.429VERIFY_RESEND_TOO_SOON — within thirty seconds of the last send (retryAfterSeconds). RATE_LIMITED — retry afterRetry-Afterseconds.500INTERNAL_ERROR — our fault. With an Idempotency-Key, every retry with that key replays this answer (Idempotent-Replayed: true).502VERIFY_DELIVERY_FAILED — the provider did not accept the code; nothing was billed.
curl -X POST 'https://api.trovacast.com/v1/verify/VERIFY_ID/resend' \
-H "Authorization: Bearer $TROVACAST_API_KEY" \
-H "Idempotency-Key: $(uuidgen)"{
"approvedAt": "2026-11-05T10:00:00.000Z",
"attempts": {
"max": 5,
"used": 0
},
"callId": "CALL_ID",
"channel": "sms",
"codeLength": 6,
"createdAt": "2026-11-05T10:00:00.000Z",
"endedAt": "2026-11-05T10:00:00.000Z",
"expiresAt": "2026-11-05T10:00:00.000Z",
"id": "ID",
"livemode": true,
"metadata": {},
"object": "verify",
"sends": {
"count": 1,
"lastSentAt": "2026-11-05T10:00:00.000Z",
"max": 5,
"nextResendAt": "2026-11-05T10:00:00.000Z"
},
"status": "pending",
"to": "•••• ••3210"
}