Getting started

Quickstart

Five minutes: issue a credential, make a first request, save a draft, then schedule it.

Four steps

  1. 01Issue a long-lived credential

    Sign in to popkit → Settings → Integrations → Long-lived credentials → Issue: name it, tick scopes (at least workspace:read, accounts:read, posts:read, posts:write) and the Schedule tier if you want to schedule. The key starts with popkit_it_ and is shown once — copy it. Only workspace admins can issue credentials.

  2. 02First request: who am I

    Call GET /api/v1/workspace to confirm the credential, workspace, scopes and quotas.

    curl "https://popkit.loxily.com/api/v1/workspace" \
      -H "Authorization: Bearer popkit_it_••••••••"
  3. 03Save a draft

    Call POST /api/v1/posts with action: "draft". Prechecks only warn for drafts, so you can save first and fix later; keep the returned postId.

    curl -X POST "https://popkit.loxily.com/api/v1/posts" \
      -H "Authorization: Bearer popkit_it_••••••••" \
      -H "Content-Type: application/json" \
      -d '{
      "action": "draft",
      "content": "新功能上线:一次创作,发布到所有平台 🚀",
      "platforms": [
        "x",
        "instagram"
      ]
    }'
  4. 04Schedule it and check

    Use PATCH /api/v1/posts/{postId} to switch it to action: "schedule" with a scheduledAt (timezone required); send an Idempotency-Key so retries never double up. After the time passes, read per-account results via GET /api/v1/posts/{postId}.

    curl -X PATCH "https://popkit.loxily.com/api/v1/posts/pst_01J8ZK3R7QW6M2" \
      -H "Authorization: Bearer popkit_it_••••••••" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: acme-2026-09-21-001" \
      -d '{
      "action": "schedule",
      "content": "新功能上线:一次创作,发布到所有平台 🚀",
      "platforms": [
        "x",
        "instagram"
      ],
      "scheduledAt": "2026-09-21T18:00:00+08:00"
    }'

Next

  • Run the publish precheck first: same rules as a real publish; only ok=true is worth sending.
  • For images / videos, get a mediaUrl from attach media first and put it into media[].dataUrl.
  • action: "publish" sends immediately: Idempotency-Key required and the credential must have the Publish tier; see Authentication.
  • Handle errors by error.code (Errors); pagination, rate limits and idempotency are in Conventions.