Skip to main content

Send Verification Code

When you have collected a user's phone number, start the verification process by sending a verify request to the Verify API.

The Verify API returns a request_id. Use this to make a check request to see if the user provided the correct code.

Replace the following variables in the sample code with your own values:

KeyDescription
SENDLIME_API_KEYYour SendLime API key (see it on your dashboard).
SENDLIME_API_SECRETYour SendLime API secret (see it on your dashboard).
TO_NUMBERThe phone number to verify.
BRAND_NAMEIncluded in the message to explain who is confirming the phone number.
info

Each verification code is valid for 10 minutes. Subsequent calls to the API before the code has expired will send the same verification code. You cannot modify the amount of time a verification code is valid.

info

HTTP requests to the API are protected with HTTP Basic authentication.

User your API Key as the username and your API Secret as the password for HTTP Basic authentication.

Write the code

Add the following to send-verification-code.sh:

curl -X "POST" "https://brain.sendlime.com/verify" \
-d "phone_number=$TO_NUMBER" \
-d "brand=$BRAND_NAME" \
-u $SENDLIME_API_KEY:$SENDLIME_API_SECRET

Run your code

Save this file to your machine and run it:

sh send-verification-code.sh

Try it out

When you run the example above, the verification code will be sent to the mobile number that you specified.