API Reference
เร็วๆ นี้ — Public REST API อยู่ในแผนงานของเราและยังไม่พร้อมใช้งาน เอกสารด้านล่างอธิบายการออกแบบ API ที่วางแผนไว้ เราจะประกาศความพร้อมใช้งานใน changelog ของเรา
PostClaw REST API จะช่วยให้คุณจัดการโพสต์ แพลตฟอร์ม ระบบอัตโนมัติ และการสร้างเนื้อหา AI แบบโปรแกรมได้
Base URL: https://app.postclaw.fun/v1
การยืนยันตัวตน
ทุกคำขอต้องใช้ Bearer token สร้าง API key ได้ที่ Settings → API Keys
curl https://app.postclaw.fun/v1/posts \
-H "Authorization: Bearer YOUR_API_KEY"
Key มีขอบเขต: read, write หรือ admin ใช้ขอบเขตที่น้อยที่สุดเท่าที่จำเป็น
Rate Limits
| แพ็กเกจ | คำขอ/นาที |
|---|---|
| Free | 30 |
| Pro | 120 |
| Business | 600 |
Rate limit headers จะถูกส่งกลับในทุก response:
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 119
X-RateLimit-Reset: 1743484800
Endpoints
โพสต์
# รายการโพสต์
GET /v1/posts?status=scheduled&limit=20
# สร้างโพสต์
POST /v1/posts
{
"content": "Your caption here",
"platforms": ["twitter", "linkedin"],
"scheduled_at": "2026-04-01T09:00:00Z",
"media_ids": ["media_abc123"]
}
# ดูโพสต์
GET /v1/posts/{id}
# ยกเลิกโพสต์ที่กำหนดเวลาไว้
DELETE /v1/posts/{id}
Media
# อัปโหลด media
POST /v1/media
Content-Type: multipart/form-data
# Returns: { "id": "media_abc123", "url": "...", "type": "image" }
# รายการ media library
GET /v1/media?type=image&limit=50
แพลตฟอร์ม
# รายการบัญชีที่เชื่อมต่อ
GET /v1/platforms
# ยกเลิกการเชื่อมต่อบัญชี
DELETE /v1/platforms/{id}
การสร้างเนื้อหา AI
# สร้างข้อความโพสต์
POST /v1/ai/text
{
"prompt": "Announce our new feature: dark mode",
"platform": "twitter",
"tone": "casual"
}
# สร้างรูปภาพ
POST /v1/ai/image
{
"prompt": "Clean minimal desk setup, natural light",
"size": "1024x1024"
}
ระบบอัตโนมัติ
# รายการระบบอัตโนมัติ
GET /v1/automations
# เรียกใช้ระบบอัตโนมัติแบบ manual
POST /v1/automations/{id}/trigger
{ "input": "https://example.com/article" }
Webhooks
ลงทะเบียน URL เพื่อรับ events:
POST /v1/webhooks
{
"url": "https://yoursite.com/postclaw-events",
"events": ["post.published", "post.failed", "automation.completed"]
}
โครงสร้าง event payload:
{
"event": "post.published",
"timestamp": "2026-04-01T09:00:05Z",
"data": {
"post_id": "post_xyz789",
"platform": "twitter",
"url": "https://twitter.com/user/status/..."
}
}
Error Responses
ข้อผิดพลาดทั้งหมดมีรูปแบบที่สม่ำเสมอ:
{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Retry after 60 seconds.",
"retry_after": 60
}
}
รหัสข้อผิดพลาดทั่วไป: unauthorized, forbidden, not_found, validation_error, rate_limit_exceeded, platform_error
SDKs
Official SDKs อยู่ระหว่างการพัฒนา สำหรับตอนนี้ใช้ HTTP client ใดก็ได้ API มีเอกสารครบถ้วนที่ app.postclaw.fun/docs (OpenAPI 3.1 spec พร้อมให้ดาวน์โหลด)