Update a Message resource (used to redact Message `body` text and to cancel not-yet-sent messages)

POST /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json

A Message resource represents an inbound or outbound message.

Update a Message resource (used to redact Message body text and to cancel not-yet-sent messages)

Path parameters

  • AccountSid string Required

    The SID of the Account that created the Message resources to update.

    Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

  • Sid string Required

    The SID of the Message resource to be updated

    Minimum length is 34, maximum length is 34. Format should match the following pattern: ^(SM|MM)[0-9a-fA-F]{32}$.

application/x-www-form-urlencoded

Body

  • Body string

    The new body of the Message resource. To redact the text content of a Message, this parameter's value must be an empty string

  • Status string

    Value is canceled.

Responses

  • 200 application/json

    OK

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • body string | null

      The text content of the message

    • num_segments string | null

      The number of segments that make up the complete message. SMS message bodies that exceed the character limit are segmented and charged as multiple messages. Note: For messages sent via a Messaging Service, num_segments is initially 0, since a sender hasn't yet been assigned.

    • direction string

      The direction of the message. Can be: inbound for incoming messages, outbound-api for messages created by the REST API, outbound-call for messages created during a call, or outbound-reply for messages created in response to an incoming message.

      Values are inbound, outbound-api, outbound-call, or outbound-reply.

    • from string(phone-number) | null

      The sender's phone number (in E.164 format), alphanumeric sender ID, Wireless SIM, short code, or channel address (e.g., whatsapp:+15554449999). For incoming messages, this is the number or channel address of the sender. For outgoing messages, this value is a Twilio phone number, alphanumeric sender ID, short code, or channel address from which the message is sent.

    • to string | null

      The recipient's phone number (in E.164 format) or channel address (e.g. whatsapp:+15552229999)

    • date_updated string(date-time-rfc-2822) | null

      The RFC 2822 timestamp (in GMT) of when the Message resource was last updated

    • price string | null

      The amount billed for the message in the currency specified by price_unit. The price is populated after the message has been sent/received, and may not be immediately availalble. View the Pricing page for more details.

    • error_message string | null

      The description of the error_code if the Message status is failed or undelivered. If no error was encountered, the value is null. The value returned in this field for a specific error cause is subject to change as Twilio improves errors. Users should not use the error_code and error_message fields programmatically.

    • uri string | null

      The URI of the Message resource, relative to https://api.twilio.com.

    • account_sid string | null

      The SID of the Account associated with the Message resource

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • num_media string | null

      The number of media files associated with the Message resource.

    • status string

      The status of the Message. Possible values: accepted, scheduled, canceled, queued, sending, sent, failed, delivered, undelivered, receiving, received, or read (WhatsApp only). For more information, See detailed descriptions.

      Values are queued, sending, sent, failed, delivered, undelivered, receiving, received, accepted, scheduled, read, partially_delivered, or canceled.

    • messaging_service_sid string | null

      The SID of the Messaging Service associated with the Message resource. A unique default value is assigned if a Messaging Service is not used.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^MG[0-9a-fA-F]{32}$.

    • sid string | null

      The unique, Twilio-provided string that identifies the Message resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^(SM|MM)[0-9a-fA-F]{32}$.

    • date_sent string(date-time-rfc-2822) | null

      The RFC 2822 timestamp (in GMT) of when the Message was sent. For an outgoing message, this is when Twilio sent the message. For an incoming message, this is when Twilio sent the HTTP request to your incoming message webhook URL.

    • date_created string(date-time-rfc-2822) | null

      The RFC 2822 timestamp (in GMT) of when the Message resource was created

    • error_code integer | null

      The error code returned if the Message status is failed or undelivered. If no error was encountered, the value is null. The value returned in this field for a specific error cause is subject to change as Twilio improves errors. Users should not use the error_code and error_message fields programmatically.

    • price_unit string(currency) | null

      The currency in which price is measured, in ISO 4127 format (e.g. usd, eur, jpy).

    • api_version string | null

      The API version used to process the Message

    • subresource_uris object(uri-map) | null

      A list of related resources identified by their URIs relative to https://api.twilio.com

POST /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json
curl \
 --request POST 'https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json' \
 --user "username:password" \
 --header "Content-Type: application/x-www-form-urlencoded" \
 --data 'Body='
Request examples
{"Body"=>""}
{"Status"=>"canceled"}
Response examples (200)
{
  "to": "+18182008801",
  "sid": "SMb7c0a2ce80504485a6f653a7110836f5",
  "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5.json",
  "body": "",
  "from": "+12019235161",
  "tags": {},
  "price": null,
  "status": "sent",
  "date_sent": "Fri, 24 May 2019 17:18:28 +0000",
  "direction": "outbound-api",
  "num_media": "0",
  "error_code": null,
  "price_unit": "USD",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "api_version": "2010-04-01",
  "date_created": "Fri, 24 May 2019 17:18:27 +0000",
  "date_updated": "Fri, 24 May 2019 17:18:28 +0000",
  "num_segments": "1",
  "error_message": null,
  "subresource_uris": {
    "media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Media.json",
    "feedback": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Feedback.json"
  },
  "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
{
  "to": "+18182008801",
  "sid": "SMb7c0a2ce80504485a6f653a7110836f5",
  "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5.json",
  "body": "Hello World!",
  "from": null,
  "tags": {},
  "price": null,
  "status": "canceled",
  "date_sent": null,
  "direction": "outbound-api",
  "num_media": "0",
  "error_code": null,
  "price_unit": "USD",
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "api_version": "2010-04-01",
  "date_created": "Fri, 24 May 2019 17:18:27 +0000",
  "date_updated": "Fri, 24 May 2019 18:18:28 +0000",
  "num_segments": "1",
  "error_message": null,
  "subresource_uris": {
    "media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Media.json",
    "feedback": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Feedback.json"
  },
  "messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}