Skip to content

API Reference

The Social Publisher provides a RESTful API built with FastAPI.

Base URL: http://localhost:8989

Tasks

Publish Video

Submit a new publishing task.

  • Endpoint: POST /api/v1/publish
  • Body:
    json
    {
      "video_url": "https://example.com/video.mp4",
      "title": "Video Title",
      "description": "Video Description #tag",
      "tags": ["tag1", "tag2"],
      "cover_path": "https://example.com/cover.png",
      "claim_type": "内容由AI生成", // Optional: "内容由AI生成", "取材网络", "自行拍摄"
      "schedule_time": "2024-03-20 18:00", // Optional: YYYY-MM-DD HH:mm
      "account_name": "default_user",
      "manual_review": false
    }
  • Response:
    json
    {
      "id": "task_uuid",
      "status": "pending"
    }

Get Task Status

Check the status of a specific task.

  • Endpoint: GET /api/v1/tasks/{task_id}
  • Response:
    json
    {
      "id": "task_uuid",
      "status": "success", // pending, running, success, failed
      "result": { ... },
      "error_msg": null
    }

Accounts

List Accounts

Get a list of all registered accounts.

  • Endpoint: GET /api/v1/accounts
  • Response:
    json
    {
      "data": [
        {
          "id": "account_name",
          "name": "Nickname",
          "platform": "douyin",
          "preferences": { ... }
        }
      ]
    }

Login Account

Initiate a login session for a new or existing account. Returns a QR code for scanning.

  • Endpoint: POST /api/v1/accounts/login
  • Body:
    json
    {
      "account_name": "new_user_id"
    }
  • Response:
    json
    {
      "login_id": "session_id",
      "qr_code_base64": "base64_encoded_image_string"
    }

Check Login Status

Check if the QR code has been scanned and login is successful.

  • Endpoint: GET /api/v1/accounts/login/{login_id}
  • Response:
    json
    {
      "status": "success", // pending, success, failed, expired
      "msg": "Login successful"
    }

Delete Account

Remove an account and its session data.

  • Endpoint: DELETE /api/v1/accounts/{account_name}
  • Response: 200 OK