Cập nhật bài đăng
curl --request PUT \
--url https://app.getkavio.app/api/posts/{post} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "<string>",
"content": "<string>",
"media": [
{}
],
"platforms": [
{
"id": "<string>",
"content_type": "<string>",
"meta": {}
}
],
"scheduled_at": "<string>",
"label_ids": [
{}
]
}
'import requests
url = "https://app.getkavio.app/api/posts/{post}"
payload = {
"status": "<string>",
"content": "<string>",
"media": [{}],
"platforms": [
{
"id": "<string>",
"content_type": "<string>",
"meta": {}
}
],
"scheduled_at": "<string>",
"label_ids": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
status: '<string>',
content: '<string>',
media: [{}],
platforms: [{id: '<string>', content_type: '<string>', meta: {}}],
scheduled_at: '<string>',
label_ids: [{}]
})
};
fetch('https://app.getkavio.app/api/posts/{post}', 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}",
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([
'status' => '<string>',
'content' => '<string>',
'media' => [
[
]
],
'platforms' => [
[
'id' => '<string>',
'content_type' => '<string>',
'meta' => [
]
]
],
'scheduled_at' => '<string>',
'label_ids' => [
[
]
]
]),
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}"
payload := strings.NewReader("{\n \"status\": \"<string>\",\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"platforms\": [\n {\n \"id\": \"<string>\",\n \"content_type\": \"<string>\",\n \"meta\": {}\n }\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\n {}\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://app.getkavio.app/api/posts/{post}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"<string>\",\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"platforms\": [\n {\n \"id\": \"<string>\",\n \"content_type\": \"<string>\",\n \"meta\": {}\n }\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getkavio.app/api/posts/{post}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"<string>\",\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"platforms\": [\n {\n \"id\": \"<string>\",\n \"content_type\": \"<string>\",\n \"meta\": {}\n }\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyBài đăng
Cập nhật bài đăng
Cập nhật nội dung, lịch đăng, nền tảng đang bật hoặc nhãn của bài đăng, đồng thời có thể bắt đầu đăng.
PUT
/
posts
/
{post}
Cập nhật bài đăng
curl --request PUT \
--url https://app.getkavio.app/api/posts/{post} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "<string>",
"content": "<string>",
"media": [
{}
],
"platforms": [
{
"id": "<string>",
"content_type": "<string>",
"meta": {}
}
],
"scheduled_at": "<string>",
"label_ids": [
{}
]
}
'import requests
url = "https://app.getkavio.app/api/posts/{post}"
payload = {
"status": "<string>",
"content": "<string>",
"media": [{}],
"platforms": [
{
"id": "<string>",
"content_type": "<string>",
"meta": {}
}
],
"scheduled_at": "<string>",
"label_ids": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
status: '<string>',
content: '<string>',
media: [{}],
platforms: [{id: '<string>', content_type: '<string>', meta: {}}],
scheduled_at: '<string>',
label_ids: [{}]
})
};
fetch('https://app.getkavio.app/api/posts/{post}', 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}",
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([
'status' => '<string>',
'content' => '<string>',
'media' => [
[
]
],
'platforms' => [
[
'id' => '<string>',
'content_type' => '<string>',
'meta' => [
]
]
],
'scheduled_at' => '<string>',
'label_ids' => [
[
]
]
]),
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}"
payload := strings.NewReader("{\n \"status\": \"<string>\",\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"platforms\": [\n {\n \"id\": \"<string>\",\n \"content_type\": \"<string>\",\n \"meta\": {}\n }\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\n {}\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://app.getkavio.app/api/posts/{post}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"<string>\",\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"platforms\": [\n {\n \"id\": \"<string>\",\n \"content_type\": \"<string>\",\n \"meta\": {}\n }\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.getkavio.app/api/posts/{post}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"<string>\",\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"platforms\": [\n {\n \"id\": \"<string>\",\n \"content_type\": \"<string>\",\n \"meta\": {}\n }\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyYêu cầu
string
bắt buộc
ID của bài đăng.
string
bắt buộc
Trạng thái bài đăng, gồm một trong các giá trị:
draft— giữ ở dạng bản nhápscheduled— lên lịch theo thời điểm trongscheduled_at(phải ở tương lai)publishing— đăng ngay: gửi tác vụ đăng tới mọi nền tảng đang bật
scheduled, scheduled_at bắt buộc phải là thời điểm trong tương lai.string
Phần chú thích hoặc nội dung văn bản của bài đăng.
array
Nội dung đa phương tiện cần gắn với bài đăng. Thông thường, bạn nên tải lên
trước qua
POST /posts/{post}/media (tệp) hoặc POST /posts/{post} /media/from-url (URL), để các endpoint này tự thêm
vào media[].array
Mảng các nền tảng cần bật. Mọi nền tảng KHÔNG có trong mảng sẽ bị tắt. Truyền mảng rỗng để tắt tất cả.
Hiện thuộc tính con
Hiện thuộc tính con
string
bắt buộc
ID của mục post_platform (lấy từ
GET /posts/{id} hoặc GET /posts).string
Ghi đè
content_type của nền tảng, chẳng hạn dùng linkedin_carousel thay cho linkedin_post mặc định. Xem các giá trị hợp lệ qua GET /content-types. Giá trị sẽ được đối chiếu với nền tảng của tài khoản mạng xã hội tương ứng.object
Metadata tùy chỉnh cho từng nền tảng. Ví dụ:
- Pinterest (
pinterest_pin,pinterest_video_pin,pinterest_carousel): bắt buộc cómeta.board_idđể đăng. Nếu bài không gửi giá trị này và tài khoản chưa đặtdefault_board_id, tác vụ sẽ thất bại với lỗiPinterest board_id is required. Lấy ID bảng từ endpoint/v5/boardscủa Pinterest hoặc chọn trong trang Accounts trên bảng điều khiển. - TikTok (video): hỗ trợ
meta.privacy_level(PUBLIC_TO_EVERYONE,MUTUAL_FOLLOW_FRIENDS,FOLLOWER_OF_CREATOR,SELF_ONLY),meta.disable_comment,meta.disable_duet,meta.disable_stitch,meta.brand_content_toggle,meta.brand_organic_toggle. Vớitiktok_photo, chỉ áp dụngprivacy_levelvàdisable_comment.
meta; khóa lạ vẫn được lưu nhưng bị bỏ qua khi đăng. Ứng dụng web kiểm tra trước meta.board_id với nội dung Pinterest, còn bên gọi REST phải tự thực hiện kiểm tra này.string
Thời điểm theo ISO 8601. Bắt buộc khi
status=scheduled.array
Mảng UUID của các nhãn cần gắn vào bài đăng. Mảng này thay thế toàn bộ nhãn
hiện có.
Phản hồi
Trả về bài đăng đã cập nhật. Nếu bài đã được đăng, API trả về422 cùng { "message": "Cannot edit a published post." }.
curl -X PUT https://app.getkavio.app/api/posts/9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "publishing",
"content": "Launching now!",
"platforms": [
{ "id": "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d", "content_type": "linkedin_post" }
],
"label_ids": ["c3d4e5f6-a7b8-9c0d-1e2f-3a4b5c6d7e8f"]
}'
{
"id": "9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
"content": "Launching now!",
"media": [],
"status": "publishing",
"scheduled_at": "2025-01-15 10:30:00",
"published_at": null,
"platforms": [
{
"id": "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d",
"platform": "linkedin",
"content_type": "linkedin_post",
"status": "publishing",
"enabled": true,
"platform_url": null,
"published_at": null,
"error_message": null,
"display_name": "John Doe",
"display_username": "johndoe",
"display_avatar": "https://media.licdn.com/.../avatar.jpg",
"social_account": {
"id": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
"platform": "linkedin",
"display_name": "John Doe",
"username": "johndoe",
"is_active": true,
"status": "connected"
}
}
],
"labels": [
{
"id": "c3d4e5f6-a7b8-9c0d-1e2f-3a4b5c6d7e8f",
"name": "Product Launch",
"color": "#4f46e5",
"created_at": "2025-01-10 08:00:00",
"updated_at": "2025-01-10 08:00:00"
}
],
"created_at": "2025-01-14 09:00:00",
"updated_at": "2025-01-14 09:30:00"
}
Mẹo
- Để đăng một bản nháp hiện có, chỉ cần gửi
{ "status": "publishing" }; nội dung và nền tảng đã lưu vẫn được giữ nguyên. - Để lên lịch, gửi
{ "status": "scheduled", "scheduled_at": "2025-12-31T15:30:00Z" }. - Để thay đổi các nền tảng đang hoạt động mà không sửa nội dung, chỉ cần gửi mảng
platforms[].

