Developers

Integrate SMS sending directly into your applications with a simple HTTP API.

API key authentication

Every request is authenticated with an API key specific to your account, passed in the Authorization header. Generate and revoke your keys from the Developers section of your account.

Main endpoints

An overview of the available operations; full details of parameters, responses and error codes are in the reference documentation.

Send an SMS

Send a message to one or several recipients, one at a time or in bulk.

Message status

Query the delivery status of a previously sent message.

Webhooks

Receive a notification on your server whenever a message's status changes.

OTP as a service

Generate a verification code and send it by SMS, then verify the code your users enter — without building the sending or expiry logic yourself.

A look at the integration

The same call, over HTTP or with the official packages, in the language of your choice.

Over HTTP

curl -X POST "https://api.labyrinthe-rdc.com/api/public/v1/sms" \
  -H "Authorization: Bearer lsk_test_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: order-1042-ready" \
  -H "Content-Type: application/json" \
  -d '{"recipient":"243812345678","body":"Votre commande 1042 est prête.","reference":"CMD-1042"}'

With the packages

<?php
use Labyrinthe\Connect\Client;

$client = new Client('lsk_test_xxxxxxxxxxxxxxxx'); // or Client::fromEnv() (LABYRINTHE_API_KEY)

$message = $client->sms->send(
    to: '243812345678',
    body: 'Votre commande 1042 est prête.',
    reference: 'CMD-1042',
    idempotencyKey: 'order-1042-ready', // replaying within 24 h sends nothing again
);

echo $message->id, ' ', $message->status->value; // queued

Example based on the real, stable API contract: full reference on /developpeurs/docs.

Packages for every language

Official SDKs at version 1.2.0: authentication, retries, idempotency, typed errors and webhook verification already handled.

All packages

OTP as a service

Send a verification code, then verify the one entered by the user.

Over HTTP

curl -X POST "https://api.labyrinthe-rdc.com/api/public/v1/otp/send" \
  -H "Authorization: Bearer lsk_test_xxxxxxxxxxxxxxxx" \
  -H "Idempotency-Key: login-7f3a9c" \
  -H "Content-Type: application/json" \
  -d '{"phone":"243812345678","locale":"fr"}'

1. Send the code (packages)

<?php
use Labyrinthe\Connect\Client;
use Labyrinthe\Connect\Exception\OtpResendTooSoonException;

$client = new Client('lsk_test_xxxxxxxxxxxxxxxx'); // or Client::fromEnv() (LABYRINTHE_API_KEY)

try {
    $otp = $client->otp->send('243812345678', locale: 'fr', idempotencyKey: 'login-'.session_id());
} catch (OtpResendTooSoonException $e) {
    exit('Wait '.$e->getRetryAfter().' s before asking for a new code.');
}

$_SESSION['otp_id'] = $otp->otpId;   // keep it server-side
$otp->codeLength;                     // 6
$otp->resendAfterSeconds;             // 60, for a "Resend" countdown
$otp->testCode();                     // '482913' with a lsk_test_ key, null in live

2. Verify the code (packages)

<?php
use Labyrinthe\Connect\Client;

$client = new Client('lsk_test_xxxxxxxxxxxxxxxx'); // or Client::fromEnv() (LABYRINTHE_API_KEY)

$result = $client->otp->verify($_SESSION['otp_id'], $_POST['code']);

if ($result->verified) {
    unset($_SESSION['otp_id']); // phone verified: log the user in
} elseif ($result->reason?->value === 'invalid_code') {
    echo 'Wrong code, ', $result->attemptsRemaining, ' attempt(s) left.';
} else {
    echo 'Code expired or blocked: ask for a new one.'; // expired, max_attempts_reached, already_used
}

Example based on the real, stable API contract: full reference on /developpeurs/docs.

View documentation