Skip to content

One-time passwords (OTPs)

Generate and verify one-time passwords for secure authentication and verification flows.

Use One-Time Passwords (OTPs) to confirm that a customer controls a phone number or email address before you sign them in, change sensitive account data, or approve an action. Inttegro generates and sends the time-limited code; your application should continue only after verification returns a

Inttegro.OtpVerificationVerdicts.Pass verdict.

The OTP transaction object

An OTP transaction represents one code from generation through delivery and verification. Initiation and lookup responses never expose the generated code: collect the code from the customer, then submit that value to the verify endpoint.

Properties

TypeScript SDK responseOtpTransactionv15.0.0

Initiate OTP transaction POST /otp/initiate

Generate a one-time password, deliver it by SMS to an international phone number or by email to a bare email address, and return a typed transaction ID for verification.

Required attributes

TypeScript SDK requestInitiateOtpRequestv15.0.0
  • #recipientstring

    International phone number that will receive SMS, such as +233241234567, or a bare email address. The transport is inferred unless specified.

  • #serviceNamestring

    Service or application name substituted for {service} in the message template. Length: 2-20 characters.

  • #purposeOTPPurposerequired

    Intent of the verification flow. Supported values are account_creation, account_recovery, email_verification, financial_account_verification, password_reset, payment_confirmation, payment_method_verification, payout_confirmation, phone_verification, sensitive_action, sign_in, transaction_confirmation, and unspecified. Unsupported values are rejected. Use unspecified explicitly for a general verification request.

  • #tokenSizenumber

    Generated token length. The current API requires a value from 5 through 10, inclusive.

Optional attributes

TypeScript SDK requestInitiateOtpRequestv15.0.0

The fully rendered SMS, including the generated code and substituted service name, must be no longer than 120 characters; email text is limited to 2,048 characters. The transaction expires after its validity window even if delivery is delayed.

For email OTP, send a bare email recipient. The {service_name} <noreply@inttegro.com> From mailbox and delivery route are selected automatically:

{
  "recipient": "customer@example.com",
  "service_name": "Inttegro",
  "token_size": 6,
  "purpose": "sign_in"
}

The verification request uses the returned transaction ID, this same recipient, and the code supplied by the customer.

Response

With synchronous delivery, inspect transmission.status: Inttegro.OtpTransmissionStatuses.Submitted means the SMS message was submitted for delivery, Inttegro.OtpTransmissionStatuses.Delivered means delivery was confirmed, and Inttegro.OtpTransmissionStatuses.Failed means the delivery attempt failed. For email, accepted means the delivery service accepted the send; it does not prove inbox delivery.

Request

POST/otp/initiate
cURLbash
curl https://api.inttegro.com/otp/initiate \
-H "Authorization: Bearer $INTTEGRO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: otp-login-67890" \
-d '{
"message_template": "Your {service} code is {token}.",
"purpose": "transaction_confirmation",
"recipient": "+233241234567",
"sender": "Acme",
"service_name": "Acme Bank",
"token_alphabet_type": "numeric",
"token_size": 6,
"validity_duration_in_minutes": 10
}'
TypeScripttypescript
import { InttegroClient } from '@inttegro/inttegro-sdk'

const inttegro = new InttegroClient({
  apiKey: process.env.INTTEGRO_API_KEY!,
})

const result = await inttegro.otp.initiate({
  messageTemplate: "Your {service} code is {token}.",
  purpose: "transaction_confirmation",
  recipient: "+233241234567",
  sender: "Acme",
  serviceName: "Acme Bank",
  tokenAlphabetType: "numeric",
  tokenSize: 6,
  validityDurationInMinutes: 10,
})
Gogo
package main

import (
  "context"
  "log"
  "os"

  inttegro "github.com/inttegro/inttegro-sdk-go/v14"
  "github.com/inttegro/inttegro-sdk-go/v14/otp"
  "github.com/inttegro/inttegro-sdk-go/v14/request"
)

func main() {
  ctx := context.Background()
  client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))

  params := otp.InitiateParams{
    MessageTemplate: "Your {service} code is {token}.",
    Purpose: "transaction_confirmation",
    Recipient: "+233241234567",
    Sender: "Acme",
    ServiceName: "Acme Bank",
    TokenAlphabetType: otp.AlphabetTypeNumeric,
    TokenSize: 6,
    ValidityDurationInMinutes: 10,
  }
  result, err := client.Otp.Initiate(ctx, params, request.WithIdempotencyKey("otp-login-67890"))
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
Pythonpython
import os

import inttegro
from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])

result = client.otp.initiate(inttegro.otp.InitiateRequest(
  message_template="Your {service} code is {token}.",
  purpose="transaction_confirmation",
  recipient="+233241234567",
  sender="Acme",
  service_name="Acme Bank",
  token_alphabet_type="numeric",
  token_size=6,
  validity_duration_in_minutes=10,
))
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->otp->initiate([
  'message_template' => 'Your {service} code is {token}.',
  'purpose' => 'transaction_confirmation',
  'recipient' => '+233241234567',
  'sender' => 'Acme',
  'service_name' => 'Acme Bank',
  'token_alphabet_type' => 'numeric',
  'token_size' => 6,
  'validity_duration_in_minutes' => 10,
]);
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.otp.initiate(
  message_template: "Your {service} code is {token}.",
  purpose: "transaction_confirmation",
  recipient: "+233241234567",
  sender: "Acme",
  service_name: "Acme Bank",
  token_alphabet_type: "numeric",
  token_size: 6,
  validity_duration_in_minutes: 10
)
Javajava
import com.inttegro.Client;
import com.inttegro.otp.InitiateOtpParams;
import com.inttegro.otp.OtpAlphabetType;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var params = InitiateOtpParams.builder()
      .messageTemplate("Your {service} code is {token}.")
      .purpose("transaction_confirmation")
      .recipient("+233241234567")
      .sender("Acme")
      .serviceName("Acme Bank")
      .tokenAlphabetType(OtpAlphabetType.NUMERIC)
      .tokenSize(6)
      .validityDurationInMinutes(10)
      .build();
    var result = client.otp().initiate(params);
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.Otp.InitiateAsync(new {
  message_template = "Your {service} code is {token}.",
  purpose = "transaction_confirmation",
  recipient = "+233241234567",
  sender = "Acme",
  service_name = "Acme Bank",
  token_alphabet_type = "numeric",
  token_size = 6,
  validity_duration_in_minutes = 10,
});
Responsejson
{
  "transaction": {
    "expires_at": "2026-08-28T10:10:00Z",
    "full_message": "Your Acme Bank code is {token}.",
    "id": "ot_<TRANSACTION_ID>",
    "initiated_at": "2026-08-28T10:00:00Z",
    "status": "pending_verification",
    "transmission": {
      "recipient": "+233241234567",
      "sender_id": "Acme",
      "sent_at": "2026-08-28T10:00:01Z",
      "sent_via": "sms",
      "status": "submitted"
    }
  }
}

Verify OTP POST /otp/verify

Record a verification attempt for a user-submitted token. An HTTP 200 response means the attempt was recorded; it does not mean the token matched. Authorize the user or action only when verificationAttempt.result.verdict is Inttegro.OtpVerificationVerdicts.Pass.

Required attributes

TypeScript SDK requestVerifyOtpRequestv15.0.0

The current transaction accepts at most five recorded attempts; after that, initiate a new transaction.

Response

Returns both transaction and verificationAttempt. The attempt contains verificationAttempt.attemptedAt, verificationAttempt.id, verificationAttempt.presentedToken, verificationAttempt.recipient, and verificationAttempt.result. verificationAttempt.result.verdict is Inttegro.OtpVerificationVerdicts.Pass or Inttegro.OtpVerificationVerdicts.Fail; verificationAttempt.result.detail is omitted for a passing result and explains a failed match when available. Treat verificationAttempt.presentedToken as sensitive and exclude verification request and response bodies from logs. Matching and non-matching tokens both produce a successful response. Use verificationAttempt.result.verdict to determine whether verification passed.

Request

POST/otp/verify
cURLbash
response=$(curl https://api.inttegro.com/otp/verify \
-H "Authorization: Bearer $INTTEGRO_API_KEY" \
-H "Idempotency-Key: otp-verify-67890" \
-H "Content-Type: application/json" \
-d '{
"recipient": "+233241234567",
"token": "<OTP_CODE_FROM_USER>",
"transaction_id": "ot_<TRANSACTION_ID>"
}')

jq -e '.verification_attempt.result.verdict == "pass"' <<< "$response"
TypeScripttypescript
import { InttegroClient } from '@inttegro/inttegro-sdk'

const inttegro = new InttegroClient({
  apiKey: process.env.INTTEGRO_API_KEY!,
})

const result = await inttegro.otp.verify({
  recipient: "+233241234567",
  token: "<OTP_CODE_FROM_USER>",
  transactionId: "ot_<TRANSACTION_ID>",
})
Gogo
package main

import (
  "context"
  "log"
  "os"

  inttegro "github.com/inttegro/inttegro-sdk-go/v14"
  "github.com/inttegro/inttegro-sdk-go/v14/otp"
  "github.com/inttegro/inttegro-sdk-go/v14/request"
)

func main() {
  ctx := context.Background()
  client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))

  params := otp.VerifyParams{
    Recipient: "+233241234567",
    Token: "<OTP_CODE_FROM_USER>",
    TransactionID: "ot_<TRANSACTION_ID>",
  }
  result, err := client.Otp.Verify(ctx, params, request.WithIdempotencyKey("otp-verify-67890"))
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
Pythonpython
import os

import inttegro
from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])

result = client.otp.verify(inttegro.otp.VerifyRequest(
  recipient="+233241234567",
  token="<OTP_CODE_FROM_USER>",
  transaction_id="ot_<TRANSACTION_ID>",
))
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->otp->verify([
  'recipient' => '+233241234567',
  'token' => '<OTP_CODE_FROM_USER>',
  'transaction_id' => 'ot_<TRANSACTION_ID>',
]);
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.otp.verify(
  recipient: "+233241234567",
  token: "<OTP_CODE_FROM_USER>",
  transaction_id: "ot_<TRANSACTION_ID>"
)
Javajava
import com.inttegro.Client;
import com.inttegro.otp.VerifyOtpParams;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var params = VerifyOtpParams.builder()
      .recipient("+233241234567")
      .token("<OTP_CODE_FROM_USER>")
      .transactionId("ot_<TRANSACTION_ID>")
      .build();
    var result = client.otp().verify(params);
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.Otp.VerifyAsync(new {
  recipient = "+233241234567",
  token = "<OTP_CODE_FROM_USER>",
  transaction_id = "ot_<TRANSACTION_ID>",
});
A failed match still returns HTTP 200 with a Inttegro.OtpVerificationVerdicts.Fail verdict. The API echoes the submitted value as verificationAttempt.presentedToken; the example uses a placeholder so no real code is exposed.
Response (failed match)json
{
  "verification_attempt": {
    "attempted_at": "2026-08-28T10:03:00Z",
    "id": "ov_<ATTEMPT_ID>",
    "presented_token": "<OTP_CODE_FROM_USER>",
    "recipient": "+233241234567",
    "result": {
      "detail": "token_mismatch",
      "verdict": "fail"
    }
  },
  "transaction": {
    "expires_at": "2026-08-28T10:10:00Z",
    "full_message": "Your Acme Bank code is {token}.",
    "id": "ot_<TRANSACTION_ID>",
    "initiated_at": "2026-08-28T10:00:00Z",
    "status": "pending_verification",
    "transmission": {
      "recipient": "+233241234567",
      "sender_id": "Acme",
      "sent_at": "2026-08-28T10:00:01Z",
      "sent_via": "sms",
      "status": "submitted"
    }
  }
}

Lookup OTP transaction POST /otp/lookup

Retrieve details of an existing OTP transaction by its ID. Check transaction status, delivery state, and verification status.

Required attributes

TypeScript SDK requestLookupOtpRequestv15.0.0

Response

Returns the transaction without the generated code or verification-attempt history. Optional cancellation and delivery-attempt fields are omitted when they do not apply.

Request

POST/otp/lookup
cURLbash
curl https://api.inttegro.com/otp/lookup \
-H "Authorization: Bearer $INTTEGRO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"transaction_id": "ot_<TRANSACTION_ID>"
}'
TypeScripttypescript
import { InttegroClient } from '@inttegro/inttegro-sdk'

const inttegro = new InttegroClient({
  apiKey: process.env.INTTEGRO_API_KEY!,
})

const result = await inttegro.otp.lookup({
  transactionId: "ot_<TRANSACTION_ID>",
})
Gogo
package main

import (
  "context"
  "log"
  "os"

  inttegro "github.com/inttegro/inttegro-sdk-go/v14"
  "github.com/inttegro/inttegro-sdk-go/v14/otp"
)

func main() {
  ctx := context.Background()
  client := inttegro.NewClient(os.Getenv("INTTEGRO_API_KEY"))

  params := otp.LookupParams{
    TransactionID: "ot_<TRANSACTION_ID>",
  }
  result, err := client.Otp.Lookup(ctx, params)
  if err != nil {
    log.Fatal(err)
  }
  _ = result
}
Pythonpython
import os

import inttegro
from inttegro import InttegroClient

client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])

result = client.otp.lookup(inttegro.otp.LookupRequest(
  transaction_id="ot_<TRANSACTION_ID>",
))
PHPphp
<?php

use Inttegro\Client;

$client = new Client($_ENV['INTTEGRO_API_KEY']);
$result = $client->otp->lookup([
  'transaction_id' => 'ot_<TRANSACTION_ID>',
]);
Rubyruby
require "inttegro"

client = Inttegro::Client.new(api_key: ENV.fetch("INTTEGRO_API_KEY"))
result = client.otp.lookup(
  transaction_id: "ot_<TRANSACTION_ID>"
)
Javajava
import com.inttegro.Client;
import com.inttegro.otp.LookupOtpParams;

public class Example {
  public static void main(String[] args) throws Exception {
    var client = new Client(System.getenv("INTTEGRO_API_KEY"));
    var params = LookupOtpParams.builder()
      .transactionId("ot_<TRANSACTION_ID>")
      .build();
    var result = client.otp().lookup(params);
  }
}
C#csharp
using Inttegro;

using var inttegro = new InttegroClient(
    Environment.GetEnvironmentVariable("INTTEGRO_API_KEY")!
);
var result = await inttegro.Otp.LookupAsync(new {
  transaction_id = "ot_<TRANSACTION_ID>",
});
Responsejson
{
  "transaction": {
    "expires_at": "2026-08-28T10:10:00Z",
    "full_message": "Your Acme Bank code is {token}.",
    "id": "ot_<TRANSACTION_ID>",
    "initiated_at": "2026-08-28T10:00:00Z",
    "status": "pending_verification",
    "transmission": {
      "recipient": "+233241234567",
      "sender_id": "Acme",
      "sent_at": "2026-08-28T10:00:01Z",
      "sent_via": "sms",
      "status": "submitted"
    }
  }
}
  • Create customer - Associate verified contact details with a customer record.
  • Send Chime - Send transactional SMS and email notifications after verification.

Type to search…

↑↓ navigate↵ selectEsc close