Verify API - Get started with email

📘

NOTE:

To add this product to your account, contact a Telesign expert. This product is available for full-service accounts only.

This page walks you step-by-step through how to use the Telesign Verify API to send an email message to an end-user with a one-time passcode (OTP) generated by Telesign. It also explains how to test if input from an end-user matches that code, so you can complete verification.

Keep the reference pages Create a verification process and Update a verification process open in another window while you work on these steps.

Steps

Send the SMS

  1. Send a Create a verification process request to the Verify API. Include the following param values:

    ParameterValueDescriptionRequired?
    recipient.phone_numberDigits without spaces or special characters, beginning with the country dialing code.The recipient's phone numberyes
    verification_policy[0].methodemailOne of the verification methods included in a verification policy.Required only if email is not already defined as the primary verification method for this account's default verification policy.
    verification_policy[0].fallback_timeA time in seconds.The time window in seconds that the service waits before abandoning the current verification method and then initiating verification using the next method.No, but recommended in case your recipient cannot be reached by email.
    verification_policy[1].methodsmsOne of the verification methods included in a verification policy. This is your backup method.No, but recommended in case your recipient cannot be reached by email.

    Request

    POST /verification HTTP/1.1
    Authorization: Basic 12345678-9ABC-DEF0-1234-56789ABCDEF0:Uak4fcLTTH/Tv8c/Q6QMwl5t4ck=
    Content-Type: application/json; charset=utf-8
    Host: verify.telesign.com
    {
      "recipient": {
        "phone_number": "11234567890"
      },
      "verification_policy": [
        {
          "method": "email",
          "fallback_time": 30
        },
        {
          "method": "sms",
          "fallback_time": 30
        }
      ]
    }
    
  2. The service then sends an email message to your end user, inserting a randomly generated OTP in the message.

  3. Save the value of the property reference_id from the response. You will need it to complete the verification flow.

  4. The status.code and status.description properties in the response indicate the preliminary delivery status of the SMS.

    Response

    HTTP/1.1 200 OK
    Content-Type: application/json
    {
      "reference_id": "0123456789ABCDEF0123456789ABCDEF",
      "recipient": {
        "phone_number": "11234567890"
      },
      "state": "ONGOING",
      "verification_policy": [
        {
          "method": "email",
          "fallback_time": 30
        },
        {
          "method": "sms",
          "fallback_time": 30
        }
      ],
      "status": {
        "code": 3901,
        "description": "Request in progress"
      }
    }
    

    📘

    NOTE:

    The status.code property gives you status of delivery to the destination carrier, not necessarily all the way to the end-user.

Complete verification and get delivery status

Once your end-user has submitted a potential code through your application, complete the verification flow with a second API call.

  1. Send an Update a verification process request to the Verify API. This is to provide Telesign with the asserted OTP from the end user.

    ParameterValueDescriptionRequired?
    actionfinalizeSpecifies how you want to change the verification state for this verification process.yes
    security_factorA string consisting of a series of numeric digits.A token you pass to Telesign, as an element to be used in the verification process. When using the email verification method, the security factor is the end user's asserted one-time passcode (OTP).yes

    Request

    PATCH /verification/0123456789ABCDEF0123456789ABCDEF/state HTTP/1.1
    Authorization: Basic 12345678-9ABC-DEF0-1234-56789ABCDEF0:Uak4fcLTTH/Tv8c/Q6QMwl5t4ck=
    Content-Type: application/json; charset=utf-8
    Host: verify.telesign.com
    {
      "action": "finalize",
      "security_factor": "5724433"
    }
    

    Response

    HTTP/1.1 200 OK
    Content-Type: application/json
    {
      "status": {
        "code": 3900,
        "description": "Verified"
      }
    }
    
  2. If the value of the status.description property is Verified, the verification completed successfully.