Home Features Developers Pricing Documentation
Login Get Started

Built for developers

A predictable REST API, sane defaults, and documentation that respects your time.

Base URL

http://twatumi.local/v1

Send an SMS

curl -X POST http://twatumi.local/v1/messages \
-H "Authorization: Bearer tw_live_xxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
    "to": "264811234567",
    "message": "Your verification code is 483921"
}'

CodeIgniter 4

<?php

namespace App\Services;

use CodeIgniter\HTTP\CURLRequest;

class TwatumiService
{
    protected CURLRequest $client;

    public function __construct()
    {
        $this->client = service('curlrequest');
    }

    public function sendSms(string $to, string $message): array
    {
        $response = $this->client->post(
            'http://twatumi.local/v1/messages',
            [
                'headers' => [
                    'Authorization' => 'Bearer ' . env('TWATUMI_API_TOKEN'),
                    'Content-Type'  => 'application/json',
                ],
                'json' => [
                    'to'      => $to,
                    'message' => $message,
                ],
            ]
        );

        return json_decode($response->getBody(), true);
    }
}

More examples (PHP, JavaScript, Node.js, Python, C#, Flutter) are in the documentation.