ドキュメント

テンプレート

テンプレートの取得

GET/templates/{id}

一つのテンプレート:保存済みバージョンの Markdown(プレースホルダーが空の箇所には {{ラベル}} トークン)と、フォームや項目マッピングの元になるプレースホルダーの一覧。各エントリには送るキーと表示するラベルがあります。

パラメータ

名前型説明
id必須uuidテンプレートの ID。

リクエスト

curl https://usepaperclerk.com/api/v1/templates/4d1f0c2e-7b3a-4c1e-9d2f-1a2b3c4d5e6f \
  -H "Authorization: Bearer pc_YOUR_TOKEN"

レスポンス

JSON
{
  "id": "4d1f0c2e-7b3a-4c1e-9d2f-1a2b3c4d5e6f",
  "title": "Consulting invoice",
  "markdown": "# Consulting invoice\n\nInvoice {{Invoice number}} for {{Client name}} …",
  "html": "<div class=\"doc-page\" …>…</div>",
  "html_truncated": false,
  "placeholders": [
    {
      "label": "Client name",
      "key": "client_name",
      "count": 2,
      "value": "",
      "type": "text",
      "description": "The client's legal name, not the contact person."
    },
    {
      "label": "Payment terms",
      "key": "payment_terms",
      "count": 1,
      "value": "Net 30",
      "type": "select",
      "options": [
        "Net 15",
        "Net 30",
        "Due on receipt"
      ]
    },
    {
      "label": "Due date",
      "key": "due_date",
      "count": 1,
      "value": "",
      "type": "date",
      "format": "08/27/2026"
    },
    {
      "label": "Invoice number",
      "key": "invoice_number",
      "count": 1,
      "value": "",
      "type": "counter",
      "auto": true,
      "format": "INV-0001",
      "start": 1
    },
    {
      "label": "Issue date",
      "key": "issue_date",
      "count": 1,
      "value": "",
      "type": "today",
      "auto": true,
      "format": "August 27, 2026"
    }
  ],
  "groups": [
    {
      "label": "Line items",
      "key": "line_items",
      "fields": [
        {
          "label": "Item",
          "key": "item",
          "type": "text"
        },
        {
          "label": "Quantity",
          "key": "quantity",
          "type": "number",
          "format": "1,234"
        },
        {
          "label": "Amount",
          "key": "amount",
          "type": "number",
          "format": "1,234.56"
        }
      ]
    }
  ],
  "generation_count": 12,
  "updated_at": "2026-09-10T09:14:03.201Z"
}
  • markdown — 保存済みバージョン。空のプレースホルダーは {{ラベル}} として現れます。
  • html — 保存済みバージョンの紙面どおりの HTML プレビュー。html_truncated はサイズのために切り詰められたかどうかを示します。
  • placeholders — トップレベルのプレースホルダー、プレースホルダーごとに一エントリ:key(values の索引に使うもの)、label(人が読む名前)、count(埋める箇所の数)、value(既定値)、type(text、select、number、date、today、counter のいずれか)、設定されている場合は options、format、description、auto、start。
  • groups — 繰り返しグループ:key、label、fields。fields はインスタンスオブジェクトが持てるキーを正確に列挙し、それぞれプレースホルダーと同じ形に既定値が加わります。
  • generation_count — このテンプレートから生成されたドキュメントの数。