---
title: "下書きの一覧"
method: GET
path: "/knowledge/drafts"
tags: ["Drafts"]
---

# 下書きの一覧

`GET /knowledge/drafts`

## Request

- Base URL: `https://api.leafchat.app/api/v1`
- URL: `https://api.leafchat.app/api/v1/knowledge/drafts`
- Auth: HTTP bearer

作成の新しい順。state の既定は open（未処理）。next_cursor が null でなければ、cursor に入れて次のページを取る

## Query parameters

- `state` 'open' | 'published' | 'discarded'
- `target_document_id` string
- `cursor` string: 前の応答の next_cursor
- `limit` integer

## Response `200`

下書きの 1 ページ

- object
  - `drafts` Draft[], required
    - `id` string, required
    - `operation` 'create' | 'update' | 'delete', required
    - `state` 'open' | 'published' | 'discarded', required
    - `summary` string, required
    - `rationale` string, required
    - `evidence` object, required
      - `conversation_ids` string[], required
      - `unanswered_question_ids` string[], required
    - `document_id` string, nullable, required: 更新・削除の対象の文書。作成では null
    - `base_revision_id` string, nullable, required: 下書きを作ったときの、対象の文書の head の版
    - `stale` boolean, required: 下書きを作った後に、対象の文書が変わったか消えた。公開する人が置き換えを選ばないと公開できない
    - `target` object, nullable, required: 対象の文書の今の状態。作成では null
      - `exists` boolean, required
      - `filename` string, nullable, required
      - `head_revision_id` string, nullable, required
    - `source_id` string, nullable, required
    - `folder_id` string, nullable, required
    - `external_id` string, nullable, required
    - `filename` string, nullable, required: 提案のファイル名。削除では null
    - `mime` string, nullable, required
    - `size` integer, nullable, required
    - `content_sha256` string, nullable, required
    - `author` object, required
      - `type` 'operator' | 'api_key', required
      - `id` string, nullable, required
      - `via` 'mcp' | 'api', required
    - `published_document_id` string, nullable, required
    - `published_revision_id` string, nullable, required
    - `created_at` string, date-time, required
    - `decided_at` string, date-time, nullable, required
  - `next_cursor` string, nullable, required

## Other responses

- `400`: 要求の形式か値が正しくない。errors（検証の誤り）に項目（path）ごとの理由が入る 返る code：`invalid_request`・`empty_manifest`・`duplicate_item`
- `401`: API キーが無いか無効（期限切れ・失効・削除の途中の組織を含み、理由は区別しない） 返る code：`unauthorized`
- `403`: この API キーの用途か、対象のソースでは実行できない 返る code：`forbidden`・`needs_draft`
- `429`: 上限を超えた。Retry-After の秒数だけ待ってからやり直す。上限は、API キーごとに 1 分 120 回（REST と MCP で共通）・同期の実行は鍵ごとに 1 分 10 回（dry_run は数えない）・組織の文書の書き込みは 1 分 300 版・API キーの検証の失敗は IP ごとに 1 分 20 回（超えると、正しい鍵でも 429 になる）。このほか、IP ごとの上限を超えると Cloudflare が 429（error code 1015）を返す。この応答は problem+json でないことがあり、Retry-After が無ければ少し待ってからやり直す 返る code：`rate_limited`
- `500`: サーバーで問題が起きた。少し待ってからやり直す 返る code：`internal_error`

---

[API](https://skmtc.dev/leafchat/apis/leafchat-api.md) · [All operations](https://skmtc.dev/leafchat/apis/leafchat-api/llms.txt) · [OpenAPI document](https://skmtc.dev/leafchat/apis/leafchat-api/revisions/2667db05c2ff?raw)
