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#

FieldMô tả
email / username / password / cookieCredentials account đã register sẵn
account_idID account đã register sẵn
pass_mailMật khẩu Gmail
twofaBase32 secret TOTP
app_passwordApp password Gmail
titleTiêu đề bài (đã xử lý spin)
aboutNộ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"}'
FieldBắt buộcMô tả
link_postURL 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#

FieldMô tả
idUUID account
post_idUUID social_post.id đang pending/running cùng group (mới nhất). "" nếu không có post đang chạy
register_idUUID social_register.id đã tạo account
group_idUUID group
site_id / site_nameSite (vd sutori.com, tumblr.com)
statusStatus REGISTER: pending/running/completed/active/failed/banned/dead
posting_statusStatus 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_idUUID social_post_link.id mới nhất gắn account này. "" nếu chưa có
post_linkURL link_post đã đăng (chỉ có khi posting_status="done")
email / username / passwordCredentials login
pass_mailMật khẩu Gmail
twofaBase32 TOTP secret
app_passwordApp password Gmail
link_profileURL profile social (vd FB profile, IG bio link)
created_at / updated_at / last_used_atTimestamps ISO 8601
cookieSession cookie (luôn cuối)

Lỗi thường gặp#

HTTPBodyNguyê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)#

FieldMô tả
cookieCookie mới (chuỗi raw name=value; ...)
email / password / pass_mail / twofa / app_passwordCredentials thay đổi
link_profileURL profile mới (vd sau khi rename)
statusMộ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
noteGhi chú free-text
error_messageLý 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ũ. username KHÔNG override — đồng bộ với social_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ốngHành động đề xuất
Cookie hết hạn → relogincookie + status: "active"
Site bắt đổi passwordpassword + pass_mail (nếu email cũng đổi)
Account bị site khoá / diestatus: "dead" + error_message: "..."
Account bị ban vĩnh viễnstatus: "banned" + error_message: "..."
Loại khỏi poolstatus: "failed" + note: "..."

Lỗi thường gặp#

HTTPBodyNguyê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 /complete hoặc /fail để đóng task hiện tại.