Skip to main content
POST
/
api
/
calendar
/
media
Upload media for a social post
curl --request POST \
  --url https://app.puffle.ai/api/calendar/media \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "file": "<unknown>",
  "existingMediaType": "image"
}
'
{
  "media": {
    "url": "https://cdn.getlate.dev/uploads/a1b2c3.jpg",
    "type": "image",
    "name": "hero.jpg",
    "size": 842317
  }
}

Overview

Two-step upload flow, fully orchestrated server-side:
  1. Ask Late for a presigned PUT URL
  2. Stream the file bytes to that URL
On success, returns a public CDN URL. Embed that URL in the post’s media_items[].url when calling createSocialPost or updateSocialPost. Submit as multipart/form-data (not JSON). Include the file under key file, plus optional existingMediaType to block cross-type mixing.

AI agent notes

Limits — check listSocialMedia before calling to avoid wasted bandwidth on oversized files.Mixed-type rule — LinkedIn allows only one media type per post. If the draft already has an image, uploading a video returns 400.Short-lived URLs — Late’s temporary storage auto-expires. Create or update the post within a reasonable window after upload.Requires LATE_API_KEY — absent key returns 500 with Late API not configured.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Multipart form body. Must be sent with Content-Type: multipart/form-data, not JSON.

file
any
required

The media file bytes. Sent as multipart/form-data — do not base64 or JSON-wrap. Supported MIME types: image/jpeg, image/png, image/gif, video/mp4, video/quicktime, video/x-msvideo, application/pdf, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document.

existingMediaType
enum<string>

Optional. If the draft post already has attachments, pass the existing media type so the server can block mixing (LinkedIn allows only one type per post).

Available options:
image,
video,
document

Response

Media uploaded and reachable at the returned public URL.

media
object
required