Jump to

  • Quickstarts
  • API reference
  • Webhook events
  • Error codes
  • SDKs

API reference

Verify

How these fit together: the Verify guide.

Create verify

post/v1/verify

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-Keystring

    Makes 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

  • channelstringRequired

    How the code reaches the person: sms and whatsapp (with templateId), voice (a call that speaks it), or email.

    One ofsmswhatsappvoiceemail

  • codeLengthinteger

    Digits 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).

  • tostringRequired

    A phone number in E.164 (sms, whatsapp, voice) or an email address (email). Never answered back in full.

    at most 254 characters

  • ttlSecondsinteger

    Seconds the code is good for; verify.expired fires after.

    60–1800default 600

Response 201PublicVerify

Its fields are listed under Get verify.

Errors

Request
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"
}'
Response 201 (json)
{
  "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/v1/verify/{verifyId}

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 fields
  • approvedAtstring (date-time) | nullRequired

  • attemptsPublicVerifyAttemptsRequired

    2 fields of attempts
    • maxintegerRequired

    • usedintegerRequired

  • callIdstring (uuid) | nullRequired

    voice: the call that spoke the latest code.

  • channelstringRequired

    One ofsmswhatsappvoiceemail

  • codeLengthintegerRequired

  • createdAtstring (date-time)Required

  • endedAtstring (date-time) | nullRequired

  • expiresAtstring (date-time)Required

  • idstring (uuid)Required

  • livemodebooleanRequired

    False for a test key’s verification: nothing was sent or billed, and its code is the first codeLength digits of 1234567890.

  • metadataRecord<string, string>Required

  • objectstringRequired

    One ofverify

  • sendsPublicVerifySendsRequired

    4 fields of sends
    • countintegerRequired

    • lastSentAtstring (date-time) | nullRequired

    • maxintegerRequired

    • nextResendAtstring (date-time) | nullRequired

      When a resend is accepted; null once none may be.

  • statusstringRequired

    One ofpendingapprovedexpiredfailedcanceled

  • tostringRequired

    The destination masked: a phone’s last four digits, an email’s first letter and domain.

Errors

Request
curl 'https://api.trovacast.com/v1/verify/VERIFY_ID' \
  -H "Authorization: Bearer $TROVACAST_API_KEY"
Response 200 (json)
{
  "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/v1/verify/{verifyId}/check

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-Keystring

    Makes 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

  • codestringRequired

    The code the person typed. A wrong one counts against the verification’s attempts.

Response 200PublicVerifyCheck

  • objectstringRequired

    One ofverify_check

  • validbooleanRequired

    Whether the code was right. True approves the verification (verify.approved); false counts an attempt, and the last allowed one fails it.

  • verifyPublicVerifyRequired

    Its fields are listed under Get verify

Errors

Request
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"
}'
Response 200 (json)
{
  "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/v1/verify/{verifyId}/resend

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-Keystring

    Makes 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

Request
curl -X POST 'https://api.trovacast.com/v1/verify/VERIFY_ID/resend' \
  -H "Authorization: Bearer $TROVACAST_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
Response 200 (json)
{
  "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"
}