Search + K

Command Palette

Search for a command to run...

Sign In

Send a message

POST /2010-04-01/Accounts/{AccountSid}/Messages.json
Copy endpoint
https://api.twilio.com

Send a message

Parameters

path Path Parameters

Name Type
AccountSid required

The SID of the Account creating the Message resource.

`AC${string}`

Request Body

application/x-www-form-urlencoded
{
To: string;
StatusCallback?: string;
ApplicationSid?: `AP${string}`;
MaxPrice?: number;
ProvideFeedback?: boolean;
Attempt?: number;
ValidityPeriod?: number;
ForceDelivery?: boolean;
ContentRetention?: MessageEnumContentRetention
type MessageEnumContentRetention = "retain" | "discard"
;
AddressRetention?: MessageEnumAddressRetention
type MessageEnumAddressRetention = "retain" | "obfuscate"
;
SmartEncoded?: boolean;
PersistentAction?: string[];
TrafficType?: MessageEnumTrafficType
type MessageEnumTrafficType = "free"
;
ShortenUrls?: boolean;
ScheduleType?: MessageEnumScheduleType
type MessageEnumScheduleType = "fixed"
;
SendAt?: string;
SendAsMms?: boolean;
ContentVariables?: string;
RiskCheck?: MessageEnumRiskCheck
type MessageEnumRiskCheck = "enable" | "disable"
;
From?: string;
MessagingServiceSid?: `MG${string}`;
Body?: string;
MediaUrl?: string[];
ContentSid?: `HX${string}`;
}

Responses

201 application/json

Created

interface ApiV2010AccountMessage {
body?: string | null;
num_segments?: string | null;
direction?: MessageEnumDirection

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.

type MessageEnumDirection = "inbound" | "outbound-api" | "outbound-call" | "outbound-reply"
;
from?: string | null;
to?: string | null;
date_updated?: string | null;
price?: string | null;
error_message?: string | null;
uri?: string | null;
account_sid?: `AC${string}` | null;
num_media?: string | null;
status?: MessageEnumStatus

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.

type MessageEnumStatus = "queued" | "sending" | "sent" | "failed" | "delivered" | "undelivered" | "receiving" | "received" | "accepted" | "scheduled" | "read" | "partially_delivered" | "canceled"
;
messaging_service_sid?: `MG${string}` | null;
sid?: string | null;
date_sent?: string | null;
date_created?: string | null;
error_code?: number | null;
price_unit?: string | null;
api_version?: string | null;
subresource_uris?: {} | null;
}