An Application Programming Interface (API) is provided by a service owner so that others may use the features and functions enabled by the service. APIs describe how a consumer will make requests of the service, and what they will receive in return.
An API defines the means by which the consumer or user of a service invokes service functions and receives data in return from the provider of the API. There are many different kinds of APIs, from the Swift APIs provided by iOS to provide mobile apps with access to the many facilities provided by the operating system, to REST APIs provided by Twilio that allow developers to send SMS and do tons of other things.
Twilio, as an API company, provides many different APIs to our customers to help them build applications that communicate. Check out the API reference for a full listing of the APIs Twilio provides for developers to use. Primarily, Twilio provides REST APIs and software APIs for developers to use in order to do fun things like answer phone calls, make video calls, or instantly synchronize data between two clients.
A REST API allows systems to communicate with one another and invoke functions over the Internet.
In a typical software program, you will use a combination of a programming language's built-in features, its syntax, and APIs provided either by the language's standard library or libraries created and published by third-parties. Twilio provides libraries for many popular programming languages that allow developers on those platforms to consume our services.
Here's an example of using Twilio's helper libraries to send an SMS message using different languages.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createMessage() {11const message = await client.messages.create({12body: "This is the ship that made the Kessel Run in fourteen parsecs?",13from: "+15017122661",14to: "+15558675310",15});1617console.log(message.body);18}1920createMessage();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"api_version": "2010-04-01",4"body": "This is the ship that made the Kessel Run in fourteen parsecs?",5"date_created": "Thu, 24 Aug 2023 05:01:45 +0000",6"date_sent": "Thu, 24 Aug 2023 05:01:45 +0000",7"date_updated": "Thu, 24 Aug 2023 05:01:45 +0000",8"direction": "outbound-api",9"error_code": null,10"error_message": null,11"from": "+15017122661",12"num_media": "0",13"num_segments": "1",14"price": null,15"price_unit": null,16"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"status": "queued",19"subresource_uris": {20"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media.json"21},22"tags": {23"campaign_name": "Spring Sale 2022",24"message_type": "cart_abandoned"25},26"to": "+15558675310",27"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"28}
Don't know an API from an IPA? Talk to an expert, or get some help from our support team.