Social — Post#
Worker đăng bài social dùng credentials account (đã register sẵn).
Base URL: https://manager.likepion.com/api/v1/social
1. Lấy danh sách task #
curl -X GET 'https://manager.likepion.com/api/v1/social/links?limit=5' \
-H 'X-API-Key: <api_key>'Response#
{
"success": true,
"data": [
{
"id": "b2c3d4e5-6789-01ab-cdef-234567890abc",
"request_id": "f0e1d2c3-b4a5-6789-0abc-def123456789",
"account_id": "a1b2c3d4-5678-9abc-def0-123456789abc",
"domain": "example-social.com",
"website": "https://likepion.com",
"email": "socactive@seed.com",
"username": "socactive",
"password": "pwReal!",
"pass_mail": "xxxx xxxx xxxx xxxx",
"twofa": "JBSWY3DPEHPK3PXP",
"app_password": "xxxx xxxx xxxx xxxx",
"cookie": "sid=abc",
"title": "Bài viết SEO backlink",
"about": "<p>Nội dung HTML với anchor <a href=\"https://likepion.com\">likepion</a></p>",
"images": [
{ "id": "uuid", "url": "https://s3.likepion.com/posts/img.jpg" }
]
}
]
}Fields#
| Field | Mô tả |
|---|---|
email / username / password / cookie | Credentials account đã register sẵn |
account_id | ID account đã register sẵn |
pass_mail | Mật khẩu Gmail |
twofa | Base32 secret TOTP |
app_password | App password Gmail |
title | Tiêu đề bài (đã xử lý spin) |
about | Nội dung HTML (đã xử lý spin, chứa anchor backlink) |
images | Ảnh insert vào bài |
2. Lấy chi tiết task #
Lấy thông tin 1 task cụ thể theo id. Không cần filter server/status. Không thay đổi DB.
curl -X GET 'https://manager.likepion.com/api/v1/social/links/TASK_ID' \
-H 'X-API-Key: <api_key>'Response#
Trả về 1 object (không bọc trong mảng) — schema giống bước 1.
{ "success": true, "data": { ...task fields... } }Nếu task không tồn tại hoặc đã soft-delete → HTTP 404 {"success": false, "message": "task not found"}.
3. Báo đang xử lý #
Sau khi pull task, bắt buộc gọi API này để chuyển task sang trạng thái running. Assign tự set started_at = NOW() (idempotent — gọi lại nhiều lần không đổi).
curl -X POST 'https://manager.likepion.com/api/v1/social/links/<task_id>/start' \
-H 'X-API-Key: <api_key>'Response#
{ "success": true }4. Báo hoàn thành #
curl -X POST 'https://manager.likepion.com/api/v1/social/links/<task_id>/complete' \
-H 'X-API-Key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{"link_post": "https://example-social.com/u/socactive/post/12345"}'| Field | Bắt buộc | Mô tả |
|---|---|---|
link_post | ✔ | URL bài đã đăng |
Response#
{ "success": true }5. Báo thất bại #
curl -X POST 'https://manager.likepion.com/api/v1/social/links/<task_id>/fail' \
-H 'X-API-Key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{"error_message": "rate limit from social site"}'Response#
{ "success": true }6. Lấy chi tiết tài khoản #
Worker dùng để refetch credentials/cookie/link_profile khi token expired hoặc check posting_status để biết account còn đang xử lý không.
ACCOUNT_ID lấy từ field account_id trong response của bước 1.
curl -X GET 'https://manager.likepion.com/api/v1/social/accounts/<account_id>' \
-H 'X-API-Key: <api_key>'Response#
{
"success": true,
"data": {
"id": "uuid-account",
"post_id": "uuid-post-running",
"register_id": "uuid-register",
"group_id": "uuid-group",
"site_id": "uuid-site",
"site_name": "sutori.com",
"status": "active",
"posting_status": "posting",
"post_task_id": "uuid-social-post-link",
"post_link": "",
"email": "...",
"username": "...",
"password": "...",
"pass_mail": "...",
"twofa": "...",
"app_password": "...",
"link_profile": "https://sutori.com/u/socactive",
"created_at": "2026-04-28T13:05:58+0700",
"updated_at": "2026-05-06T09:35:35+0700",
"last_used_at": "2026-05-06T09:35:35+0700",
"cookie": "sid=abc123; csrf=xyz"
}
}Fields#
| Field | Mô tả |
|---|---|
id | UUID account |
post_id | UUID social_post.id đang pending/running cùng group (mới nhất). "" nếu không có post đang chạy |
register_id | UUID social_register.id đã tạo account |
group_id | UUID group |
site_id / site_name | Site (vd sutori.com, tumblr.com) |
status | Status REGISTER: pending/running/completed/active/failed/banned/dead |
posting_status | Status POST hiện tại: posting (task đang chạy), done (đã có link_post), idle (chưa có task post / task ở terminal khác) |
post_task_id | UUID social_post_link.id mới nhất gắn account này. "" nếu chưa có |
post_link | URL link_post đã đăng (chỉ có khi posting_status="done") |
email / username / password | Credentials login |
pass_mail | Mật khẩu Gmail |
twofa | Base32 TOTP secret |
app_password | App password Gmail |
link_profile | URL profile social (vd FB profile, IG bio link) |
created_at / updated_at / last_used_at | Timestamps ISO 8601 |
cookie | Session cookie (luôn cuối) |
Lỗi thường gặp#
| HTTP | Body | Nguyên nhân |
|---|---|---|
| 400 | {"success":false,"message":"account id required"} | Path param trống |
| 404 | {"success":false,"message":"account không tồn tại hoặc đã xoá"} | account_id sai hoặc đã soft-delete |
7. Cập nhật tài khoản #
Worker dùng khi phát hiện account cần update trong lúc đang post — vd cookie hết hạn cần refresh, account bị khoá / banned, password đổi, hay muốn ghi note. Endpoint không thay đổi trạng thái task, chỉ update bản ghi social_account.
ACCOUNT_ID lấy từ field account_id trong response của bước 1.
curl -X PUT 'https://manager.likepion.com/api/v1/social/accounts/<account_id>' \
-H 'X-API-Key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{
"cookie": "sid=newvalue; csrf=...",
"status": "active",
"note": "auto-refreshed after 401",
"error_message": ""
}'Body — tất cả field đều optional (partial update)#
| Field | Mô tả |
|---|---|
cookie | Cookie mới (chuỗi raw name=value; ...) |
email / password / pass_mail / twofa / app_password | Credentials thay đổi |
link_profile | URL profile mới (vd sau khi rename) |
status | Một trong: pending / queued / running / completed / failed / cancel / final_failed / register / registering / registered / register_failed / profile / profiling / profiled / profile_failed / connect / connecting / connect_failed / active / inactive / banned / dead. Không gửi = giữ nguyên |
note | Ghi chú free-text |
error_message | Lý do account fail. Truyền chuỗi rỗng "" để clear (phải gửi explicit field, missing = giữ nguyên) |
Yêu cầu ít nhất 1 field. Field không gửi → không động đến giá trị cũ.
usernameKHÔNG override — đồng bộ vớisocial_register.username.
Response#
{
"success": true,
"updated": ["cookie", "status", "note"]
}updated liệt kê các field thực sự đã ghi xuống DB.
Khi nào dùng#
| Tình huống | Hành động đề xuất |
|---|---|
| Cookie hết hạn → relogin | cookie + status: "active" |
| Site bắt đổi password | password + pass_mail (nếu email cũng đổi) |
| Account bị site khoá / die | status: "dead" + error_message: "..." |
| Account bị ban vĩnh viễn | status: "banned" + error_message: "..." |
| Loại khỏi pool | status: "failed" + note: "..." |
Lỗi thường gặp#
| HTTP | Body | Nguyên nhân |
|---|---|---|
| 400 | {"success":false,"message":"không có field nào để update"} | Body rỗng |
| 400 | {"success":false,"message":"status không hợp lệ"} | Status enum sai |
| 400 | {"success":false,"message":"<field> không được dùng giá trị mẫu (placeholder)"} | Gửi nguyên giá trị mẫu trong docs Test |
| 404 | {"success":false,"message":"account không tồn tại hoặc đã xoá"} | account_id sai / soft-deleted |
Lưu ý: endpoint này không báo task hoàn thành/thất bại. Sau khi PUT xong, worker vẫn phải gọi
/completehoặc/failđể đóng task hiện tại.