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

# 会話変数の取得

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

特定の会話から変数を取得します。



## OpenAPI

````yaml /ja/api-reference/openapi_service.json get /conversations/{conversation_id}/variables
openapi: 3.0.1
info:
  title: Dify サービス API
  description: >-
    Dify アプリケーションとナレッジベースのための REST API です。アプリケーション系エンドポイントはアプリの API
    キーで、ナレッジ系エンドポイントはナレッジベースの API キーで認証します。
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: Dify サービス API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - 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: ナレッジパイプライン
    description: データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。
paths:
  /conversations/{conversation_id}/variables:
    get:
      tags:
        - 会話管理
      summary: 会話変数の取得
      description: |-
        **対象アプリ**：Chatflow、チャットボット、Agent。

        特定の会話から変数を取得します。
      operationId: getBasicChatConversationVariablesJa
      parameters:
        - name: conversation_id
          in: path
          required: true
          description: 会話 ID。
          schema:
            type: string
        - name: user
          in: query
          required: false
          description: ユーザー識別子です。
          schema:
            type: string
        - name: last_id
          in: query
          required: false
          description: 現在のページの最後のレコードの ID（ページネーション用）です。
          schema:
            type: string
        - name: limit
          in: query
          required: false
          description: 返すレコード数です。
          schema:
            type: integer
            default: 20
            minimum: 1
            maximum: 100
        - name: variable_name
          in: query
          required: false
          description: 指定した名前で変数をフィルタリングします。
          schema:
            type: string
            minLength: 1
            maxLength: 255
      responses:
        '200':
          description: 会話変数の取得に成功しました。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationVariablesResponse'
              examples:
                conversationVariables:
                  summary: レスポンス例
                  value:
                    limit: 20
                    has_more: false
                    data:
                      - id: a1b2c3d4-5678-90ab-cdef-1234567890ab
                        name: user_preference
                        value_type: string
                        value: dark_mode
                        description: ユーザー設定
                        created_at: 1705407629
                        updated_at: 1705411229
        '400':
          description: '`not_chat_app` : アプリモードが API ルートと一致しません。'
          content:
            application/json:
              examples:
                not_chat_app:
                  summary: not_chat_app
                  value:
                    status: 400
                    code: not_chat_app
                    message: Please check if your app mode matches the right API route.
        '404':
          description: '`not_found` : 会話が存在しません。'
          content:
            application/json:
              examples:
                conversation_not_exists:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Conversation Not Exists.
components:
  schemas:
    ConversationVariablesResponse:
      type: object
      properties:
        limit:
          type: integer
          description: 1 ページあたりの件数です。
        has_more:
          type: boolean
          description: 次のページがあるかどうかです。
        data:
          type: array
          description: 会話変数のリストです。
          items:
            $ref: '#/components/schemas/ConversationVariableItem'
    ConversationVariableItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Variable ID.
        name:
          type: string
          description: 変数名です。
        value_type:
          type: string
          description: >-
            変数の値の型です。指定可能な値：`string`、`number`、`object`、`secret`、`file`、`boolean`、`array[any]`、`array[string]`、`array[number]`、`array[object]`、`array[file]`、`array[boolean]`。
        value:
          type: string
          description: 変数値（複雑な型の場合は JSON 文字列）。
        description:
          type: string
          description: 変数の説明です。
        created_at:
          type: integer
          format: int64
          description: 作成タイムスタンプ。
        updated_at:
          type: integer
          format: int64
          description: 最終更新タイムスタンプ。
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        API Key 認証です。すべての API リクエストにおいて、`Authorization` HTTP ヘッダーに `Bearer `
        プレフィックスを付けた API Key を含めてください。例：`Authorization: Bearer {API_KEY}`。**API
        Key はサーバーサイドに保存し、クライアントサイドで共有・保存しないことを強く推奨します。API Key
        の漏洩は深刻な結果につながる可能性があります。**API Key が欠落または無効な場合、HTTP `401` とエラーコード
        `unauthorized` が返されます。

````