投稿投稿を公開する

投稿

投稿を公開する

ライブアプリは即時公開・予約・下書き保存、テストアプリはシミュレーションのみ。?dry_run=true ならすべて検証し、何も書き込みません。

POSThttps://api.sofia-post.com/api/v1/posts
POST/v1/posts

このリクエストは、実際のアカウントに対して実行されます。

curl -X POST 'https://api.sofia-post.com/api/v1/posts' \
  -H "Authorization: Bearer $SOFIA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"establishmentId":"cmvy2k3m40001ms4rest00000","targets":[{"platform":"instagram","text":"Tarte tatin du jour","format":"post","accountId":"cmvy2k3m40001ms4rig000000"}],"scheduledAt":"2026-11-02T10:00:00.000Z"}'

認可

  • Authorizationstring必須

    個人キーまたは OAuth アクセストークン。Bearer <token> として送信します。

クエリパラメーター

  • dry_runstring

    true:送信時と同じ検証(ネットワークの規則、アカウント、メディア、作成、ライブの購読)をすべて行い、何も書き込みません。200 ready または 422 post_refused を返します。

    使用できる値: truefalse

ヘッダー

  • Idempotency-Keystring

    同じボディで再送すると、2 件目の投稿を作らず同じレスポンスを返します。ドライランではキーは消費されません。

ボディ

application/json

  • establishmentIdstring必須

    トークンのグラントに含まれる Workspace 内の店舗(GET /v1/establishments)

  • targetsobject[]必須

    ターゲットごとに 1 つのネットワーク

    子属性を表示
    • platformstring必須

      対象のネットワーク

      使用できる値: instagramfacebookxlinkedintiktok

    • textstring必須

      このネットワークで公開するキャプション

    • mediaobject[]

      添付するメディア

      子属性を表示
      • idstring

        店舗のライブラリにあるメディアの ID(なければ url と type)

      • urlstring

        メディアの公開 URL(ライブでは https)。ID がない場合

      • typestring

        URL で指定したメディアの種類

        使用できる値: imagevideo

    • formatstring

      フォーマット(post、reel、story、carousel など)。省略時はネットワークが提供するもの

    • accountIdstring

      ライブ:店舗がこのネットワークに複数のアカウントを持つ場合に、公開する連携アカウント(GET /v1/establishments/:id/accounts)

  • scheduledAtstring<date-time>

    予約日時(ISO 8601)。未来の日時。省略すると即時公開。status が draft の場合は指定できません

  • statusstring

    draft:下書き(ライブのみ)。日時なしで作成され、何も送信されません。PATCH /v1/posts/:id で予約します

    使用できる値: draft

レスポンス

200application/json

ドライラン:すべての検証に成功しました。

  • statusstring必須

    常に ready

    使用できる値: ready

  • dryRunboolean必須

    常に true

    使用できる値: true

  • targetsobject[]必須

    検証されたターゲット

    子属性を表示
    • platformstring必須

      ターゲットのネットワーク

    • statestring必須

      常に ready

      使用できる値: ready

    • accountIdstring

      ライブ:公開されるアカウント

    • handlestring

      ライブ:その表示用ハンドル

201application/json

ライブ:publishing または scheduled。テスト:simulated。

  • idstring必須

    投稿の ID。GET /v1/posts/:id で読み戻せます

  • statusstring必須

    作成時の投稿の状態

    使用できる値: draftpublishingscheduled

  • establishmentIdstring必須

    投稿の店舗

  • targetsobject[]必須

    投稿のターゲット

    子属性を表示
    • platformstring必須

      ターゲットのネットワーク

    • accountIdstring必須

      公開するアカウント

    • statestring必須

      作成時のターゲットの状態

      使用できる値: draftpublishingscheduledfailed

  • scheduledAtstring<date-time>

    投稿の公開予定日時

400

ボディの形式が正しくありません。

401

トークンがない、不明、期限切れ、または失効しています。

402

subscription_required(ライブ。ドライランも含む)。

403

トークンに posts:write スコープがありません。

404

establishment_not_found:トークンの Workspace の外です。

422application/json

post_refused:ネットワーク、店舗、または作成が拒否する場合。media_import_refused(ライブ)は理由付き。idempotency_key_reused。

4XXapplication/json

その他のエラー。エラーエンベロープで返されます。