One-time passcodes by SMS

    SMS OTP and 2FA codes for Australian apps

    Send sign-in and verification codes from your app with one API call. 3¢ per SMS, no monthly fee, official SDKs for Node, Python, PHP and .NET.

    Start free with 5 credits

    5 free credits. No credit card. No contract.

    Texto delivers SMS one-time passcodes (OTP) and two-factor authentication (2FA) codes for Australian apps at 3¢ per message. Your app generates and checks the code, and Texto sends it through a single REST API call, with data kept on-shore in Australia and messages sent via licensed Australian carriers.

    How sending an OTP works

    1

    Your app creates the code

    When a user signs in or verifies a phone number, your app generates a short random code and stores it with an expiry time.

    2

    Texto delivers it by SMS

    Your app sends one POST request to the Texto /send endpoint with the user's number and a message containing the code.

    3

    Your app checks the code

    The user types the code into your app, and your app compares it with the stored value before it expires.

    Send a code in your language

    Put your code in the message, for example "Your Acme code is 482913. It expires in 10 minutes. Don't share it." Full details are in the SMS API reference and on the developers page.

    Send an SMS with Node.js

    No package required — Node 18+ ships with fetch

    # Node 18 and above has fetch built in.
    # On older versions, add a fetch polyfill:
    npm install node-fetch

    Send a message

    // texto.js
    const TEXTO_API_KEY = process.env.TEXTO_API_KEY;
    
    export async function sendSms({ to, message, from, campaign }) {
      const response = await fetch("https://api.texto.com.au/send", {
        method: "POST",
        headers: {
          Authorization: `Bearer ${TEXTO_API_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({ to, message, from, campaign }),
      });
    
      const data = await response.json();
      if (!response.ok) {
        throw new Error(`Texto ${response.status}: ${data.error ?? "request failed"}`);
      }
      return data;
    }
    
    const result = await sendSms({
      to: "+61412345678",
      message: "Your order has shipped.",
      campaign: "order-updates",
    });
    console.log(result.message_id, result.credits_remaining);

    Handle errors

    try {
      await sendSms({ to: "+61412345678", message: "Hello" });
    } catch (err) {
      // 401 invalid key · 402 out of credits · 422 invalid number · 429 rate limited
      console.error(err.message);
    }

    Sender and throughput

    Show your app name with an approved Sender ID, or send from a dedicated number.

    Each API key gets 50 requests per second and 25 concurrent connections by default. Higher limits are available for high-volume senders and those with higher throughput needs.

    OTP security tips

    • Expire codes after 5 to 10 minutes and allow them to be used once.
    • Limit how many codes a number can request, and how many wrong guesses it gets.
    • Keep the message short: the code, your app name and a warning not to share it.
    • Never put the code in a link, and never log it in plain text.

    What SMS 2FA costs

    Each OTP of up to 160 characters is 1 credit, or 3¢ to an Australian mobile. 10,000 codes a month is about $300. No setup fee, no monthly fee. See SMS pricing.

    Looking to receive shared login codes for your team instead? See Team SMS 2FA.

    SMS OTP and 2FA FAQs

    Send your first OTP in minutes

    3¢ per SMS, no monthly fee, and 5 free credits to test with.

    Start free with 5 credits