> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getqr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# テンプレート

> 再利用できる QR コードのデザインを保存し、新しい QR コードに適用します。

> [!NOTE]
>
> GetQR API はベータ版で、一部のワークスペースでのみご利用いただけます。正式リリースまでに内容が変更される場合があります。

テンプレートには、再利用できるデザイン（`styles`、`frameOptions`、`logoOptions`）が保存されます。コンテンツやリンクは含まれません。テンプレートはワークスペースの全員で共有されます。

| メソッド | パス | 説明 |
| - | - | - |
| `GET` | `/api/v1/templates` | [テンプレートを一覧表示する](#テンプレートを一覧表示する) |
| `POST` | `/api/v1/templates` | [テンプレートを作成する](#テンプレートを作成する) |
| `GET` | `/api/v1/templates/{templateId}` | [テンプレートを取得する](#テンプレートを取得する) |
| `PATCH` | `/api/v1/templates/{templateId}` | [テンプレートを更新する](#テンプレートを更新する) |
| `DELETE` | `/api/v1/templates/{templateId}` | [テンプレートを削除する](#テンプレートを削除する) |
| `POST` | `/api/v1/templates/{templateId}/duplicate` | [テンプレートを複製する](#テンプレートを複製する) |

## テンプレートを適用する

[QR コードを作成する](https://docs.getqr.com/ja/api/endpoints/qr-codes.md) ときに `templateId` を渡します。テンプレートのデザインが新しい QR コードに適用されます。同じリクエストで 3 つのデザインオブジェクトのいずれかを送ると、テンプレートの上にマージされます。

* **リンクではなくコピー。** QR コードはデザインのコピーを独自に持ちます。後でテンプレートを編集または削除しても、QR コードは変わりません。
* **カスタムデザインのみ。** `designKind` が `branded` または `ai` のテンプレートは API では適用できず、`422`（`art_template_unsupported`）を返します。
* **自分のワークスペースのみ。** 不明なテンプレートや別のワークスペースのテンプレートは `404` を返します。

## ヘッダー

**Authorization** `string` *required*

`Bearer` の後に API キーを続けます。[認証](https://docs.getqr.com/ja/api/authentication.md) をご覧ください。

**Content-Type** `string`

`application/json`。ボディのあるリクエストでは必須です。

## テンプレートオブジェクト

**id** `string`

テンプレートの ID。例：`qrt_8Hs2mQvKpLd4RtYw`。

**name** `string`

テンプレートを選ぶときに表示される名前。

**designKind** `string`

読み取り専用。`custom` は API で完全に編集できるデザインです。`branded` と `ai` は、ダッシュボードで作成された Branded design または AI design です。その画像は API では編集できず、他のデザインフィールドを変更しても維持されます。

**design** `object`

保存されているデザイン。各フィールドは同名のリクエストフィールドと同じ形なので、そのまま送り返せます。

**properties**

**styles** `object | null`

ドットとコーナーの形と色。

**frameOptions** `object | null`

QR コードを囲むフレームと、その行動喚起のテキスト。

**logoOptions** `object | null`

中央のロゴ。

**createdAt** `string`

作成日時（ISO 8601）。

**updatedAt** `string`

最終更新日時（ISO 8601）。

## テンプレートを一覧表示する

`GET /api/v1/templates`

ワークスペースのテンプレートを新しい順に返します。一覧はページ分割されます。[ページネーション](https://docs.getqr.com/ja/api/introduction.md#ページネーション) をご覧ください。

**page** `integer` (default: 1)

返すページ。1 以上。

**pageSize** `integer` (default: 100)

1 ページあたりの件数。1〜100。

```bash cURL theme={null}
curl "https://getqr.com/api/v1/templates?page=1&pageSize=100" \
  -H "Authorization: Bearer $GETQR_API_KEY"
```

```json 200 theme={null}
{
  "data": [
    {
      "id": "qrt_8Hs2mQvKpLd4RtYw",
      "name": "Brand blue",
      "designKind": "custom",
      "design": {
        "styles": {
          "dotsOptions": { "type": "rounded", "color": "#1E40AF" },
          "backgroundOptions": { "color": "#FFFFFF" }
        },
        "frameOptions": null,
        "logoOptions": null
      },
      "createdAt": "2026-07-20T09:12:00.000Z",
      "updatedAt": "2026-07-20T09:12:00.000Z"
    }
  ],
  "pagination": { "page": 1, "pageSize": 100, "total": 1, "hasMore": false }
}
```

## テンプレートを作成する

`POST /api/v1/templates`

新しいデザインを保存します。`201 Created` を返します。デザインのフィールドは [カスタマイズ](https://docs.getqr.com/ja/api/guides/customization.md) のカタログと照らし合わせて検証されるため、不明な形、フレーム、ロゴは `422` で拒否されます。

**name** `string` *required*

テンプレートを選ぶときに表示される名前。1〜40 文字。

**styles** `object`

ドットとコーナーの形と色。[カスタマイズ](https://docs.getqr.com/ja/api/guides/customization.md) をご覧ください。

**frameOptions** `object`

QR コードを囲むフレームと、その行動喚起のテキスト。[カスタマイズ](https://docs.getqr.com/ja/api/guides/customization.md) をご覧ください。

**logoOptions** `object`

中央に配置するロゴ。おすすめのロゴ、または [ファイル](https://docs.getqr.com/ja/api/endpoints/files.md) の `logo` 用途でアップロードした独自のファイルです。[カスタマイズ](https://docs.getqr.com/ja/api/guides/customization.md) をご覧ください。

```bash cURL theme={null}
curl -X POST "https://getqr.com/api/v1/templates" \
  -H "Authorization: Bearer $GETQR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Brand blue",
    "styles": {
      "dotsOptions": { "type": "rounded", "color": "#1E40AF" },
      "backgroundOptions": { "color": "#FFFFFF" }
    }
  }'
```

```json 201 theme={null}
{
  "id": "qrt_8Hs2mQvKpLd4RtYw",
  "name": "Brand blue",
  "designKind": "custom",
  "design": {
    "styles": {
      "dotsOptions": { "type": "rounded", "color": "#1E40AF" },
      "backgroundOptions": { "color": "#FFFFFF" }
    },
    "frameOptions": null,
    "logoOptions": null
  },
  "createdAt": "2026-07-20T09:12:00.000Z",
  "updatedAt": "2026-07-20T09:12:00.000Z"
}
```

## テンプレートを取得する

`GET /api/v1/templates/{templateId}`

**templateId** `string` *required*

テンプレートの ID。一覧または作成のレスポンスから取得します。

```bash cURL theme={null}
curl "https://getqr.com/api/v1/templates/qrt_8Hs2mQvKpLd4RtYw" \
  -H "Authorization: Bearer $GETQR_API_KEY"
```

```json 200 theme={null}
{
  "id": "qrt_8Hs2mQvKpLd4RtYw",
  "name": "Brand blue",
  "designKind": "custom",
  "design": {
    "styles": {
      "dotsOptions": { "type": "rounded", "color": "#1E40AF" },
      "backgroundOptions": { "color": "#FFFFFF" }
    },
    "frameOptions": null,
    "logoOptions": null
  },
  "createdAt": "2026-07-20T09:12:00.000Z",
  "updatedAt": "2026-07-20T09:12:00.000Z"
}
```

## テンプレートを更新する

`PATCH /api/v1/templates/{templateId}`

変更したいフィールドだけを送ってください。デザインオブジェクトは保存済みのデザインにマージされるため、部分的な `styles` を送っても他の項目は維持されます。テンプレートからすでに作成された QR コードは、作成時のデザインを維持します。

**templateId** `string` *required*

テンプレートの ID。

**name** `string`

新しい名前。1〜40 文字。

**styles** `object`

スタイルの変更。保存済みの `styles` にマージされます。

**frameOptions** `object`

フレームの変更。保存済みのフレームにマージされます。

**logoOptions** `object`

ロゴの変更。保存済みのロゴにマージされます。

```bash cURL theme={null}
curl -X PATCH "https://getqr.com/api/v1/templates/qrt_8Hs2mQvKpLd4RtYw" \
  -H "Authorization: Bearer $GETQR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Brand blue (2026)" }'
```

```json 200 theme={null}
{
  "id": "qrt_8Hs2mQvKpLd4RtYw",
  "name": "Brand blue (2026)",
  "designKind": "custom",
  "design": {
    "styles": {
      "dotsOptions": { "type": "rounded", "color": "#1E40AF" },
      "backgroundOptions": { "color": "#FFFFFF" }
    },
    "frameOptions": null,
    "logoOptions": null
  },
  "createdAt": "2026-07-20T09:12:00.000Z",
  "updatedAt": "2026-08-14T09:00:00.000Z"
}
```

## テンプレートを削除する

`DELETE /api/v1/templates/{templateId}`

テンプレートを削除します。テンプレートから作成された QR コードは、そのデザインを維持します。

**templateId** `string` *required*

テンプレートの ID。

```bash cURL theme={null}
curl -X DELETE "https://getqr.com/api/v1/templates/qrt_8Hs2mQvKpLd4RtYw" \
  -H "Authorization: Bearer $GETQR_API_KEY"
```

```json 200 theme={null}
{ "id": "qrt_8Hs2mQvKpLd4RtYw", "deleted": true }
```

## テンプレートを複製する

`POST /api/v1/templates/{templateId}/duplicate`

`<name> copy` という名前のコピーを作成します。コピーには独自の ID があり、デザインは独立しているので自由に編集できます。リクエストボディは不要です。`201 Created` を返します。

**templateId** `string` *required*

コピーするテンプレートの ID。

```bash cURL theme={null}
curl -X POST "https://getqr.com/api/v1/templates/qrt_8Hs2mQvKpLd4RtYw/duplicate" \
  -H "Authorization: Bearer $GETQR_API_KEY"
```

```json 201 theme={null}
{
  "id": "qrt_2Kd9pLm4Xs7BnVcQ",
  "name": "Brand blue copy",
  "designKind": "custom",
  "design": {
    "styles": {
      "dotsOptions": { "type": "rounded", "color": "#1E40AF" },
      "backgroundOptions": { "color": "#FFFFFF" }
    },
    "frameOptions": null,
    "logoOptions": null
  },
  "createdAt": "2026-08-14T09:30:00.000Z",
  "updatedAt": "2026-08-14T09:30:00.000Z"
}
```

## よくある問題

> [accordion] 404 "QR template not found."
>
> その `templateId` は、ワークスペースのテンプレートに一致しません。[テンプレートを一覧表示する](#テンプレートを一覧表示する) から取得してください。

> [accordion] テンプレートの作成時または更新時に 422 になる
>
> デザインのフィールドがカタログと一致していません。たとえば、不明なドットの種類、フレーム、おすすめのロゴです。メッセージにフィールド名が示されます。[カスタマイズ](https://docs.getqr.com/ja/api/guides/customization.md) をご覧ください。

> [accordion] QR コードの作成時に 422 art\_template\_unsupported
>
> テンプレートが Branded design または AI design を使っています。代わりに、`designKind` が `custom` のテンプレートを適用してください。

## 次のステップ

> [card] [カスタマイズ](https://docs.getqr.com/ja/api/guides/customization.md)

> [card] [QR コード](https://docs.getqr.com/ja/api/endpoints/qr-codes.md)

> [card] [アプリでのテンプレート](https://docs.getqr.com/ja/templates/save-template.md)

> [card] [ファイル](https://docs.getqr.com/ja/api/endpoints/files.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.