Read a Message with its content
GET /v1/messages/{message_id}
| Property | Value |
|---|---|
| Operation | get_message |
| Group | Messages |
| Scope | messages:read |
| Route class | read |
| Idempotency | No Idempotency-Key |
| Audit | An audited content read channels.message.read |
| Released in | 1.60.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Answers a Message with its recipient and text (1.60.0), an audited content read (channels.md section 8).
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the messages:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl "$VOCAL_API/v1/messages/msg_..." \
-H "Authorization: Bearer $VOCAL_API_KEY"const response = await fetch(`${process.env.VOCAL_API}/v1/messages/msg_...`, {
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
},
});
console.log(response.status, await response.text());import os
import requests
response = requests.get(
f"{os.environ['VOCAL_API']}/v1/messages/msg_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
message_id | path | MessageId | yes | The id of a Message: msg_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | Message | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
404 | application/json | ErrorEnvelope | not_found |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is Message.
| Field | Type | Required | Description |
|---|---|---|---|
action | MessagingAction | yes | |
channel | MessageChannel | yes | |
connection_id | ConnectionId | yes | |
content | MessageContent or null | yes | The recipient and text: answered by the single read, an audited content read; null in a list. |
created_at | Timestamp | yes | |
deferred_until | Timestamp or null | yes | When a deferred Message is sent; null otherwise. |
delivered_at | Timestamp or null | yes | |
direction | MessageDirection | yes | |
environment | Environment | yes | |
error_code | ToolErrorCode or null | yes | |
id | MessageId | yes | |
notification_rule_id | NotificationRuleId or null | yes | |
object | "message" | yes | |
organization_id | OrganizationId | yes | |
related_call_id | CallId or null | yes | |
run_id | RunId or null | yes | |
segments | integer or null | yes | The SMS segments counted; null for other channels. |
sent_at | Timestamp or null | yes | |
status | MessageStatus | yes | |
thread_id | null | yes | Reserved for conversation Channels; always null. |
tool | UpstreamToolName | yes | |
trigger_event_id | TriggerEventId or null | yes | |
updated_at | Timestamp | yes | |
vendor_message_id | string or null | yes |