Documentation Index
Fetch the complete documentation index at: https://plivo.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Use the Media API to upload and manage media files for MMS messages. Plivo supports images, videos, and other media types.
Attributes
A unique identifier for the media file.
The name of the uploaded file.
The MIME type of the media. Valid types: JPG, PNG, MP4, GIF, PDF, text.
The URL of the media file on Plivo’s system.
Size of the media in bytes. Maximum: 2MB per file.
Timestamp when the media was uploaded.
Unused media (not sent in an MMS) is automatically deleted after 6 hours. Media sent in MMS messages is retained for 1 year.
{
"content_type": "image/jpeg",
"file_name": "sample.jpg",
"media_id": "801c2056-33ab-499c-80ef-58b574a462a2",
"size": 85277,
"upload_time": "2021-02-17T07:16:09.153289Z",
"media_url": "https://media.plivo.com/Account/{auth_id}/Media/{media_id}"
}
Upload media files to be used in MMS messages. Supports up to 10 attachments per request, with a maximum of 2MB per file.
POST https://api.plivo.com/v1/Account/{auth_id}/Media/
Set Content-Type to multipart/form-data.
Arguments
One or more files to upload (max 10 files per request).
import plivo
client = plivo.RestClient('<auth_id>', '<auth_token>')
response = client.media.upload([
'/path/to/image1.jpg',
'/path/to/image2.png'
])
print(response)
Response
{
"api_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"objects": [
{
"content_type": "image/jpeg",
"file_name": "image1.jpg",
"media_id": "801c2056-33ab-499c-80ef-58b574a462a2",
"size": 85277,
"status": "success",
"status_code": 201,
"upload_time": "2021-02-17T07:16:09.153289Z",
"media_url": "https://media.plivo.com/Account/{auth_id}/Media/{media_id}"
}
]
}
Get details of a specific media file by its ID.
GET https://api.plivo.com/v1/Account/{auth_id}/Media/{media_id}/
Arguments
The unique identifier of the media to retrieve.
import plivo
client = plivo.RestClient('<auth_id>', '<auth_token>')
response = client.media.get('media_id')
print(response)
Retrieve a paginated list of all uploaded media files.
GET https://api.plivo.com/v1/Account/{auth_id}/Media/
Arguments
Number of results per page. Default: 20, Max: 20.
Number of records to skip. Default: 0.
import plivo
client = plivo.RestClient('<auth_id>', '<auth_token>')
response = client.media.list(limit=10, offset=0)
print(response)
Response
{
"api_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"meta": {
"limit": 20,
"next": null,
"offset": 0,
"previous": null,
"total_count": 2
},
"objects": [
{
"content_type": "image/jpeg",
"file_name": "image1.jpg",
"media_id": "801c2056-33ab-499c-80ef-58b574a462a2",
"size": 85277,
"upload_time": "2021-02-17T07:16:09.153289Z",
"media_url": "https://media.plivo.com/Account/{auth_id}/Media/{media_id}"
}
]
}