Skip to main content
POST
/
posts
/
{post}
/
media
/
from-url
curl -X POST https://app.trypost.it/api/posts/9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c/media/from-url \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://cdn.example.com/photo.jpg",
      "https://cdn.example.com/video.mp4"
    ]
  }'
{
  "post": {
    "id": "9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
    "content": "Launch day!",
    "media": [
      {
        "id": "01HX1A2B3C4D5E6F7G8H9I0J1K",
        "path": "media/01HX1A2B-photo.jpg",
        "url": "https://app.trypost.it/storage/media/01HX1A2B-photo.jpg",
        "type": "image",
        "mime_type": "image/jpeg",
        "original_filename": "photo.jpg"
      }
    ],
    "status": "draft",
    "scheduled_at": null,
    "published_at": null,
    "platforms": [],
    "labels": [],
    "created_at": "2025-01-14 09:00:00",
    "updated_at": "2025-01-14 09:30:00"
  },
  "attached_count": 1,
  "failed_urls": [
    "https://cdn.example.com/video.mp4"
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.trypost.it/llms.txt

Use this file to discover all available pages before exploring further.

For uploading a file directly from your machine instead of fetching a URL, use POST /posts/{post}/media.

Path parameters

post
string
required
The UUID of the post to attach media to.

Request

urls
array
required
Public HTTP/HTTPS URLs of images or videos. Max 10 URLs per call. Size caps are enforced per type (10 MB for images, 1 GB for videos).Allowed MIME types:
  • Images: image/jpeg, image/png, image/gif, image/webp
  • Videos: video/mp4, video/quicktime (MOV)
URLs are downloaded server-side and stored as Media records on the workspace.

Behaviour

  • The post must belong to the caller’s current workspace; otherwise the response is 404.
  • Allowed media types are intersected with the platforms enabled on the post. If an enabled platform doesn’t support the file type (e.g. video on a platform that’s image-only), that file is rejected and listed in failed_urls.
  • Successful attachments are appended to the post’s media[] array.

Response

Returns an object with three fields:
post
object
The updated post — same shape as GET /posts/{post}, with newly-attached items now in the media[] array.
attached_count
integer
Number of URLs that were successfully downloaded and attached.
failed_urls
array
URLs that were rejected (unreachable, wrong MIME type, too large, or not allowed by any enabled platform). Each entry is the original URL string.
curl -X POST https://app.trypost.it/api/posts/9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c/media/from-url \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://cdn.example.com/photo.jpg",
      "https://cdn.example.com/video.mp4"
    ]
  }'
{
  "post": {
    "id": "9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
    "content": "Launch day!",
    "media": [
      {
        "id": "01HX1A2B3C4D5E6F7G8H9I0J1K",
        "path": "media/01HX1A2B-photo.jpg",
        "url": "https://app.trypost.it/storage/media/01HX1A2B-photo.jpg",
        "type": "image",
        "mime_type": "image/jpeg",
        "original_filename": "photo.jpg"
      }
    ],
    "status": "draft",
    "scheduled_at": null,
    "published_at": null,
    "platforms": [],
    "labels": [],
    "created_at": "2025-01-14 09:00:00",
    "updated_at": "2025-01-14 09:30:00"
  },
  "attached_count": 1,
  "failed_urls": [
    "https://cdn.example.com/video.mp4"
  ]
}