Get an SMS Message
Agent Skill
Automate this endpoint with an AI agent using the 2chat-sms skill:
npx skills add 2ChatCo/agent-skills -s 2chat-sms
Get a single SMS message by its UUID. Inbound messages are prefixed SMI, outbound messages SMO. Returns 404 for a message that doesn't exist or doesn't belong to your account.
Endpoint
GET https://api.p.2chat.io/open/sms/message/{message_uuid}
Authentication
Include your API key in the X-User-API-Key header. Learn more about authentication.
Path parameters
| Parameter | Description | Example |
|---|---|---|
message_uuid | The UUID of the SMS message. Inbound is prefixed SMI, outbound SMO | SMI4f2a1c33-7b6e-4d9a-8c12-9f0e1a2b3c4d |
Invocation
- cURL
- Python
- JavaScript
- PHP
curl -L -G 'https://api.p.2chat.io/open/sms/message/SMI4f2a1c33-7b6e-4d9a-8c12-9f0e1a2b3c4d' \
--header 'X-User-API-Key: your_api_key_here'
import requests
url = "https://api.p.2chat.io/open/sms/message/SMI4f2a1c33-7b6e-4d9a-8c12-9f0e1a2b3c4d"
headers = {
"X-User-API-Key": "your_api_key_here"
}
response = requests.get(url, headers=headers)
print(response.json())
const axios = require('axios');
const response = await axios.get(
'https://api.p.2chat.io/open/sms/message/SMI4f2a1c33-7b6e-4d9a-8c12-9f0e1a2b3c4d',
{
headers: {
'X-User-API-Key': 'your_api_key_here'
}
}
);
console.log(response.data);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.p.2chat.io/open/sms/message/SMI4f2a1c33-7b6e-4d9a-8c12-9f0e1a2b3c4d',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'X-User-API-Key: your_api_key_here'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response
The fields returned depend on whether the message is inbound (SMI…) or outbound (SMO…).
Success — inbound message (HTTP 200 OK)
{
"success": true,
"message": {
"uuid": "SMI4f2a1c33-7b6e-4d9a-8c12-9f0e1a2b3c4d",
"destination": "+13057654321",
"source": "+447700900123",
"text": "Hi, is my order ready?",
"direction": "inbound",
"price": 0.0,
"voip_number_setup_id": 42,
"created_at": "2026-06-20T10:58:02Z",
"updated_at": "2026-06-20T10:58:02Z"
}
}
Success — outbound message (HTTP 200 OK)
{
"success": true,
"message": {
"uuid": "SMOe8b1d572-6a4c-4f93-8d20-1c7b5e0a9f64",
"destination": "+447700900123",
"source": "+13057654321",
"text": "Yes! It ships today.",
"fragments": 1,
"direction": "outbound",
"price": 0.0075,
"voip_number_setup_id": 42,
"created_at": "2026-06-20T11:01:30Z",
"updated_at": "2026-06-20T11:01:30Z"
}
}
| Field | Description | Example |
|---|---|---|
uuid | Unique identifier of the message. Inbound is prefixed SMI, outbound SMO | SMI4f2a1c33-7b6e-4d9a-8c12-9f0e1a2b3c4d |
destination | Recipient phone number in E.164 format | +13057654321 |
source | Sender phone number in E.164 format | +447700900123 |
text | The message content | Hi, is my order ready? |
direction | inbound (received) or outbound (sent) | inbound |
fragments | Number of SMS segments (outbound messages only) | 1 |
price | The amount billed to you for the message, in USD | 0.0075 |
voip_number_setup_id | Internal identifier of the underlying virtual number setup | 42 |
created_at | When the message was created (UTC) | 2026-06-20T10:58:02Z |
updated_at | When the message was last updated (UTC) | 2026-06-20T10:58:02Z |
Error
A message that doesn't exist or doesn't belong to your account returns 404 Not Found.
{
"error": true,
"error_message": "SMS message not found: SMI4f2a1c33-7b6e-4d9a-8c12-9f0e1a2b3c4d"
}
| Field | Description |
|---|---|
error | true when the request failed |
error_message | A description of what went wrong |