Skip to main content
LaraCopilot’s SMS gateway API lets you configure outbound messaging providers, send SMS messages, and inspect delivery history — all in a single resource. Each gateway holds its own connection credentials and sender identity, and every message sent through the API is recorded as an SmsMessage record that tracks status from queued through to delivered.
All SMS gateway endpoints require an active admin session. Requests without a valid session cookie return 401 Unauthorized.

List SMS gateways

Retrieve all configured SMS gateways. Pass search to filter by name, host, or provider type. Each result includes a messages_count field with the number of messages sent through that gateway.
Query parameters
Filter gateways by name, server_host, or provider_type. Matches partial strings.
Response
string
Human-readable status. Always "SMS gateways fetched successfully." on success.
object[]
Array of SMS gateway objects.
Example request
Filter by name
200 response

Create a gateway

Register a new SMS gateway. The password field is stored and used for Basic Auth when dispatching messages.
Request body
string
required
Display name for this gateway. Maximum 255 characters.
string
required
Gateway provider identifier. Maximum 100 characters (e.g. "jasmin", "smpp").
string
required
Hostname or IP address of the gateway server. Maximum 255 characters.
integer
required
TCP port the gateway listens on. Minimum value: 1.
string
Path segment appended after the host and port when building the send URL. Defaults to send when omitted. Maximum 255 characters.
string
required
Authentication username for Basic Auth. Maximum 255 characters.
string
required
Authentication password for Basic Auth. Maximum 255 characters.
string
Default originating address (alphanumeric sender ID or phone number). Maximum 30 characters.
string
Token included in DLR callback validation. Maximum 255 characters. See Webhooks for security guidance.
boolean
default:"false"
Set to true to enable this gateway for outbound sending.
boolean
default:"false"
Set to true to connect to the gateway over HTTPS.
string
Free-text internal notes. No length limit enforced by the API.
object
Arbitrary key-value object for custom metadata. Stored as JSON.
Response Returns the newly created gateway object at HTTP 201.
Example request
201 response

Get a gateway

Fetch a single gateway by ID. The response includes messages_count.
Path parameters
integer
required
The ID of the SMS gateway to retrieve.
Example request
200 response

Update a gateway

Replace all fields on an existing gateway. Every required field from Create a gateway must be included. Use PATCH /api/sms-gateways/{smsGateway} for partial updates with the same field rules.
Path parameters
integer
required
The ID of the SMS gateway to update.
Request body Accepts the same fields as Create a gateway. All required fields must be present.
Example request
200 response

Delete a gateway

Permanently delete a gateway. This action cannot be undone. Associated SmsMessage records are not automatically removed.
Path parameters
integer
required
The ID of the SMS gateway to delete.
Example request
200 response

List messages for a gateway

Return all SmsMessage records associated with a gateway, ordered newest first. Use this to inspect delivery history for a specific gateway.
Path parameters
integer
required
The ID of the SMS gateway whose messages you want to list.
Response
string
Always "SMS messages fetched successfully." on success.
object[]
Array of SMS message objects ordered by created_at descending.
Example request
200 response

Send an SMS

Dispatch an outbound SMS through the specified gateway. LaraCopilot creates an SmsMessage record with delivery_status: "queued", forwards the message to the gateway over HTTP(S) with Basic Auth, then updates the record to submitted or failed based on the gateway’s response. The final SmsMessage object — with its current delivery_status — is returned synchronously.
Path parameters
integer
required
The ID of the SMS gateway to send through.
Request body
string
required
Destination phone number in E.164 format (e.g. "+447911123456"). Maximum 30 characters.
string
required
Originating address shown to the recipient — alphanumeric sender ID or E.164 phone number. Maximum 30 characters.
string
required
SMS body text. Maximum 1000 characters.
integer
ID of the tenant on whose behalf the message is sent. Stored on the SmsMessage record for attribution. Optional.
string
URL where the gateway should POST delivery receipts. Must be a valid URL. Defaults to https://your-instance.laracopilot.com/api/sms-gateways/{id}/dlr when omitted.
Send flow
1

Record created

An SmsMessage record is created with delivery_status: "queued" and requested_at set to the current time.
2

Dispatch to gateway

LaraCopilot POSTs to {scheme}://{server_host}:{server_port}/{api_path} using Basic Auth credentials from the gateway. The payload includes to, from, content, dlr-url, dlr-level, and dlr-method.
3

Status updated

On a successful gateway response the record is updated to delivery_status: "submitted" and submitted_at is set. On any HTTP error or network exception the status is set to "failed" and error_message is populated.
4

Response returned

The refreshed SmsMessage record is returned. Poll GET /api/sms-gateways//messages or wait for the DLR webhook to confirm final delivery.
Response
string
Always "SMS request processed.".
object
The SmsMessage record after the gateway interaction.
Example request
200 response — submitted
200 response — failed