Verify OTP Codes
  • 26 Mar 2024
  • 1 Minute to read

    Verify OTP Codes


      Article Summary

      Overview

      The Verify API enables you to generate, send, and verify OTP codes for the SMS channel. You can utilize this API to generate OTP codes as defined in the payloads. Integrating it into your own websites or apps, you can trigger it on login pages, payment pages, and more.

      After you create your channel for your brand and update the templates, you need to perform the verify action for your OTP.

      Endpoint and Headers

      POST https://verify.useinsider.com/v1/check

      Headers

      HeaderSample ValueDescription
      X-INS-AUTH-KEY1a2b3c4d5e6fThis key is required to authorize your request. Refer to API Authentication Tokens to generate your token.
      Content-Typeapplication/jsonThis header specifies the media type of the resource.

      Body Parameters

      ParameterDescriptionData TypeRequiredRules
      toSpecifies the destination phone number in E.164 format to which the OTP code will be sent.
      StringYese164
      codeRepresents the OTP code provided for verification. The code length must be between 4 and 8 digits.
      Integer
      No (Default: 4)
      min:4 max:8

      Sample Example

      Sample Request

      Every request made to the request endpoint requires a request body formatted in JSON and containing your parameters. 

      Your title goes here
      Make sure to replace the sample values in the request header(s) and body where required before sending your request.
      curl --location 'verify.useinsider.com/v1/check' \
      --header 'Content-Type: application/json' \
      --header 'x-ins-auth-key: 1a2b3c4d5e6f' \
      --data '{
          "to": "+905XXXXXXXXX",
          "code": 1234
      }'

      Sample Responses

      202 Accepted

      This response indicates that your request was successfully completed.

      {
          "status": "success"
      }

      400 Bad Request

      {
          "errors": [
              {
                  "message": "invalid request payload"
              }
          ]
      }

      401 Unauthorized

      {
          "errors": [
              {
                  "message": "invalid code"
              }
          ]
      }

      401 Unauthorized

      {
          "errors": [
              {
                  "message": "unauthorized"
              }
          ]
      }

      404 Not found

      {
          "errors": [
              {
                  "message": "code not found",
                  "field": "code"
              }
          ]
      }

      429 Too Many Requests

      {
          "errors": [
              {
                  "message": "rate limit exceeded"
              }
          ]
      }

      429 Too Many Requests

      {
          "errors": [
              {
                  "message": "maximum attempts exceeded",
                  "field": "code"
              }
          ]
      }

      500 Internal Server Error

      {
          "errors": [
              {
                  "message": "server error"
              }
          ]
      }

      Limitations

      • All functions must be executed with a simple HTTPS POST request.
      • The API Key should be provided as the authorization key on the request header. If the key is incorrect, the operation will not be executed and an authorization error will return in the response.

      Was this article helpful?


      What's Next
      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses