ループ

Nostaに任せた決まった仕事と、その結果(確認待ち)を読み、採用・却下する

GET/v1/loop-runs

ループの結果(確認待ち)を一覧する

ループが作った結果を新しい順に返します。state=pending(既定)は人の確認待ちです。中身(output)を読み、正しければadoptLoopRun、違えば理由を添えてrejectLoopRunを使います。参照できるプロジェクトの分だけ返します。

クエリ

  • stateenum
    pendingall
  • loopIdstring

    100文字まで

  • cursorstring

    100文字まで

  • limitinteger

    1〜100

返る項目data の中身 · 200

  • idstring
  • loopIdstring
  • loopNamestring
  • projectIdstring | null
  • projectTitlestring | null
  • periodKeystring

    その回の週の月曜(YYYY-MM-DD)

  • instructionsVersioninteger
  • outputstring | null

    採用した中身(確認待ちのうちはNostaの下書き)

  • draftOutputstring | null

    Nostaの元の下書き(直して採用しても残る)

  • reviewStateenum

    pending=確認待ち、adopted=そのまま採用、adopted_edited=直して採用、not_needed=材料がなかった・失敗した

    pendingadoptedadopted_editedrejectednot_needed
  • autoAdoptedboolean
  • rejectReasonstring | null
  • reviewedAtstring (date-time) | null
  • createdAtstring (date-time)

起こりうるエラー共通のエラー

  • 400invalid_request

    送った値が正しくない。message にどこが違うかが入ります

  • 403insufficient_scope

    キーにこの入口の権限(scope)が付いていない。requiredScopes に必要な権限が入ります

GET/v1/loop-runs
curl https://tooon.app/api/v1/loop-runs \
  -H "Authorization: Bearer $TOOON_API_KEY"
レスポンス
{
  "data": [
    {
      "id": "clx8k2m0a0001",
      "loopId": "clx8k2m0a0001",
      "loopName": "…",
      "projectId": "clx8k2m0a0001",
      "projectTitle": "…",
      "periodKey": "…",
      "instructionsVersion": 0,
      "output": "…",
      "draftOutput": "…",
      "reviewState": "pending",
      "autoAdopted": true,
      "rejectReason": "…",
      "reviewedAt": "2026-11-01T09:00:00.000Z",
      "createdAt": "2026-11-01T09:00:00.000Z"
    }
  ],
  "nextCursor": null
}
GET/v1/loops

ループ(Nostaに任せた決まった仕事)を一覧する

ワークスペースのループを、そのまま採用・直して採用・却下・確認待ちの数つきで返します。そのまま採用が少ないループは指示(instructions)を見直す材料です。

返る項目data の中身 · 200

  • idstring
  • namestring
  • kindenum

    week_review=週報の下書き、context_review=文脈の見直し(採用すると確認事項に足す)

    week_reviewcontext_review
  • projectIdstring | null

    対象のプロジェクト。空なら作った人が見られる進行中のプロジェクトすべて

  • weekdayinteger

    動く曜日(0=日〜6=土、ワークスペースの暦)

  • hourinteger

    動く時刻(0〜23時)

  • instructionsstring | null

    人が書き足したNostaへの指示

  • instructionsVersioninteger

    指示の版。直すたびに上がる

  • statusenum
    activepaused
  • autoAdoptboolean

    trueなら結果を自動で採用する(採用率が高いループだけ人が切り替えられる)

  • adoptedCountinteger

    そのまま採用した数

  • editedCountinteger

    直して採用した数

  • rejectedCountinteger
  • pendingCountinteger

    確認待ちの数

起こりうるエラー共通のエラー

  • 403insufficient_scope

    キーにこの入口の権限(scope)が付いていない。requiredScopes に必要な権限が入ります

GET/v1/loops
curl https://tooon.app/api/v1/loops \
  -H "Authorization: Bearer $TOOON_API_KEY"
レスポンス
{
  "data": [
    {
      "id": "clx8k2m0a0001",
      "name": "山田 太郎",
      "kind": "week_review",
      "projectId": "clx8k2m0a0001",
      "weekday": 0,
      "hour": 0,
      "instructions": "…",
      "instructionsVersion": 0,
      "status": "active",
      "autoAdopt": true,
      "adoptedCount": 0,
      "editedCount": 0,
      "rejectedCount": 0,
      "pendingCount": 0
    }
  ]
}
POST/v1/loop-runs/{id}/adopt

ループの結果を採用する

確認待ちの結果を採用します。週報の下書きは、その週のプロジェクトの週報として残ります(人が書いた週報があれば置き換えます)。文脈の見直しは、案がプロジェクトの確認事項に足されます(outputは使いません)。outputを渡して中身が変わると「直して採用」になり、Nostaの元の下書きは残ります。キーを発行した人の代わりに、つないだAIが採用したとして記録します。送信はしません。

パスの値

  • idstring必須

    100文字まで

送る項目JSON · 2項目

  • outputstring

    2,000文字まで

  • reasonstring | null必須

    採用した・直した理由(変更の記録に残る)

    300文字まで

返る項目data の中身 · 200

  • idstring
  • loopIdstring
  • loopNamestring
  • projectIdstring | null
  • projectTitlestring | null
  • periodKeystring

    その回の週の月曜(YYYY-MM-DD)

  • instructionsVersioninteger
  • outputstring | null

    採用した中身(確認待ちのうちはNostaの下書き)

  • draftOutputstring | null

    Nostaの元の下書き(直して採用しても残る)

  • reviewStateenum

    pending=確認待ち、adopted=そのまま採用、adopted_edited=直して採用、not_needed=材料がなかった・失敗した

    pendingadoptedadopted_editedrejectednot_needed
  • autoAdoptedboolean
  • rejectReasonstring | null
  • reviewedAtstring (date-time) | null
  • createdAtstring (date-time)

起こりうるエラー共通のエラー

  • 400invalid_request

    送った値が正しくない。message にどこが違うかが入ります

  • 403insufficient_scope

    キーにこの入口の権限(scope)が付いていない。requiredScopes に必要な権限が入ります

  • 404not_found

    対象がない、またはこのワークスペースのものではない

POST/v1/…/{id}/adopt
curl -X POST https://tooon.app/api/v1/loop-runs/clx8k2m0a0001/adopt \
  -H "Authorization: Bearer $TOOON_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "…"
}'
レスポンス
{
  "data": {
    "id": "clx8k2m0a0001",
    "loopId": "clx8k2m0a0001",
    "loopName": "…",
    "projectId": "clx8k2m0a0001",
    "projectTitle": "…",
    "periodKey": "…",
    "instructionsVersion": 0,
    "output": "…",
    "draftOutput": "…",
    "reviewState": "pending",
    "autoAdopted": true,
    "rejectReason": "…",
    "reviewedAt": "2026-11-01T09:00:00.000Z",
    "createdAt": "2026-11-01T09:00:00.000Z"
  }
}
POST/v1/loop-runs/{id}/reject

ループの結果を却下する

確認待ちの結果を却下します。reasonに理由を書くと、ループの指示を良くする材料として残ります。

パスの値

  • idstring必須

    100文字まで

送る項目JSON · 1項目

  • reasonstring | null必須

    300文字まで

返る項目data の中身 · 200

  • idstring
  • loopIdstring
  • loopNamestring
  • projectIdstring | null
  • projectTitlestring | null
  • periodKeystring

    その回の週の月曜(YYYY-MM-DD)

  • instructionsVersioninteger
  • outputstring | null

    採用した中身(確認待ちのうちはNostaの下書き)

  • draftOutputstring | null

    Nostaの元の下書き(直して採用しても残る)

  • reviewStateenum

    pending=確認待ち、adopted=そのまま採用、adopted_edited=直して採用、not_needed=材料がなかった・失敗した

    pendingadoptedadopted_editedrejectednot_needed
  • autoAdoptedboolean
  • rejectReasonstring | null
  • reviewedAtstring (date-time) | null
  • createdAtstring (date-time)

起こりうるエラー共通のエラー

  • 400invalid_request

    送った値が正しくない。message にどこが違うかが入ります

  • 403insufficient_scope

    キーにこの入口の権限(scope)が付いていない。requiredScopes に必要な権限が入ります

  • 404not_found

    対象がない、またはこのワークスペースのものではない

POST/v1/…/{id}/reject
curl -X POST https://tooon.app/api/v1/loop-runs/clx8k2m0a0001/reject \
  -H "Authorization: Bearer $TOOON_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "reason": "…"
}'
レスポンス
{
  "data": {
    "id": "clx8k2m0a0001",
    "loopId": "clx8k2m0a0001",
    "loopName": "…",
    "projectId": "clx8k2m0a0001",
    "projectTitle": "…",
    "periodKey": "…",
    "instructionsVersion": 0,
    "output": "…",
    "draftOutput": "…",
    "reviewState": "pending",
    "autoAdopted": true,
    "rejectReason": "…",
    "reviewedAt": "2026-11-01T09:00:00.000Z",
    "createdAt": "2026-11-01T09:00:00.000Z"
  }
}