logo
Schedulin Developers

Upload media

Media is attached to posts by url. To host a file with Schedulin, request a presigned upload from POST /v0/media/presign (contentType and key are required), PUT the raw bytes to the returned URL, then use that file's URL in your post.

1. Request a presigned upload

curl -X POST https://api.schedulin.app/v0/media/presign \
  -H "x-api-key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "contentType": "image/jpeg",
    "key": "launch.jpg",
    "size": 248173
  }'

The response is:

{
  "url": "https://<bucket>.r2.cloudflarestorage.com/...",
  "key": "<your-org>/launch.jpg",
  "method": "PUT"
}

key is the final, org-scoped object key — use it to build the public file URL (https://cdn.schedulin.app/<key>) when attaching the media in step 3.

2. Upload the file

Issue an HTTP PUT of the raw bytes to url, with a Content-Type header matching the contentType you requested:

curl -X PUT "<url>" \
  -H "Content-Type: image/jpeg" \
  --data-binary @launch.jpg

3. Attach it to a post

curl -X POST https://api.schedulin.app/v0/posts \
  -H "x-api-key: sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "socialAccountId": "acc_123",
    "caption": "Behind the scenes 📸",
    "media": [{ "url": "https://cdn.schedulin.app/.../launch.jpg" }],
    "action": "now"
  }'
NOTE
You can also skip hosting and pass any publicly reachable directly in the array.