1. Media
swonkie.dev
  • Introduction
  • Quick Start
  • Changelog
  • Social Networks
    • Facebook
    • Instagram
    • LinkedIn
    • TikTok
    • Threads
  • Profiles
    • My Profiles
      GET
    • Competitors
      GET
  • Insights
    • Getting Started
    • My Profile Insights
      GET
    • My Profile Insights Posts
      GET
    • Competitor Insights
      GET
    • Competitor Insights Posts
      GET
  • Posts
    • Getting Started
    • List Posts
      GET
    • Get a Post
      GET
    • Create a Post
      POST
    • Update a Post
      PUT
    • Validate a Post
      GET
    • Delete a Post
      DELETE
    • Change Post Stage
      PATCH
  • Labels
    • Getting Started
    • List Labels
    • Create a Label
  • Media
    • Get a Media
      GET
    • Create a Media
      POST
    • Upload File to Media
      PUT
    • Confirm Uploaded Media
      PATCH
    • Delete a Media
      DELETE
  • Examples
    • Publish
Back to Home
Back to Home
Login
  1. Media

Create a Media

POST
/media
Creates a new media entry in your workspace's media library and provides a temporary upload URL for uploading the actual file. This is a tree-step process: first you create the media entry with this endpoint to receive an upload URL, then you upload your file to that URL using a PUT request, finally you request PATCH /media/:mediaId to confirm the upload has finished. Once uploaded, the file will be processed asynchronously, and you can check its status using GET /media/:mediaId.
Important: After creating the media entry, you must upload the file to the provided uploadUrl within a limited time (typically 15 minutes) and then confirm. The file specifications you provide (width, height, duration, fileSize) should match the actual file you're uploading.

Notes#

This endpoint only creates the media entry and provides an upload URL - you must upload the actual file separately.
Upload the file to the uploadUrl using a PUT request with the file as binary data.
The uploadUrl expires after a short time (typically 15 minutes) - upload promptly.
Set the correct Content-Type header when uploading (e.g., image/jpeg, video/mp4).
After uploading, request PATCH /media/:mediaId to start confirm the upload
The file will be processed asynchronously (status changes from PROCESSING to SUCCESS).
Use GET /media/:mediaId to check processing status before using the media in posts.
For images, set duration to null. For videos/audio, provide the duration in seconds.
destinationType determines how the media can be used: POST_MEDIA for regular post content, POST_LINK for link preview customization.
Media files remain in your library and can be reused across multiple posts.

Upload Process#

After receiving the response, upload your file to the uploadUrl, check the next documented request for example details.

Request

Header Params

Body Params application/jsonRequired

Examples

Responses

🟢201
application/json
Body

Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.swonkie.dev/v2/media' \
--header 'X-API-ID: {{apiId}}' \
--header 'X-API-KEY: {{apiKey}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "product-photo.jpg",
    "destinationType": "POST_MEDIA"
}'
Response Response Example
{
    "id": "TWVkaWFJZDk4NzY1NDMyMQ",
    "previewUrl": "https://swkdev.blob.core.windows.net/temp/1e66accf-626d-4e1a-aa09-71d7c2e68dca_videoToPost.mp4?sv=2024-05-04&spr=https&st=2026-01-26T20%3A16%3A52Z&se=2026-01-28T20%3A16%3A52Z&sr=b&sp=r&sig=c4DpKX5aNeJJ%2B1nqwWymEB4q%2FrZiJF%2BOqTigJ2WGHpE%3D",
    "uploadUrl": "https://swkdev.blob.core.windows.net/temp/1e66accf-626d-4e1a-aa09-71d7c2e68dca_videoToPost.mp4?sv=2024-05-04&spr=https&st=2026-01-26T20%3A16%3A51Z&se=2026-01-28T20%3A16%3A51Z&sr=b&sp=cw&sig=aX0I6vGx0gpVSlNaEVo72vVoM72q4N3diKzre4iE7qg%3D"
}
Modified at 2026-03-12 12:25:52
Previous
Get a Media
Next
Upload File to Media
Built with