REST ClientMessages

update

View as MarkdownOpen in Claude

messages.update

Redact the body of a previously sent message. The API accepts only an empty string for body; any other value is rejected. Messages still in progress (queued or initiated) can’t be redacted, and a redacted body can’t be recovered.

Path parameters

message_idstringRequiredformat: "uuid"
The message segment ID — the same ID returned by the create endpoint and shown in `/api/messaging/logs`.

Request

bodystringRequired
Must be an empty string (`""`) to redact the message. Any non-empty value is rejected with `body_must_be_empty`. This is the only field that can be updated.

Response

idstringRequiredformat: "uuid"
The unique ID of the message. This is the `MessageSegment` ID, consistent with the dashboard and the `/api/messaging/logs` endpoint.
fromstringRequired
The source phone number.
tostringRequired
The destination phone number.
bodystringRequired
The message body text. Returns an empty string when the message has been redacted.
statusenumRequired
Delivery state of the message.
directionenumRequired
The direction of the message.
kindenumRequired
The kind of message.
medialist of stringsRequired
Array of URLs for any media attachments on the message. Empty for SMS.
number_of_segmentsintegerRequired
Number of segments the message body was split into for delivery.
error_codestring or nullRequired
Provider-specific error code if delivery failed. Null when no error occurred.
error_messagestring or nullRequired
Human-readable error message if delivery failed. Null when no error occurred.
created_atdatetimeRequired
Date and time when the message was created.
project_idstringRequiredformat: "uuid"
The ID of the project the message belongs to.
status_callback_urlstring or nullRequiredformat: "uri"
Callback URL configured to receive message status events. Null if no callback was configured.
message_uristringRequired
Relative URL for retrieving the message via the `/api/messaging/logs` endpoint.

Parameters

message_id
strRequired

ID of the message to redact.

body
strRequired

New body. Pass "" to redact. Keyword-only.

extras
Mapping[str, Any] | NoneDefaults to None

Additional request body fields merged into the payload as sent.

request_options
RequestOptions | NoneDefaults to None

Per-call timeout and retry overrides. See RequestOptions.

Returns

Message — the updated message with its body cleared.

Response Example

Response
{
"id": "c2d3e4f5-a6b7-8901-cdef-234567890abc",
"from": "+15559876543",
"to": "+15551234567",
"body": "Your order #12345 has shipped!",
"status": "queued",
"direction": "outbound",
"kind": "sms",
"media": [],
"number_of_segments": 1,
"error_code": null,
"error_message": null,
"created_at": "2024-05-06T12:20:00Z",
"project_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status_callback_url": null,
"message_uri": "/api/messaging/logs/c2d3e4f5-a6b7-8901-cdef-234567890abc"
}

Example

from signalwire.rest import RestClient
client = RestClient(
project="your-project-id",
token="your-api-token",
host="your-space.signalwire.com",
)
redacted = client.messages.update("message-id", body="")
print(redacted["body"]) # ""