Skip to contentSkip to navigationSkip to topbar
On this page

Programmable Chat REST API


(error)

Danger

Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here(link takes you to an external page).

If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.

The Programmable Chat REST API allows you to control your Chat applications from the server in much the same way you can from the client, except from a service perspective rather than a 1st person one. You can create channels, send messages, and query the state of your messaging applications using the resources in this REST API.


API Base URL

api-base-url page anchor

All URLs in the reference documentation use the following base URL:

https://chat.twilio.com/v2

All requests to the Programmable Chat REST API are served over HTTPS. Unencrypted HTTP is not supported.


To authenticate requests to the Twilio APIs, Twilio supports HTTP Basic authentication(link takes you to an external page). Use your API key as the username and your API key's secret as the password. You can create an API key either in the Twilio Console or using the API.

Note: Twilio doesn't recommend using your Account SID and Auth Token in production. For local testing, you can use your Account SID as the username and your Auth token as the password. You can find your Account SID and Auth Token in the Twilio Console(link takes you to an external page).

Learn more about Twilio API authentication.

1
curl -G https://chat.twilio.com/v2/Services \
2
-u $TWILIO_API_KEY:$TWILIO_API_KEY_SECRET

You can use the Twilio Helper Libraries to interact with the Programmable Chat REST endpoints.

Programmable Chat is available in the Next Gen Release builds of the Twilio Helper Libraries.


Here are the resources you will be interacting with via the REST API:

ResourceDescription
BindingA push notification subscription for Users within the Service instance
ChannelA "chat room" - a container having members, in which messages can be exchanged.
CredentialCredentials used by Twilio to integrate with Google Cloud Messaging(link takes you to an external page) or Apple Push Notifications Service(link takes you to an external page)
InviteInvitations to a Channel
MemberMembers of a Channel
MessageMessages sent to a Channel
RoleDefine actions users are allowed to take in a Channel or Service scope
ServiceA service roughly maps to a Chat app. Channels, Users, Credentials, and all the REST (see what I did there?) are scoped to a Service. Can define webhook URLs for events in a Service
UserA user with a unique identity within the scope of your Service

Programmable Chat Multimedia Messaging feature has a REST API available via stand-alone API endpoint. Please refer to the Media Resource documentation for more details.