Tạo bài đăng
curl --request POST \
--url https://app.getkavio.app/api/posts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"platforms": [
{
"social_account_id": "<string>",
"content_type": "<string>"
}
],
"content": "<string>",
"media": [
{}
],
"scheduled_at": "<string>",
"label_ids": [
{}
]
}
'import requests
url = "https://app.getkavio.app/api/posts"
payload = {
"platforms": [
{
"social_account_id": "<string>",
"content_type": "<string>"
}
],
"content": "<string>",
"media": [{}],
"scheduled_at": "<string>",
"label_ids": [{}]
}
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({
platforms: [{social_account_id: '<string>', content_type: '<string>'}],
content: '<string>',
media: [{}],
scheduled_at: '<string>',
label_ids: [{}]
})
};
fetch('https://app.getkavio.app/api/posts', 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",
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([
'platforms' => [
[
'social_account_id' => '<string>',
'content_type' => '<string>'
]
],
'content' => '<string>',
'media' => [
[
]
],
'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"
payload := strings.NewReader("{\n \"platforms\": [\n {\n \"social_account_id\": \"<string>\",\n \"content_type\": \"<string>\"\n }\n ],\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"platforms\": [\n {\n \"social_account_id\": \"<string>\",\n \"content_type\": \"<string>\"\n }\n ],\n \"content\": \"<string>\",\n \"media\": [\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")
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 \"platforms\": [\n {\n \"social_account_id\": \"<string>\",\n \"content_type\": \"<string>\"\n }\n ],\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyBài đăng
Tạo bài đăng
Tạo bài đăng nháp cho một hoặc nhiều tài khoản mạng xã hội. Bài đăng mới được trả về với trạng thái 201.
POST
/
posts
Tạo bài đăng
curl --request POST \
--url https://app.getkavio.app/api/posts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"platforms": [
{
"social_account_id": "<string>",
"content_type": "<string>"
}
],
"content": "<string>",
"media": [
{}
],
"scheduled_at": "<string>",
"label_ids": [
{}
]
}
'import requests
url = "https://app.getkavio.app/api/posts"
payload = {
"platforms": [
{
"social_account_id": "<string>",
"content_type": "<string>"
}
],
"content": "<string>",
"media": [{}],
"scheduled_at": "<string>",
"label_ids": [{}]
}
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({
platforms: [{social_account_id: '<string>', content_type: '<string>'}],
content: '<string>',
media: [{}],
scheduled_at: '<string>',
label_ids: [{}]
})
};
fetch('https://app.getkavio.app/api/posts', 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",
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([
'platforms' => [
[
'social_account_id' => '<string>',
'content_type' => '<string>'
]
],
'content' => '<string>',
'media' => [
[
]
],
'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"
payload := strings.NewReader("{\n \"platforms\": [\n {\n \"social_account_id\": \"<string>\",\n \"content_type\": \"<string>\"\n }\n ],\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"platforms\": [\n {\n \"social_account_id\": \"<string>\",\n \"content_type\": \"<string>\"\n }\n ],\n \"content\": \"<string>\",\n \"media\": [\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")
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 \"platforms\": [\n {\n \"social_account_id\": \"<string>\",\n \"content_type\": \"<string>\"\n }\n ],\n \"content\": \"<string>\",\n \"media\": [\n {}\n ],\n \"scheduled_at\": \"<string>\",\n \"label_ids\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_bodyTạo bài đăng ở trạng thái
draft. Sau đó, gọi PUT /posts/{post} với status=scheduled để lên lịch hoặc status=publishing để đăng ngay.
Bài đăng Pinterest:
POST /posts không nhận meta riêng cho từng nền
tảng. Sau khi tạo bài, hãy gọi PUT /posts/{post} và đặt
platforms[].meta.board_id cho từng mục Pinterest; nếu không, tác vụ đăng sẽ
thất bại với lỗi Pinterest board_id is required.Yêu cầu
array
bắt buộc
Cần ít nhất một nền tảng. Mỗi mục liên kết bài đăng với một tài khoản mạng xã hội đã kết nối và một
content_type.Hiện thuộc tính con
Hiện thuộc tính con
string
bắt buộc
UUID của tài khoản mạng xã hội đang hoạt động trong không gian làm việc hiện tại. Tài khoản không hoạt động hoặc thuộc nơi khác sẽ bị từ chối.
string
bắt buộc
Định dạng dành cho nền tảng này và phải tương thích với nền tảng của tài khoản. Xem danh mục qua
GET /content-types.Giá trị hợp lệ: linkedin_post, linkedin_carousel, linkedin_page_post, linkedin_page_carousel, x_post, facebook_post, facebook_reel, facebook_story, instagram_feed, instagram_carousel, instagram_reel, instagram_story, tiktok_video, tiktok_photo, youtube_short, threads_post, pinterest_pin, pinterest_video_pin, pinterest_carousel, bluesky_post, mastodon_post.string
Nội dung bài đăng dùng chung cho mọi nền tảng. API cho phép tối đa 10.000 ký
tự (giới hạn riêng của từng nền tảng vẫn được áp dụng; xem
GET /content-types để biết chi tiết). Mặc định là chuỗi
rỗng.array
Nội dung đa phương tiện cần đính kèm. Mỗi mục phải có cấu trúc giống kết quả
từ
POST /posts/{post}/media: id, path, url, type,
mime_type, original_filename. Thông thường, bạn nên dùng endpoint tải tệp
lên hoặc đính kèm từ URL.string
Thời điểm ISO 8601 trong tương lai (ví dụ
2026-05-10T15:30:00Z). Giá trị
được lưu vào bản nháp, nên yêu cầu PUT với status=scheduled sau đó không
cần gửi lại. Mặc định là 09:00 UTC trong ngày hiện tại.array
UUID của các nhãn cần gắn. Nhãn phải thuộc cùng không gian làm việc với khóa
API. key.
Phản hồi
Trả về201 cùng bài đăng vừa tạo. Cấu trúc phản hồi giống GET /posts/{post}; xem endpoint đó để biết đầy đủ các trường.
curl -X POST https://app.getkavio.app/api/posts \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Hello from the Kavio API!",
"platforms": [
{
"social_account_id": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
"content_type": "linkedin_post"
}
],
"scheduled_at": "2026-05-10T15:30:00Z",
"label_ids": ["c3d4e5f6-a7b8-9c0d-1e2f-3a4b5c6d7e8f"]
}'
{
"id": "9f1a2b3c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
"content": "Hello from the Kavio API!",
"media": [],
"status": "draft",
"scheduled_at": "2026-05-10 15:30:00",
"published_at": null,
"platforms": [
{
"id": "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d",
"platform": "linkedin",
"content_type": "linkedin_post",
"status": "pending",
"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:00:00"
}

