Attach media from URLs
curl --request POST \
--url https://app.getkavio.app/api/posts/{post}/media/from-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"urls": [
{}
]
}
'import requests
url = "https://app.getkavio.app/api/posts/{post}/media/from-url"
payload = { "urls": [{}] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({urls: [{}]})
};
fetch('https://app.getkavio.app/api/posts/{post}/media/from-url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.getkavio.app/api/posts/{post}/media/from-url",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.getkavio.app/api/posts/{post}/media/from-url"
payload := strings.NewReader("{\n \"urls\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.getkavio.app/api/posts/{post}/media/from-url")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getkavio.app/api/posts/{post}/media/from-url")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"post": {},
"attached_count": 123,
"failed_urls": [
{}
]
}Posts
Attach media from URLs
Download images or videos from public URLs and attach them to a post.
POST
/
posts
/
{post}
/
media
/
from-url
Attach media from URLs
curl --request POST \
--url https://app.getkavio.app/api/posts/{post}/media/from-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"urls": [
{}
]
}
'import requests
url = "https://app.getkavio.app/api/posts/{post}/media/from-url"
payload = { "urls": [{}] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({urls: [{}]})
};
fetch('https://app.getkavio.app/api/posts/{post}/media/from-url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.getkavio.app/api/posts/{post}/media/from-url",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.getkavio.app/api/posts/{post}/media/from-url"
payload := strings.NewReader("{\n \"urls\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.getkavio.app/api/posts/{post}/media/from-url")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getkavio.app/api/posts/{post}/media/from-url")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"post": {},
"attached_count": 123,
"failed_urls": [
{}
]
}For uploading a file directly from your machine instead of fetching a URL, use
POST /posts/{post}/media.
Path parameters
Request
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)
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:The updated post — same shape as
GET /posts/{post} , with newly-attached items now in the media[] 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.getkavio.app/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": "medias/2681a1bf-131f-41b1-9866-755c1cb51f97.jpg",
"url": "https://media.getkavio.app/medias/2681a1bf-131f-41b1-9866-755c1cb51f97.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"]
}

