Skip to main content
Plivo exposes REST APIs to send and manage SMS, MMS, and WhatsApp messages. All API requests use HTTPS.

Base URL

https://api.plivo.com/v1/Account/{auth_id}/

Authentication

All requests to the Messaging API are authenticated with BasicAuth using your Auth ID and Auth Token, which you can find on the Overview page of the Plivo console.
import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

Content-Type

For POST requests, set the Content-Type header to application/json:
Content-Type: application/json
For media uploads, use multipart/form-data:
Content-Type: multipart/form-data

Timeouts and Proxies

Configure timeouts and proxy settings when initializing the client:
import plivo

proxies = {
    'http': 'https://username:password@proxyurl:proxyport',
    'https': 'https://username:password@proxyurl:proxyport'
}
client = plivo.RestClient('<auth_id>', '<auth_token>', proxies=proxies, timeout=5)

Pagination

Plivo uses offset-based pagination to list resources.

Parameters

limit
integer
Number of results to return per page. Range: 1-20. Default: 20.
offset
integer
Number of records to skip before returning results. Default: 0.

Example

If you have 100 results with limit=10 and offset=50, objects with indices 51-60 are returned.

Asynchronous Requests

For high-throughput scenarios, use asynchronous request patterns:
import plivo
import asyncio

async def send_message():
    client = plivo.RestClient('<auth_id>', '<auth_token>')
    response = await client.messages.create_async(
        src='+14151234567',
        dst='+14157654321',
        text='Hello!'
    )
    return response