Skip to main content

Send an SMS Message

Send an SMS text message from one of your 2Chat numbers to any phone number.

Endpoint

POST https://api.p.2chat.io/open/sms/send

Authentication

Include your API key in the X-User-API-Key header. Learn more about authentication.

Parameters

These parameters should be sent as JSON payload in the request body.

FieldTypeRequiredDescription
from_numberstringYesYour 2Chat SMS number in E.164 format (e.g. +17137157533)
to_numberstringYesThe recipient's phone number in E.164 format (e.g. +442079460958)
textstringYesThe message content (UTF-8, up to 160 characters per SMS segment)
Important notes
  • Phone numbers must be in E.164 international format (e.g. +1XXXXXXXXXX)
  • Messages longer than 160 characters will be split into multiple SMS segments and billed accordingly
  • The from_number must be an SMS-enabled number connected to your 2Chat account
  • A2P messaging to US numbers is not currently supported

Invocation

curl --location --request POST 'https://api.p.2chat.io/open/sms/send' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"from_number": "+17137157533",
"to_number": "+442079460958",
"text": "Hello from 2Chat!"
}'

Response

The API will return whether it succeeded or not to queue the message for sending.

Success (HTTP 202 Accepted)

{
"success": true,
"message_id": "abc123-def456-ghi789"
}
FieldDescription
successtrue when the request was accepted and successful
message_idThe internal ID of the message you can use to keep track of it

Error

{
"error": true,
"error_message": "Description of what went wrong"
}
FieldDescription
errortrue when the request failed
error_messageA description of what went wrong