Skip to main content

Upload Media

Upload an image or video file to your SchedPilot media library. The returned media_id can then be passed to the Create Post endpoint via the image_ids or video_ids arrays.

Endpoint

POST https://api.schedpilot.com/developers/v1/media/upload

Authentication

Include either your API key or OAuth token on every request.

HeaderValue
X-API-KEYsmm_your_key_here
AuthorizationBearer sp_tok_your_token

Request

Send the file as multipart/form-data. The form field name must be file.

FieldTypeRequiredDescription
filebinaryYesThe media file to upload.

File size limit

5 GB maximum per file.

Supported file types

CategoryFormats
ImagesJPG, PNG, GIF, WebP
VideosMP4, MOV, AVI, MKV, WEBM, MPEG

Example Request

curl -X POST "https://api.schedpilot.com/developers/v1/media/upload" \
-H "X-API-KEY: smm_your_key_here" \
-F "file=@photo.jpg"

Uploading a video:

curl -X POST "https://api.schedpilot.com/developers/v1/media/upload" \
-H "X-API-KEY: smm_your_key_here" \
-F "file=@promo.mp4"

Response

HTTP 201 Created

{
"media_id": "image-42",
"type": "image",
"mime_type": "image/jpeg"
}

For a video upload:

{
"media_id": "video-7",
"type": "video",
"mime_type": "video/mp4"
}

Response fields

FieldTypeDescription
media_idstringUnique identifier for the uploaded file. Use this in Create Post.
typestringEither "image" or "video".
mime_typestringThe detected MIME type of the uploaded file.

Using the media_id in a Post

Pass the returned media_id to the Create Post endpoint:

  • For images: include the value in the image_ids array.
  • For videos: include the value in the video_ids array.
Images and videos cannot be mixed

A single post may contain either images or a video — not both. Passing values in both image_ids and video_ids at the same time will return a 400 Bad Request error.

Error Responses

StatusMeaning
413 Payload Too LargeThe file exceeds the 5 GB limit.
415 Unsupported Media TypeThe file format is not supported.
422 Unprocessable EntityThe file field is missing or the multipart body is malformed.
401 UnauthorizedNo API key or token was provided.
403 ForbiddenThe API key or token is invalid or has been revoked.