Media API
The Media API lets you upload remote media files to the Soku media library. Once uploaded, the returned URL can be used in post submissions for video and image content.Upload Remote Media
Download a media file from a remote URL and store it in the Soku media library.Headers
| Header | Required | Description |
|---|---|---|
Content-Type | Yes | Must be application/json |
soku-api-key | Yes | Your Soku API key |
Idempotency-Key | No | A unique string to prevent duplicate uploads. If omitted, Soku auto-derives a key from your user ID and request payload. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The publicly accessible URL of the media file to upload. Must be a valid HTTP or HTTPS URL. |
Response
| Field | Type | Description |
|---|---|---|
url | string | The Soku-hosted URL of the uploaded media file. Use this URL in the mediaUrls, videoUrl, or imageUrls fields when creating posts. |
Examples
Upload a video from a remote URL
Upload an image
Upload and then publish
A common workflow is to upload media first, then use the returned URL in a post:Supported Media Formats
The Media API accepts any media file that the source URL serves over HTTP or HTTPS. For best results with social platform publishing, use the following formats:| Type | Recommended Formats | Notes |
|---|---|---|
| Video | MP4 (H.264) | Most universally supported across all platforms |
| Image | JPEG, PNG, WebP | JPEG recommended for photos, PNG for graphics |
For detailed information on media format requirements and file size limits per platform, see Media Formats & Limits.
Error Responses
| HTTP Status | Error Code | Description |
|---|---|---|
| 400 | validation_error | The url field is missing or not a valid URL |
| 401 | unauthorized | Missing or invalid API key |
| 403 | forbidden | Subscription is not active |
| 429 | rate_limit_exceeded | Too many requests. See Rate Limits. |
| 500 | internal_error | Failed to download or store the media file |
Next Steps
| Topic | Description |
|---|---|
| Posts API | Use uploaded media in post submissions |
| Templates API | Generate OG images programmatically |
| Media Formats & Limits | Platform-specific media requirements |