SMS Multi-Tenant API Documentation

Complete REST API documentation for sending and receiving SMS messages

Base URL

https://mainlinetext.com/api

Authentication

All protected endpoints require a Bearer token in the Authorization header:

Authorization: Bearer your_token_here

Authentication Endpoints

POST Register Tenant

POST /api/register
Content-Type: application/json

{
    "name": "John Doe",
    "email": "john@example.com",
    "password": "password123",
    "password_confirmation": "password123",
    "company_name": "Acme Corp",
    "package_type": "bronze"
}

POST Login

POST /api/login
Content-Type: application/json

{
    "email": "john@example.com",
    "password": "password123"
}

POST Logout

POST /api/logout
Authorization: Bearer your_token_here

SMS Endpoints

POST Send SMS

POST /api/sms/send
Authorization: Bearer your_token_here
Content-Type: application/json

{
    "to": "+1234567890",
    "message": "Hello from SMS API!",
    "from_number": "+1987654321"
}

GET Get Messages

GET /api/sms
Authorization: Bearer your_token_here

GET Get Phone Numbers

GET /api/sms/phone-numbers
Authorization: Bearer your_token_here

Contact Management

GET Get Contacts

GET /api/contacts
Authorization: Bearer your_token_here

POST Create Contact

POST /api/contacts
Authorization: Bearer your_token_here
Content-Type: application/json

{
    "name": "John Doe",
    "phone": "+1234567890",
    "email": "john@example.com"
}

Billing & Subscriptions

POST Create Payment Intent

POST /api/billing/payment-intent
Authorization: Bearer your_token_here
Content-Type: application/json

{
    "package_type": "bronze"
}

POST Create Subscription

POST /api/billing/subscription
Authorization: Bearer your_token_here
Content-Type: application/json

{
    "payment_method_id": "pm_1234567890",
    "package_type": "bronze"
}

Webhook Endpoints

Configure these URLs in your SMS provider dashboard:

Flowroute

https://mainlinetext.com/api/webhooks/flowroute

Twilio

https://mainlinetext.com/api/webhooks/twilio

Vonage

https://mainlinetext.com/api/webhooks/vonage

Stripe

https://mainlinetext.com/api/webhooks/stripe

Response Examples

Success Response

{
    "success": true,
    "data": {
        "id": 1,
        "message": "SMS sent successfully",
        "status": "sent"
    }
}

Error Response

{
    "success": false,
    "error": "Invalid phone number format",
    "message": "Please provide a valid phone number"
}

Rate Limits

API Rate Limit: 100 requests per minute per tenant

SMS Rate Limit: Based on your subscription plan (Bronze: 100/month, Silver: 1000/month, Gold: Unlimited)

Support

Need help with the API? Contact our support team or check the documentation.