# 21705: The Messaging Service is invalid

Log Type: APPLICATION

Log Level: ERROR

## Description

This error occurs when the `MessagingServiceSid` in your request is not a valid Messaging Service SID. When you send a message with a Messaging Service, include `MessagingServiceSid` instead of a `From` number when appropriate. The value must be a Messaging Service SID that starts with `MG` and matches the expected SID pattern `^MG[0-9a-fA-F]{32}$`.

### Possible causes

* The `MessagingServiceSid` value does not start with `MG` or does not match the required SID pattern `^MG[0-9a-fA-F]{32}$`.
* You supplied a SID for a different Twilio resource instead of a Messaging Service SID. Twilio resource SIDs are identified by their prefixes, and Messaging Service SIDs use the `MG` prefix.
* The SID was copied incorrectly when you added it to the request. Messaging Service SIDs are 34 characters long and are shown when you create or manage a Messaging Service.

### Possible solutions

* Update the request to use a valid `MessagingServiceSid` that starts with `MG` and matches `^MG[0-9a-fA-F]{32}$`.
* Copy the Messaging Service SID directly from Messaging > Services in the Twilio Console, then resend the request with that exact value.
* If you just created the Messaging Service, use the SID returned for that service and confirm that you are passing the service SID, not another resource SID.

#### Additional resources

* [Messaging Services overview](/docs/messaging/services)
* [Messages resource](/docs/messaging/api/message-resource)
* [Get started with Messaging Services](/docs/messaging/tutorials/send-messages-with-messaging-services)
