Docs

Media

Upload assets to the Onepostly CDN and attach them to posts via mediaUrls.

Upload files once to Onepostly, then reuse the returned CDN url in POST /v1/posts as mediaUrls[]. Platforms that need media will use that URL when publishing (X also requires media.write).

Supported types

Content-TypeExtensionsNotes
image/jpeg.jpg, .jpeg
image/png.png
image/gif.gifAnimated OK; X treats as single media
image/webp.webp
video/mp4.mp4
video/quicktime.mov
video/webm.webm
LimitValue
Max file size100 MB (Onepostly upload)
Field namefile (multipart)

Platforms may enforce stricter limits at publish (see X → Posts, YouTube → Posts for the 256 MB YouTube publish cap).

Upload

curl -X POST https://api.onepostly.com/v1/media \
  -H "x-api-key: op_YOUR_KEY" \
  -F "file=@./photo.jpg"

Response 201:

{
  "media": {
    "id": "MEDIA_ID",
    "url": "https://cdn.onepostly.com/media/WORKSPACE_ID/MEDIA_ID.jpg",
    "contentType": "image/jpeg",
    "byteSize": 245760,
    "originalFilename": "photo.jpg",
    "createdAt": "2026-07-15T12:00:00.000Z"
  }
}

Attach to a post

{
  "text": "Ship day",
  "mediaUrls": ["https://cdn.onepostly.com/media/WORKSPACE_ID/MEDIA_ID.jpg"],
  "mediaKind": "image",
  "destinations": [{ "connectionId": "YOUR_CONNECTION_ID" }]
}
  • mediaUrls accepts one or more CDN URLs (max 10 on create; platforms may allow fewer)
  • mediaKind: text | image | multi-image | video | stories (see platform docs for what each supports)

List

curl "https://api.onepostly.com/v1/media?limit=20&offset=0" \
  -H "x-api-key: op_YOUR_KEY"
{
  "media": [ { "id": "…", "url": "…", "contentType": "…", "byteSize": 0, "originalFilename": null, "createdAt": "…" } ],
  "total": 42
}
QueryDefaultMax
limit20100
offset0

Delete

curl -X DELETE https://api.onepostly.com/v1/media/MEDIA_ID \
  -H "x-api-key: op_YOUR_KEY"

Returns 204 on success. Removes the CDN object and the workspace’s media record. Already-published posts that referenced the URL are not rewritten.

Errors

CodeHTTPMeaning
VALIDATION_ERROR400Missing file or not multipart
UNSUPPORTED_MEDIA_TYPE400Type not in the allow-list above
MEDIA_TOO_LARGE400Over 100 MB
NOT_CONFIGURED503Media storage not configured
NOT_FOUND404Unknown MEDIA_ID on delete
FORBIDDEN403Read-only API key on upload/delete
UNAUTHORIZED401Missing/invalid API key

Flow

  1. POST /v1/media → CDN url
  2. POST /v1/posts with mediaUrls: [url] (+ mediaKind)
  3. Destination publishes using that URL

See also X → Posts.