Posts
Update Post Attachments
Replaces the attachments (media) of the post with the given list. The list replaces all the existing attachments, so pass the full list the post should have; an empty list removes them all. Only the attachments of the main post change: the attachments of its comments, the content, the settings and the publish date are untouched, so a running publishing workflow is not restarted. The post is re-validated with the new attachments. Works only on not-yet-published posts (scheduled or draft).
PUT
/
posts
/
{id}
/
attachments
Update post attachments
curl --request PUT \
--url https://api.postiz.com/public/v1/posts/{id}/attachments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"attachments": [
{
"id": "img-1",
"path": "https://uploads.postiz.com/photo.jpg"
}
]
}
'import requests
url = "https://api.postiz.com/public/v1/posts/{id}/attachments"
payload = { "attachments": [
{
"id": "img-1",
"path": "https://uploads.postiz.com/photo.jpg"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({attachments: [{id: 'img-1', path: 'https://uploads.postiz.com/photo.jpg'}]})
};
fetch('https://api.postiz.com/public/v1/posts/{id}/attachments', 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://api.postiz.com/public/v1/posts/{id}/attachments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'attachments' => [
[
'id' => 'img-1',
'path' => 'https://uploads.postiz.com/photo.jpg'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.postiz.com/public/v1/posts/{id}/attachments"
payload := strings.NewReader("{\n \"attachments\": [\n {\n \"id\": \"img-1\",\n \"path\": \"https://uploads.postiz.com/photo.jpg\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://api.postiz.com/public/v1/posts/{id}/attachments")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"attachments\": [\n {\n \"id\": \"img-1\",\n \"path\": \"https://uploads.postiz.com/photo.jpg\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.postiz.com/public/v1/posts/{id}/attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"attachments\": [\n {\n \"id\": \"img-1\",\n \"path\": \"https://uploads.postiz.com/photo.jpg\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"postId": "post-123",
"publishDate": "2026-08-01T10:00:00"
}Body
application/json
Was this page helpful?
⌘I
Update post attachments
curl --request PUT \
--url https://api.postiz.com/public/v1/posts/{id}/attachments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"attachments": [
{
"id": "img-1",
"path": "https://uploads.postiz.com/photo.jpg"
}
]
}
'import requests
url = "https://api.postiz.com/public/v1/posts/{id}/attachments"
payload = { "attachments": [
{
"id": "img-1",
"path": "https://uploads.postiz.com/photo.jpg"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({attachments: [{id: 'img-1', path: 'https://uploads.postiz.com/photo.jpg'}]})
};
fetch('https://api.postiz.com/public/v1/posts/{id}/attachments', 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://api.postiz.com/public/v1/posts/{id}/attachments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'attachments' => [
[
'id' => 'img-1',
'path' => 'https://uploads.postiz.com/photo.jpg'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://api.postiz.com/public/v1/posts/{id}/attachments"
payload := strings.NewReader("{\n \"attachments\": [\n {\n \"id\": \"img-1\",\n \"path\": \"https://uploads.postiz.com/photo.jpg\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.put("https://api.postiz.com/public/v1/posts/{id}/attachments")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"attachments\": [\n {\n \"id\": \"img-1\",\n \"path\": \"https://uploads.postiz.com/photo.jpg\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.postiz.com/public/v1/posts/{id}/attachments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"attachments\": [\n {\n \"id\": \"img-1\",\n \"path\": \"https://uploads.postiz.com/photo.jpg\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"postId": "post-123",
"publishDate": "2026-08-01T10:00:00"
}
