Discovery
ดูข้อมูล key, list Brands และ accounts, อ่าน capabilities และจัดการ weekly queue schedule settings
อัปเดตล่าสุด
เนื้อหาในหน้านี้
Endpoint กลุ่ม Discovery บอก API key ว่ามองเห็นและทำอะไรได้: workspace, Brand และ account ใดเป็น target, key ถือ action ใด, แต่ละ account ที่เชื่อมต่อรองรับอะไร และ weekly queue slots ที่ใช้กับการ schedule แบบ next-slot เริ่ม integration ทุกตัวด้วยการอ่านชุดนี้ก่อนสร้างโพสต์
ดู principal ที่ยืนยันตัวตนแล้ว (Inspect the authenticated principal)
GET /api/v1/me
คืน principal ที่ยืนยันตัวตนแล้ว, workspace ID, Brand และ account IDs ตาม scope และ action ที่ได้รับ ใช้ได้กับทุก key ที่ถูกต้อง รวมถึง action-only key ที่จะไม่ผ่านการอ่าน discovery แบบอื่น Scopes: key ที่ยืนยันตัวตนแล้วใด ๆ CLI: postkub whoami MCP: whoami
Parameters: ไม่มี
Request example
curl -sS https://postkub.com/api/v1/me \
-H "Authorization: Bearer <API_KEY>"
Response 200 OK
{
"principalType": "api_key",
"workspaceId": "workspace_example1",
"user": null,
"apiKey": {
"id": "key_example1",
"name": "Content publishing",
"prefix": "pk_live_ab12cd",
"environment": "production",
"revision": 1,
"expiresAt": null
},
"actions": ["account:read", "brand:read", "post:create", "post:publish"],
"brandIds": ["brand_example1"],
"accountIds": ["acc_example1"],
"brands": [
{
"id": "brand_example1",
"name": "Acme Brand",
"timezone": "Asia/Bangkok",
"createdAt": "2026-10-21T00:00:00.000Z"
}
],
"accounts": [
{
"id": "acc_example1",
"brandId": "brand_example1",
"provider": "meta",
"platform": "facebook",
"name": "Acme Page",
"handle": "@acme",
"timezone": "Asia/Bangkok",
"status": "active",
"createdAt": "2026-10-21T00:00:00.000Z"
}
]
}
สำหรับ session ของมนุษย์ที่ลงชื่อเข้าใช้ principalType จะเป็น session user จะมีข้อมูลโปรไฟล์ และ apiKey เป็น null brandIds และ accountIds จะแสดง target scope ทั้งหมดของ key เสมอ ส่วน array brands และ accounts จะเป็น null เมื่อ key ไม่ได้ถือ brand:read และ account:read เพิ่มเติม
| สถานะ | ความหมาย |
|---|---|
| 200 | คืน principal และ scope ที่ได้รับ |
| 400 | Credential กำกวม (ดู Errors) |
| 401 | ต้องยืนยันตัวตน หรือ key หมดอายุ/ถูกเพิกถอน |
| 403 | Owner ถูกระงับ, ความเป็นเจ้าของค้างเก่า หรือ key รุ่นเก่าที่ไม่รองรับ |
List Brands
GET /api/v1/brands
แสดงรายการ Brand ที่ key ถูก scoped ไว้ Scopes: brand:read CLI: postkub brands list MCP: brands_list
Query parameters
| ชื่อ | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|
| limit | integer | ไม่ | ขนาดหน้า, 1-100, ค่าเริ่มต้น 50 |
| cursor | string | ไม่ | Opaque cursor จาก nextCursor, ยาวได้สูงสุด 512 อักขระ |
Request example
curl -sS "https://postkub.com/api/v1/brands?limit=50" \
-H "Authorization: Bearer <API_KEY>"
Response 200 OK
{
"items": [
{
"id": "brand_example1",
"name": "Acme Brand",
"timezone": "Asia/Bangkok",
"createdAt": "2026-10-21T00:00:00.000Z"
}
],
"nextCursor": null
}
ดูกติกา cursor ที่ Pagination
| สถานะ | ความหมาย |
|---|---|
| 200 | คืนรายการ Brand |
| 400 | Pagination ไม่ถูกต้อง (ดู Errors) |
| 401 | ต้องยืนยันตัวตน |
| 403 | Key ไม่มี brand:read |
List accounts
GET /api/v1/accounts
แสดงรายการโซเชียล account ที่เชื่อมต่อแล้วซึ่ง key ถูก scoped ไว้ Scopes: account:read CLI: postkub accounts list MCP: accounts_list
Query parameters
| ชื่อ | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|
| limit | integer | ไม่ | ขนาดหน้า, 1-100, ค่าเริ่มต้น 50 |
| cursor | string | ไม่ | Opaque cursor จาก nextCursor, ยาวได้สูงสุด 512 อักขระ |
| brandId | string | ไม่ | จำกัดผลลัพธ์เฉพาะ Brand ID ที่ระบุ |
Request example
curl -sS "https://postkub.com/api/v1/accounts?brandId=brand_example1" \
-H "Authorization: Bearer <API_KEY>"
Response 200 OK
{
"items": [
{
"id": "acc_example1",
"brandId": "brand_example1",
"provider": "meta",
"platform": "facebook",
"name": "Acme Page",
"handle": "@acme",
"timezone": "Asia/Bangkok",
"status": "active",
"createdAt": "2026-10-21T00:00:00.000Z"
}
],
"nextCursor": null
}
| สถานะ | ความหมาย |
|---|---|
| 200 | คืนรายการ account |
| 400 | Pagination ไม่ถูกต้อง (ดู Errors) |
| 401 | ต้องยืนยันตัวตน |
| 403 | Key ไม่มี account:read |
ดู capabilities ของ account (Get account capabilities)
GET /api/v1/accounts/{id}/capabilities
คืน capabilities ที่เป็นจริงของ account: action ใดที่ผู้เรียกใช้ได้กับ account นี้, publish format ใดผ่านการ qualify และเหตุผลการพร้อมใช้แบบชัดเจนในแต่ละ capability ควรเช็คหน้านี้ก่อน publish หรือ schedule ทุกครั้ง Scopes: account:read CLI: postkub capabilities get MCP: capabilities_get
Parameters
| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
| id | path | string | ใช่ | Social account ID |
Request example
curl -sS https://postkub.com/api/v1/accounts/acc_example1/capabilities \
-H "Authorization: Bearer <API_KEY>"
Response 200 OK
{
"accountId": "acc_example1",
"allowedActions": ["brand:read", "account:read"],
"publishFormats": [
{ "format": "image", "available": true, "reason": "Live image publication is qualified for this account" },
{ "format": "video", "available": false, "reason": "Live video publication is not qualified for this account yet" }
],
"availability": {
"drafts": { "available": true, "reason": "Drafts are enabled for this account" },
"publishing": { "available": true, "reason": "Publishing is enabled for this account" },
"comments": { "available": true, "reason": "Comment inbox, thread management, and provider replies are enabled for this account" },
"firstComment": { "available": false, "reason": "First comments are not supported for this account's platform yet" },
"insights": { "available": true, "reason": "Insights are enabled for this account" }
}
}
| สถานะ | ความหมาย |
|---|---|
| 200 | คืน capabilities และเหตุผล |
| 400 | Account ID ไม่ถูกต้อง (ดู Errors) |
| 401 | ต้องยืนยันตัวตน |
| 403 | Key ไม่มี account:read |
| 404 | ไม่พบ account หรืออยู่นอก scope ของ key |
อ่าน schedule settings (Read schedule settings)
GET /api/v1/accounts/{id}/schedule-settings
อ่าน weekly queue slots และ timezone ของ account การ schedule แบบ next-slot จะจอง slot ว่างที่เร็วที่สุดจากรายการนี้ Scopes: account:read CLI: postkub accounts schedule get MCP: accounts_schedule_get
Parameters
| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
| id | path | string | ใช่ | Social account ID |
Request example
curl -sS https://postkub.com/api/v1/accounts/acc_example1/schedule-settings \
-H "Authorization: Bearer <API_KEY>"
Response 200 OK
{
"accountId": "acc_example1",
"timezone": "Asia/Bangkok",
"revision": 4,
"slots": [
{ "weekday": 1, "localTime": "09:00" },
{ "weekday": 3, "localTime": "18:30" }
],
"updatedAt": "2026-11-20T04:12:00.000Z"
}
weekday ใช้ลำดับแบบ ISO: 1 คือวันจันทร์ ถึง 7 คือวันอาทิตย์ localTime เป็นเวลานาฬิกาแบบ 24 ชั่วโมง HH:MM ตาม timezone ของ account
| สถานะ | ความหมาย |
|---|---|
| 200 | คืน schedule settings |
| 400 | Account ID ไม่ถูกต้อง (ดู Errors) |
| 401 | ต้องยืนยันตัวตน |
| 403 | Key ไม่มี account:read |
| 404 | ไม่พบ account หรืออยู่นอก scope ของ key |
แก้ schedule settings (Update schedule settings)
PATCH /api/v1/accounts/{id}/schedule-settings
แก้ไข weekly queue slots และ/หรือ timezone เป็น mutation แบบมีเงื่อนไข: ต้องมี header Idempotency-Key และ expectedRevision ปัจจุบัน Scopes: account:schedule CLI: postkub accounts schedule update MCP: accounts_schedule_update
Parameters
| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
| id | path | string | ใช่ | Social account ID |
| Idempotency-Key | header | UUID | ใช่ | UUID ของ client ที่คงที่ ใช้ UUID เดิมซ้ำเมื่อ response หาย |
| expectedRevision | body | integer | ใช่ | revision ปัจจุบันจากการอ่าน, ค่าต่ำสุด 1 |
| timezone | body | string | ตามรูปแบบ body ใดรูปแบบหนึ่ง | ชื่อ IANA timezone, ยาว 1-128 อักขระ, เช่น Asia/Bangkok |
| slots | body | array | ตามรูปแบบ body ใดรูปแบบหนึ่ง | รายการ slot ใหม่ทั้งชุด, สูงสุด 100 รายการ, คู่ weekday กับ localTime ต้องไม่ซ้ำ |
โครงสร้าง slot แต่ละรายการ:
| ชื่อ | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|
| weekday | integer | ใช่ | 1-7 (1 คือวันจันทร์, 7 คือวันอาทิตย์) |
| localTime | string | ใช่ | HH:MM แบบ 24 ชั่วโมง, เช่น 09:00 |
ส่งได้ทั้ง timezone อย่างเดียว, slots อย่างเดียว หรือสองอย่างพร้อมกัน
Request example
curl -sS -X PATCH https://postkub.com/api/v1/accounts/acc_example1/schedule-settings \
-H "Authorization: Bearer <API_KEY>" \
-H "Idempotency-Key: 7f6c2f1e-8b4a-4c3d-9e2f-1a2b3c4d5e6f" \
-H "Content-Type: application/json" \
-d '{
"expectedRevision": 4,
"slots": [
{ "weekday": 1, "localTime": "09:00" },
{ "weekday": 3, "localTime": "18:30" }
]
}'
Response 200 OK
{
"requestId": "7f6c2f1e-8b4a-4c3d-9e2f-1a2b3c4d5e6f",
"scheduleSettings": {
"accountId": "acc_example1",
"timezone": "Asia/Bangkok",
"revision": 5,
"slots": [
{ "weekday": 1, "localTime": "09:00" },
{ "weekday": 3, "localTime": "18:30" }
],
"updatedAt": "2026-12-03T08:00:00.000Z"
}
}
| สถานะ | ความหมาย |
|---|---|
| 200 | แก้ settings สำเร็จ (หรือคืนผล replay ที่เหมือนเดิม) |
| 400 | Validation error, slots ไม่ถูกต้อง หรือ header ผิด (ดู Errors) |
| 401 | ต้องยืนยันตัวตน |
| 403 | Key ไม่มี account:schedule |
| 404 | ไม่พบ account หรืออยู่นอก scope ของ key |
| 409 | REVISION_CONFLICT (expectedRevision เก่า พร้อม error.details.currentRevision) หรือ idempotency conflict |
| 428 | REVISION_REQUIRED (ไม่ได้ส่ง expectedRevision) |
| 429 | เกินอัตรา request ของ key |
ดู synced videos (List synced videos)
GET /api/v1/accounts/{id}/synced-videos
Sync วิดีโอที่ยัง live ล่าสุดของ account จาก TikTok Display API (video.list) แสดงรายการ และรายงาน ID ของโพสต์ที่ publish ในระบบแล้วซึ่งวิดีโอถูกลบจาก TikTok ไปก่อนหน้า account ที่ไม่ใช่ TikTok จะได้ supported: false พร้อมรายการว่าง ไม่มีคำสั่ง CLI หรือ MCP tool สำหรับ operation นี้ Scopes: insight:read
Parameters
| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
|---|---|---|---|---|
| id | path | string | ใช่ | Social account ID |
Request example
curl -sS https://postkub.com/api/v1/accounts/acc_example1/synced-videos \
-H "Authorization: Bearer <API_KEY>"
Response 200 OK
{
"accountId": "acc_example1",
"supported": true,
"scopeMissing": false,
"videos": [
{
"id": "7425139482736152911",
"title": "Example video title",
"video_description": "Caption text",
"duration": 34,
"cover_image_url": "https://p16-sign-va.tiktokcdn.com/example.jpg",
"share_url": "https://www.tiktok.com/@acme/video/7425139482736152911",
"like_count": 120,
"comment_count": 15,
"share_count": 3,
"view_count": 5400,
"create_time": 1764840000
}
],
"archivedPostIds": ["post_example123"]
}
เมื่อ credential ของ TikTok ไม่มี scope video.list scopeMissing จะเป็น true และ videos ว่าง หาก sync กับ provider ล้มเหลว ระบบจะตั้ง syncError เป็น true แทนการให้ request ล้มเหลว
| สถานะ | ความหมาย |
|---|---|
| 200 | คืนรายการ synced video (อาจว่าง) |
| 400 | Account ID ไม่ถูกต้อง (ดู Errors) |
| 401 | ต้องยืนยันตัวตน |
| 403 | Key ไม่มี insight:read |
| 404 | ไม่พบ account หรืออยู่นอก scope ของ key |
