Laravel SMS API

Scalable SMS Gateway Built for Laravel Developers

Laravel SMS API

Scalable, Reliable SMS for Your Laravel Application

Our Laravel SMS API provides a purpose-built gateway for sending transactional and bulk SMS messages from your Laravel application. With a RESTful interface, real-time delivery tracking, and seamless integration with Laravel’s notification system, you can be sending SMS in minutes — not days.

Key Features

RESTful API

Simple HTTP endpoints for sending messages, checking delivery status, and managing your account. No SDK required — a curl command or Http facade is all you need.

curl -X POST https://api.laravelsms.com/v1/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+1234567890",
    "from": "YourApp",
    "body": "Your order has shipped! Track at https://..."
  }'
---

### High Throughput
Process up to 10,000 messages per second with auto-scaling infrastructure. Whether you need 100 or 10 million messages, our platform scales with your traffic.

### Real-Time Delivery Reports
Get webhook callbacks for every delivery state change — sent, delivered, failed, or bounced. Our delivery rate consistently exceeds 99%.

### Laravel Native Integration
Drop-in integration with Laravel's notification system. No boilerplate, no custom adapters.

```php
<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;

class WelcomeSms extends Notification implements ShouldQueue
{
    use Queueable;

    public function via(object $notifiable): array
    {
        return ['sms'];
    }

    public function toSms(object $notifiable): string
    {
        return "Welcome to our platform, {$notifiable->name}! We're glad to have you.";
    }
}
---

### Global Coverage
Direct carrier connections in 190+ countries. Your messages route through the fastest path to every major mobile network worldwide.

### Delivery Optimizer
Our intelligent routing engine automatically selects the best carrier path for each destination, maximizing deliverability and minimizing cost.

## Pricing Tiers

| Plan | Messages/Month | Rate/Message | Features |
|------|---------------|--------------|----------|
| **Starter** | Up to 10,000 | $0.0075 | REST API, delivery reports, email support |
| **Growth** | Up to 100,000 | $0.0050 | All Starter + webhooks, priority support, 5 sender IDs |
| **Business** | Up to 1,000,000 | $0.0035 | All Growth + dedicated shortcode, SLA, phone support |
| **Enterprise** | Custom | Custom | All Business + dedicated infrastructure, SLAs, account manager |

No setup fees. Pay only for what you use. Volume discounts available for all plans.

## Sending SMS via API

### Using Laravel's Http Facade

```php
<?php

namespace App\Services;

use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Http;

class SmsService
{
    public function __construct(
        protected string $apiKey,
        protected string $baseUrl = 'https://api.laravelsms.com/v1'
    ) {}

    public function send(string $to, string $from, string $body): array
    {
        $response = Http::withToken($this->apiKey)
            ->timeout(10)
            ->retry(3, 100, throw: false)
            ->post("{$this->baseUrl}/messages", [
                'to' => $to,
                'from' => $from,
                'body' => $body,
            ]);

        if ($response->failed()) {
            throw new SmsSendException(
                $response->json('error.message', 'Unknown error'),
                $response->status()
            );
        }

        return $response->json();
    }

    public function sendBulk(array $messages): array
    {
        $response = Http::withToken($this->apiKey)
            ->timeout(30)
            ->post("{$this->baseUrl}/messages/bulk", [
                'messages' => $messages,
            ]);

        return $response->json();
    }

    public function getStatus(string $messageId): array
    {
        $response = Http::withToken($this->apiKey)
            ->get("{$this->baseUrl}/messages/{$messageId}");

        return $response->json();
    }
}
---

### Using Laravel Notifications

Configure your `.env` with the API key and default sender:

```dotenv
LARAVELSMS_API_KEY=your-api-key-here
LARAVELSMS_FROM=YourApp
---

Add the channel to `config/services.php`:

```php
<?php

return [
    // ...
    'laravelsms' => [
        'api_key' => env('LARAVELSMS_API_KEY'),
        'from' => env('LARAVELSMS_FROM', 'YourApp'),
    ],
];
---

Now any notification can send via SMS:

```php
<?php

namespace App\Notifications;

use App\Models\Order;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;

class OrderShipped extends Notification implements ShouldQueue
{
    use Queueable;

    public function __construct(
        public Order $order
    ) {}

    public function via(object $notifiable): array
    {
        return ['sms'];
    }

    public function toSms(object $notifiable): string
    {
        return sprintf(
            "Order #%s shipped! Track your package: %s/tracking/%s",
            $this->order->order_number,
            config('app.url'),
            $this->order->tracking_number
        );
    }
}
---

### Checking Delivery Status

```php
<?php

namespace App\Http\Controllers;

use App\Services\SmsService;
use Illuminate\Http\Request;

class SmsStatusController extends Controller
{
    public function __construct(
        protected SmsService $smsService
    ) {}

    public function __invoke(Request $request, string $messageId)
    {
        $status = $this->smsService->getStatus($messageId);

        return response()->json([
            'id' => $status['id'],
            'status' => $status['status'],
            'to' => $status['to'],
            'segments' => $status['segments'],
            'cost' => $status['cost'],
            'created_at' => $status['created_at'],
            'delivered_at' => $status['delivered_at'] ?? null,
        ]);
    }
}
---

## Integration Steps

1. **Sign up** — Create an account and generate your API key
2. **Configure** — Add your API key and default sender to `.env`
3. **Install our channel** — `composer require laravelsms/notification-channel`
4. **Send messages** — Use Laravel's `Notification::send()` or our REST API directly
5. **Monitor** — Track deliveries via webhooks and dashboard

## Webhook Setup

Receive real-time delivery updates:

```php
<?php

namespace App\Http\Controllers\Webhooks;

use App\Models\SmsMessage;
use Illuminate\Http\Request;

class LaravelSmsWebhookController extends Controller
{
    public function __invoke(Request $request)
    {
        $payload = $request->validate([
            'event' => 'required|in:delivered,failed,sent,queued',
            'message_id' => 'required|string',
            'to' => 'required|string',
            'timestamp' => 'required|date',
            'error' => 'nullable|string',
        ]);

        SmsMessage::where('provider_message_id', $payload['message_id'])
            ->update(['status' => $payload['event']]);

        return response('OK');
    }
}
---

## FAQ

**Q: Do I need a separate account for sending and receiving SMS?**
No. A single account handles both sending and receiving.

**Q: Can I use my own sender ID?**
Yes. We support alphanumeric sender IDs and shortcodes. Subject to carrier approval and destination country regulations.

**Q: How do delivery reports work?**
We send real-time webhook callbacks to your configured endpoint for every status change. You can also poll the API for status.

**Q: What countries do you support?**
Direct carrier connections in 190+ countries. Full list available in your dashboard.

**Q: Is there a minimum commitment?**
No minimum commitment on any plan. Pay as you go.

**Q: How is SMS billed?**
Per successful message segment (160 GSM characters or 70 Unicode characters). Failed messages are not charged.

## Ready to Start Sending?

Get API access today and start sending transactional SMS from your Laravel application in under 10 minutes.

[Get API Access](/contact)

For high-volume needs, explore our [enterprise SMS solution](/services/enterprise-sms-solution-laravel) with dedicated infrastructure and SLAs. Need a custom integration? Our [custom development services](/services/custom-laravel-sms-development) can build exactly what you need.

Ready to Get Started?

Contact us today to discuss your Laravel SMS needs.

Get API Access