Use cases

Strengthen security with SMS-based 2FA

Send a unique, one-time login code via SMS as part of a two-factor authentication (2FA) process. A simple, yet powerful method of increasing account security.

Enhancing the security of your website or app with SMS-based two-factor authentication (2FA) is like adding an extra lock to the door. And with the 46elks API, it's not just secure—it's also incredibly easy.

You can use the 46elks API to send an SMS with a unique verification code when someone logs into your service. The user enters the code in the app or on the website and, if the code is correct, congratulations! The user has passed the two-factor authentication and can now securely log in.

Code Example

Below is a brief code example of how an implementation might look.

import requests

api_url = ""
api_username = "YOUR_API_KEY"
api_password = "YOUR_API_PASSWORD"

def send_verification_sms(phone_number, code):
    message = f"Your verification code is: {code}"
    response =, auth=(api_username, api_password), data={
        'from': '2FA Verify',  # Customize the sender name
        'to': phone_number,
        'message': message
    return response.json()

# Example usage:
phone_number = "+46701234567"
code = "123456"  # Generate a unique code on the server
send_verification_sms(phone_number, code)