Discovery

ดูข้อมูล key, list Brands และ accounts, อ่าน capabilities และจัดการ weekly queue schedule settings

อัปเดตล่าสุด

เปิดใน Claudeเปิดใน ChatGPT
เนื้อหาในหน้านี้

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 ที่ได้รับ
400Credential กำกวม (ดู Errors)
401ต้องยืนยันตัวตน หรือ key หมดอายุ/ถูกเพิกถอน
403Owner ถูกระงับ, ความเป็นเจ้าของค้างเก่า หรือ key รุ่นเก่าที่ไม่รองรับ

List Brands

GET /api/v1/brands

แสดงรายการ Brand ที่ key ถูก scoped ไว้ Scopes: brand:read CLI: postkub brands list MCP: brands_list

Query parameters

ชื่อชนิดจำเป็นคำอธิบาย
limitintegerไม่ขนาดหน้า, 1-100, ค่าเริ่มต้น 50
cursorstringไม่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
400Pagination ไม่ถูกต้อง (ดู Errors)
401ต้องยืนยันตัวตน
403Key ไม่มี brand:read

List accounts

GET /api/v1/accounts

แสดงรายการโซเชียล account ที่เชื่อมต่อแล้วซึ่ง key ถูก scoped ไว้ Scopes: account:read CLI: postkub accounts list MCP: accounts_list

Query parameters

ชื่อชนิดจำเป็นคำอธิบาย
limitintegerไม่ขนาดหน้า, 1-100, ค่าเริ่มต้น 50
cursorstringไม่Opaque cursor จาก nextCursor, ยาวได้สูงสุด 512 อักขระ
brandIdstringไม่จำกัดผลลัพธ์เฉพาะ 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
400Pagination ไม่ถูกต้อง (ดู Errors)
401ต้องยืนยันตัวตน
403Key ไม่มี 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

ชื่อตำแหน่งชนิดจำเป็นคำอธิบาย
idpathstringใช่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 และเหตุผล
400Account ID ไม่ถูกต้อง (ดู Errors)
401ต้องยืนยันตัวตน
403Key ไม่มี 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

ชื่อตำแหน่งชนิดจำเป็นคำอธิบาย
idpathstringใช่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
400Account ID ไม่ถูกต้อง (ดู Errors)
401ต้องยืนยันตัวตน
403Key ไม่มี 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

ชื่อตำแหน่งชนิดจำเป็นคำอธิบาย
idpathstringใช่Social account ID
Idempotency-KeyheaderUUIDใช่UUID ของ client ที่คงที่ ใช้ UUID เดิมซ้ำเมื่อ response หาย
expectedRevisionbodyintegerใช่revision ปัจจุบันจากการอ่าน, ค่าต่ำสุด 1
timezonebodystringตามรูปแบบ body ใดรูปแบบหนึ่งชื่อ IANA timezone, ยาว 1-128 อักขระ, เช่น Asia/Bangkok
slotsbodyarrayตามรูปแบบ body ใดรูปแบบหนึ่งรายการ slot ใหม่ทั้งชุด, สูงสุด 100 รายการ, คู่ weekday กับ localTime ต้องไม่ซ้ำ

โครงสร้าง slot แต่ละรายการ:

ชื่อชนิดจำเป็นคำอธิบาย
weekdayintegerใช่1-7 (1 คือวันจันทร์, 7 คือวันอาทิตย์)
localTimestringใช่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 ที่เหมือนเดิม)
400Validation error, slots ไม่ถูกต้อง หรือ header ผิด (ดู Errors)
401ต้องยืนยันตัวตน
403Key ไม่มี account:schedule
404ไม่พบ account หรืออยู่นอก scope ของ key
409REVISION_CONFLICT (expectedRevision เก่า พร้อม error.details.currentRevision) หรือ idempotency conflict
428REVISION_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

ชื่อตำแหน่งชนิดจำเป็นคำอธิบาย
idpathstringใช่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 (อาจว่าง)
400Account ID ไม่ถูกต้อง (ดู Errors)
401ต้องยืนยันตัวตน
403Key ไม่มี insight:read
404ไม่พบ account หรืออยู่นอก scope ของ key