Media Handling
Manage your media assets before attaching them to posts. Publer’s API supports direct uploads and URL imports, returning media IDs you can reference when creating or updating posts.
Overview
Before including media in your social media posts, you must first upload those files to Publer's servers. The API provides two methods for uploading media:
Direct file upload
Upload from URL
Once uploaded, you'll receive a media ID that can be referenced in your post requests.
Direct File Upload
Use this method when you have local media files that you want to upload directly.
Request Format
This endpoint expects a multipart/form-data
request with the file included in the file
field.
Upload a media file (image, video, or document) to be used in social media posts
The media file to upload
Supported formats:
-
Image: jpg, jpeg, png, gif
-
Video: mp4, mov, avi
-
Document: pdf, doc, docx, ppt, pptx
Key Response Fields
Field
Description
id
Unique identifier for the uploaded media (use this in post requests)
path
URL path to access the uploaded media
thumbnail
URL path to access a thumbnail version of the media
validity
Indicates which networks and post types support this media
width
, height
Dimensions of the uploaded media in pixels
type
Media type (photo, video, document)
name
Original filename
Upload from URL
Use this method when your media is already hosted elsewhere and you want to import it by URL.
Upload media files by providing URLs
Upload type
single
Possible values: Whether to skip processing
false
Whether to save to media library
false
Request Parameters
Parameter
Description
Required
media[].url
URL of the media file to download
Yes
media[].name
Custom name for the media file
Yes
media[].caption
Caption for the media
No
media[].source
Source attribution
No
type
Upload type (single
or multiple
)
No
directUpload
Whether to skip processing (default: false
)
No
inLibrary
Whether to save to media library (default: false
)
No
Unlike direct uploads, URL uploads are processed asynchronously. Use the returned job_id
to check the status of your upload.
Checking Upload Status
Check the status of an asynchronous job, including URL media uploads
ID of the job to check
Using Media in Posts
Once you've uploaded media and have the media ID, you can reference it in your post requests:
Supported Media Types
Images
Supported formats: JPG, PNG, GIF, WEBP
Recommended dimensions: Varies by platform (see Networks Reference)
Maximum file size: Varies by platform, generally 5-10MB
Videos
Supported formats: MP4, MOV, AVI, WEBM
Recommended dimensions: Varies by platform (see Networks Reference)
Maximum file size: Varies by platform, generally 512MB-2GB
Duration limits: Varies by platform and content type
Documents
Supported formats: PDF
Maximum file size: 100MB
Supported networks: LinkedIn only
Network Validation
The validity
object in the media upload response indicates which networks and post types can use the uploaded media. This helps prevent errors when attempting to use incompatible media in your posts.
For example, if validity.instagram.reel
is false
, the uploaded media cannot be used for Instagram Reels.
Best Practices
Image Optimization
Resolution: Use appropriate image resolutions for each platform
Aspect ratio: Follow recommended aspect ratios to avoid cropping
File size: Optimize images for web to reduce file size
Alt text: Always include descriptive alt text for accessibility
Video Optimization
Format: Use MP4 with H.264 encoding for maximum compatibility
Dimensions: Use 1080p (1920x1080) for standard videos
Aspect ratio: 16:9 for horizontal, 9:16 for vertical/stories/reels
Duration: Keep videos under platform limits
Thumbnails: Consider uploading custom thumbnails for videos
General Tips
Pre-check compatibility: Review the
validity
object before using mediaError handling: Implement robust error handling for upload failures
Caching: Cache media IDs to avoid unnecessary re-uploads
Related Topics
Content Types - Details on different content formats
Network Reference - Platform-specific media requirements
Publishing Methods - Using media in different post types
Last updated
Was this helpful?