> ## Documentation Index
> Fetch the complete documentation index at: https://dify-6c0370d8-fix-template-upload-size-guidance.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# アノテーションを作成

> **対象アプリ**：Chatflow、チャットボット、レガシー Agent。

アノテーションを作成します。アノテーションは、一致したときにアプリが新しい応答を生成する代わりに直接返す、事前定義された質問と回答のペアです。



## OpenAPI

````yaml /ja/api-reference/openapi_service.json post /apps/annotations
openapi: 3.0.1
info:
  description: >-
    Dify アプリケーションとナレッジベースのための REST API です。アプリケーション系エンドポイントはアプリの API
    キーで、ナレッジ系エンドポイントはナレッジベースの API キーで認証します。
  title: Dify サービス API
  version: 1.0.0
servers:
  - description: Dify サービス API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。
    url: https://{api_base_url}
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - description: チャットメッセージとインタラクションに関連する操作です。
    name: チャットメッセージ
  - description: ファイルのアップロードとプレビューの操作です。
    name: ファイル操作
  - description: エンドユーザー情報に関連する操作です。
    name: エンドユーザー
  - description: ユーザーフィードバックの操作です。
    name: メッセージフィードバック
  - description: 会話管理に関連する操作です。
    name: 会話管理
  - description: テキスト読み上げと音声認識の操作です。
    name: 音声・テキスト変換
  - description: アプリケーション設定と情報を取得する操作です。
    name: アプリケーション設定
  - description: ダイレクト返信用のアノテーション管理に関連する操作です。
    name: アノテーション管理
  - description: 人間の入力を要する一時停止中のワークフローの再開操作です。
    name: 人間の入力
  - description: ワークフローの実行と管理のための操作です。
    name: ワークフロー実行
  - description: テキスト生成に関連する操作です。
    name: 完了メッセージ
  - description: ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。
    name: ナレッジベース
  - description: ナレッジベース内のドキュメントの作成、更新、管理のための操作です。
    name: ドキュメント
  - description: ドキュメントチャンクと子チャンクの管理のための操作です。
    name: チャンク
  - description: ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。
    name: メタデータ
  - description: ナレッジベースタグとタグバインディングの管理のための操作です。
    name: タグ管理
  - description: 利用可能なモデルを取得するための操作です。
    name: モデル
  - description: データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。
    name: ナレッジパイプライン
paths:
  /apps/annotations:
    post:
      tags:
        - アノテーション管理
      summary: アノテーションを作成
      description: |-
        **対象アプリ**：Chatflow、チャットボット、レガシー Agent。

        アノテーションを作成します。アノテーションは、一致したときにアプリが新しい応答を生成する代わりに直接返す、事前定義された質問と回答のペアです。
      operationId: createChatAnnotationJa
      requestBody:
        content:
          application/json:
            examples:
              createAnnotation:
                summary: リクエスト例
                value:
                  answer: Dify is an open-source LLM application development platform.
                  question: What is Dify?
            schema:
              $ref: '#/components/schemas/CreateAnnotationRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              examples:
                createdAnnotation:
                  summary: レスポンス例
                  value:
                    answer: >-
                      Dify is an open-source LLM application development
                      platform.
                    created_at: 1705407629
                    hit_count: 0
                    id: a1b2c3d4-5678-90ab-cdef-1234567890ab
                    question: What is Dify?
              schema:
                $ref: '#/components/schemas/AnnotationItem'
          description: アノテーションが正常に作成されました。
components:
  schemas:
    CreateAnnotationRequest:
      description: 新しいアノテーションを作成するためのリクエストボディです。
      properties:
        answer:
          description: このアノテーションが一致したときに返される回答です。
          type: string
        question:
          description: アプリが受信したユーザー入力を照合する質問テキストです。
          type: string
      required:
        - question
        - answer
      type: object
    AnnotationItem:
      properties:
        answer:
          description: アノテーションがマッチした際に返される定義済みの回答です。
          nullable: true
          type: string
        created_at:
          description: 作成タイムスタンプ（Unix エポック秒）。
          format: int64
          nullable: true
          type: integer
        hit_count:
          description: このアノテーションがマッチして返信として返された回数です。
          nullable: true
          type: integer
        id:
          description: アノテーションの一意識別子です。
          format: uuid
          type: string
        question:
          description: このアノテーションをトリガーする質問テキストです。
          nullable: true
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      bearerFormat: API_KEY
      description: >-
        すべてのリクエストは API キーで認証します：`Authorization: Bearer
        {API_KEY}`。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API
        キーを使用します（[Dify API クイックスタート](/ja/api-reference/guides/get-started)）。


        キーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーが欠落または無効なリクエストは HTTP
        `401`（`unauthorized`）で失敗します。
      scheme: bearer
      type: http

````