# Genie Get Conversation Message

Launch stage: GA

`GET /api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}`

Get message from conversation.

API scopes: genie

## Path parameters

- `space_id` (string, optional)
  The ID associated with the Genie space where the target conversation is located.
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `conversation_id` (string, optional)
  The ID associated with the target conversation.
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `message_id` (string, optional)
  The ID associated with the target message from the identified conversation.
  Example: `e1ef34712a29169db030324fd0e1df5f`

## Returns

- `id` (string, optional)
  Message ID.
   Legacy identifier, use message_id instead
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `space_id` (string, optional)
  Genie space ID
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `conversation_id` (string, optional)
  Conversation ID
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `user_id` (int64, optional)
  ID of the user who created the message
- `created_timestamp` (int64, optional)
  Timestamp when the message was created
- `last_updated_timestamp` (int64, optional)
  Timestamp when the message was last updated
- `status` (string, optional)
  Possible values: `FETCHING_METADATA`, `FILTERING_CONTEXT`, `ASKING_AI`, `PENDING_WAREHOUSE`, `EXECUTING_QUERY`, `FAILED`, `COMPLETED`, `SUBMITTED`, `QUERY_RESULT_EXPIRED`, `CANCELLED`
  Example: `ASKING_AI`
- `content` (string, optional)
  User message content
  Example: `Biggest open opportunities`
- `attachments` (array of object, optional)
  AI-generated response to the message
  - `text` (object, required)
    Text Attachment if Genie responds with text
     This also contains the final summary when available.
    - `content` (string, optional)
      AI generated message
    - `id` (string, optional)
    - `purpose` (string, optional)
      Purpose of this text attachment. A completed message may contain more than
       one text attachment (for example a clarifying follow-up question alongside
       the final answer); use this field to tell them apart. `TEXT_ATTACHMENT_PURPOSE_ANSWER`
       marks the final answer/summary and `FOLLOW_UP_QUESTION` marks a clarifying question.
      Possible values: `TEXT_ATTACHMENT_PURPOSE_UNSPECIFIED`, `FOLLOW_UP_QUESTION`, `TEXT_ATTACHMENT_PURPOSE_ANSWER`
  - `query` (object, required)
    Query Attachment if Genie responds with a SQL query
    - `title` (string, optional)
      Name of the query
    - `query` (string, optional)
      AI generated SQL query
    - `description` (string, optional)
      Description of the query
    - `last_updated_timestamp` (int64, optional)
      Time when the user updated the query last
    - `parameters` (array of object, optional)
      - `keyword` (string, optional)
      - `value` (string, optional)
      - `sql_type` (string, optional)
    - `id` (string, optional)
    - `statement_id` (string, optional)
      Statement Execution API statement id. Use [Get status, manifest, and result first chunk](:method:statementexecution/getstatement) to get the full result data.
    - `query_result_metadata` (object, optional)
      Metadata associated with the query result.
      - `row_count` (int64, optional)
        The number of rows in the result set.
      - `is_truncated` (boolean, optional)
        Indicates whether the result set is truncated.
    - `thoughts` (array of object, optional, Public Preview)
      Insights into how Genie came to generate the SQL.
      - `thought_type` (string, optional, Public Preview)
        The category of this thought.
         The possible values are:
         * `THOUGHT_TYPE_DESCRIPTION`: A high-level description of how the question was interpreted.
         * `THOUGHT_TYPE_UNDERSTANDING`: How ambiguous parts of the question were resolved.
         * `THOUGHT_TYPE_DATA_SOURCING`: Which tables or datasets were identified as relevant.
         * `THOUGHT_TYPE_INSTRUCTIONS`: Which author-defined instructions were referenced.
         * `THOUGHT_TYPE_STEPS`: The logical steps taken to compute the answer.
        Possible values: `THOUGHT_TYPE_UNSPECIFIED`, `THOUGHT_TYPE_DESCRIPTION`, `THOUGHT_TYPE_UNDERSTANDING`, `THOUGHT_TYPE_DATA_SOURCING`, `THOUGHT_TYPE_INSTRUCTIONS`, `THOUGHT_TYPE_STEPS`
      - `content` (string, optional, Public Preview)
        The md formatted content for this thought.
  - `suggested_questions` (object, required)
    Follow-up questions suggested by Genie
    - `questions` (array of string, optional)
      The suggested follow-up questions
  - `viz` (object, required, Beta)
    Visualization generated by Genie, if requested via `enable_visualization`
    - `title` (string, optional, Beta)
      Name of the visualization
    - `query_attachment_id` (string, optional, Beta)
      The ID of the query attachment the visualization was generated from
  - `attachment_id` (string, optional)
    Attachment ID
- `query_result` (object, optional)
  The result of SQL query if the message includes a query attachment.
   Deprecated. Use `query_result_metadata` in `GenieQueryAttachment` instead.
  - `statement_id` (string, optional)
    Statement Execution API statement id. Use [Get status, manifest, and result first chunk](:method:statementexecution/getstatement) to get the full result data.
  - `row_count` (int64, optional)
    Row count of the result
  - `is_truncated` (boolean, optional)
    If result is truncated
  - `statement_id_signature` (string, optional)
    JWT corresponding to the statement contained in this result
- `error` (object, optional)
  Error message if Genie failed to respond to the message
  - `error` (string, optional)
  - `type` (string, optional)
    Possible values: `TYPE_UNSPECIFIED`, `UNEXPECTED_REPLY_PROCESS_EXCEPTION`, `GENERIC_CHAT_COMPLETION_EXCEPTION`, `CONTEXT_EXCEEDED_EXCEPTION`, `DEPLOYMENT_NOT_FOUND_EXCEPTION`, `FUNCTIONS_NOT_AVAILABLE_EXCEPTION`, `INVALID_COMPLETION_REQUEST_EXCEPTION`, `CONTENT_FILTER_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_JSON_EXCEPTION`, `RETRYABLE_PROCESSING_EXCEPTION`, `INVALID_FUNCTION_CALL_EXCEPTION`, `LOCAL_CONTEXT_EXCEEDED_EXCEPTION`, `CHAT_COMPLETION_NETWORK_EXCEPTION`, `INVALID_CHAT_COMPLETION_JSON_EXCEPTION`, `GENERIC_CHAT_COMPLETION_SERVICE_EXCEPTION`, `WAREHOUSE_ACCESS_MISSING_EXCEPTION`, `WAREHOUSE_NOT_FOUND_EXCEPTION`, `NO_TABLES_TO_QUERY_EXCEPTION`, `SQL_EXECUTION_EXCEPTION`, `REPLY_PROCESS_TIMEOUT_EXCEPTION`, `COULD_NOT_GET_UC_SCHEMA_EXCEPTION`, `INVALID_TABLE_IDENTIFIER_EXCEPTION`, `TOO_MANY_TABLES_EXCEPTION`, `FUNCTION_ARGUMENTS_INVALID_EXCEPTION`, `GENERIC_SQL_EXEC_API_CALL_EXCEPTION`, `CHAT_COMPLETION_CLIENT_EXCEPTION`, `CHAT_COMPLETION_CLIENT_TIMEOUT_EXCEPTION`, `UNKNOWN_AI_MODEL`, `TABLES_MISSING_EXCEPTION`, `MESSAGE_DELETED_WHILE_EXECUTING_EXCEPTION`, `MESSAGE_UPDATED_WHILE_EXECUTING_EXCEPTION`, `BLOCK_MULTIPLE_EXECUTIONS_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_IDENTIFIER_EXCEPTION`, `TOO_MANY_CERTIFIED_ANSWERS_EXCEPTION`, `RATE_LIMIT_EXCEEDED_GENERIC_EXCEPTION`, `RATE_LIMIT_EXCEEDED_SPECIFIED_WAIT_EXCEPTION`, `FUNCTION_CALL_MISSING_PARAMETER_EXCEPTION`, `INVALID_CERTIFIED_ANSWER_FUNCTION_EXCEPTION`, `ILLEGAL_PARAMETER_DEFINITION_EXCEPTION`, `NO_QUERY_TO_VISUALIZE_EXCEPTION`, `NO_DEPLOYMENTS_AVAILABLE_TO_WORKSPACE`, `STOP_PROCESS_DUE_TO_AUTO_REGENERATE`, `FUNCTION_ARGUMENTS_INVALID_TYPE_EXCEPTION`, `MESSAGE_CANCELLED_WHILE_EXECUTING_EXCEPTION`, `COULD_NOT_GET_MODEL_DEPLOYMENTS_EXCEPTION`, `GENERATED_SQL_QUERY_TOO_LONG_EXCEPTION`, `MISSING_SQL_QUERY_EXCEPTION`, `DESCRIBE_QUERY_UNEXPECTED_FAILURE`, `DESCRIBE_QUERY_TIMEOUT`, `DESCRIBE_QUERY_INVALID_SQL_ERROR`, `INVALID_SQL_UNKNOWN_TABLE_EXCEPTION`, `INVALID_SQL_MULTIPLE_STATEMENTS_EXCEPTION`, `INVALID_SQL_MULTIPLE_DATASET_REFERENCES_EXCEPTION`, `MESSAGE_ATTACHMENT_TOO_LONG_ERROR`, `INTERNAL_CATALOG_PATH_OVERLAP_EXCEPTION`, `INTERNAL_CATALOG_MISSING_UC_PATH_EXCEPTION`, `EXCEEDED_MAX_TOKEN_LENGTH_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_ONGOING_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_FAILED_EXCEPTION`, `INTERNAL_CATALOG_ASSET_CREATION_UNSUPPORTED_EXCEPTION`, `UNSUPPORTED_CONVERSATION_TYPE_EXCEPTION`, `COULD_NOT_GET_DASHBOARD_SCHEMA_EXCEPTION`
- `message_id` (string, optional)
  Message ID
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `feedback` (object, optional)
  User feedback for the message if provided
  - `rating` (string, optional)
    The feedback rating
    Possible values: `GENIE_FEEDBACK_RATING_UNSPECIFIED`, `POSITIVE`, `NEGATIVE`, `NONE`
  - `comment` (string, optional, Public Preview)
    Optional feedback comment text

## Response

### Message created

```json
{
  "attachments": null,
  "content": "Give me top sales for last month",
  "conversation_id": "6a64adad2e664ee58de08488f986af3e",
  "created_timestamp": 1719769718,
  "error": null,
  "last_updated_timestamp": 1719769718,
  "message_id": "e1ef34712a29169db030324fd0e1df5f",
  "space_id": "3c409c00b54a44c79f79da06b82460e2",
  "status": "IN_PROGRESS",
  "user_id": 12345
}
```

### Message with a SQL result and text summary

```json
{
  "attachments": [
    {
      "attachment_id": "b3c4d5e6f708901234567890abcdef01",
      "text": {
        "content": "Your top sales last month came from the West region with $1.2M in revenue across 340 deals."
      }
    },
    {
      "attachment_id": "c4d5e6f70890123456789012abcdef02",
      "query": {
        "description": "Retrieves top performing sales region for last month by revenue",
        "last_updated_timestamp": 1719769718,
        "query": "SELECT r.region_name, SUM(s.revenue) AS total_revenue, COUNT(s.deal_id) AS deal_count FROM catalog.schema.sales_2024 s JOIN catalog.schema.regions r ON s.region_id = r.region_id WHERE s.sale_date BETWEEN '2024-06-01' AND '2024-06-30' GROUP BY r.region_name ORDER BY total_revenue DESC LIMIT 1",
        "query_result_metadata": {
          "row_count": 1
        },
        "statement_id": "9d8836fc1bdb4729a27fcc07614b52c4",
        "thoughts": [
          {
            "content": "The user wants to know which region had the highest sales last month. The query aggregates revenue from the sales table, grouped by region.",
            "thought_type": "THOUGHT_TYPE_DESCRIPTION"
          },
          {
            "content": "- Definition of 'top sales': Interpreted as the region with the highest total revenue for the month of June 2024.",
            "thought_type": "THOUGHT_TYPE_UNDERSTANDING"
          },
          {
            "content": "- catalog.schema.sales_2024\n- catalog.schema.regions",
            "thought_type": "THOUGHT_TYPE_DATA_SOURCING"
          },
          {
            "content": "- Filter the sales table to June 2024.\n- Join with the regions table on region_id.\n- Aggregate revenue and deal count by region.\n- Order by total revenue descending and return the top result.",
            "thought_type": "THOUGHT_TYPE_STEPS"
          },
          {
            "content": "- The Genie space is configured to always include deal count alongside revenue in sales queries.",
            "thought_type": "THOUGHT_TYPE_INSTRUCTIONS"
          }
        ],
        "title": "Top sales last month"
      }
    },
    {
      "attachment_id": "d5e6f708901234567890123456abcdef",
      "suggested_questions": {
        "questions": [
          "Can you filter to last quarter?",
          "Show top 5 by revenue",
          "What is the month-over-month trend?"
        ]
      }
    }
  ],
  "content": "Give me top sales for last month",
  "conversation_id": "6a64adad2e664ee58de08488f986af3e",
  "created_timestamp": 1719769718,
  "error": null,
  "last_updated_timestamp": 1719769718,
  "message_id": "e1ef34712a29169db030324fd0e1df5f",
  "space_id": "3c409c00b54a44c79f79da06b82460e2",
  "status": "COMPLETED",
  "user_id": 12345
}
```

### Message with a SQL result answer

```json
{
  "attachments": [
    {
      "attachment_id": "01f0838b7adc123e86447829f57b9572",
      "query": {
        "description": "Retrieves the top sales region for last month by joining sales and regions tables, aggregating revenue and deal count, and returning the highest-revenue region",
        "last_updated_timestamp": 1719769718,
        "query": "SELECT r.region_name, SUM(s.revenue) AS total_revenue, COUNT(s.deal_id) AS deal_count FROM catalog.schema.sales_2024 s JOIN catalog.schema.regions r ON s.region_id = r.region_id WHERE s.sale_date BETWEEN '2024-06-01' AND '2024-06-30' GROUP BY r.region_name ORDER BY total_revenue DESC LIMIT 1",
        "query_result_metadata": {
          "row_count": 1
        },
        "statement_id": "9d8836fc1bdb4729a27fcc07614b52c4",
        "thoughts": [
          {
            "content": "The user is asking about top sales performance for the previous month. The result shows the region, total revenue, and deal count, ordered by revenue descending and limited to the top result.",
            "thought_type": "THOUGHT_TYPE_DESCRIPTION"
          },
          {
            "content": "- Definition of 'top sales': The query assumes 'top sales' means the region with the highest total revenue. Alternative interpretations could consider deal count or average deal size.",
            "thought_type": "THOUGHT_TYPE_UNDERSTANDING"
          },
          {
            "content": "- catalog.schema.sales_2024\n- catalog.schema.regions",
            "thought_type": "THOUGHT_TYPE_DATA_SOURCING"
          },
          {
            "content": "- Filter the sales table to last month's date range.\n- Join with the regions table to get region names.\n- Aggregate revenue and deal count by region.\n- Order by total revenue descending.\n- Limit to the top result.",
            "thought_type": "THOUGHT_TYPE_STEPS"
          }
        ],
        "title": "Top sales by region last month"
      }
    },
    {
      "attachment_id": "a2b3c4d5e6f7089012345678abcdef90",
      "suggested_questions": {
        "questions": [
          "Can you filter to last quarter?",
          "Show top 5 by revenue",
          "What is the month-over-month trend?"
        ]
      }
    }
  ],
  "content": "Give me top sales for last month",
  "conversation_id": "6a64adad2e664ee58de08488f986af3e",
  "created_timestamp": 1719769718,
  "error": null,
  "last_updated_timestamp": 1719769718,
  "message_id": "e1ef34712a29169db030324fd0e1df5f",
  "space_id": "3c409c00b54a44c79f79da06b82460e2",
  "status": "EXECUTING_QUERY",
  "user_id": 12345
}
```

### Message with a text answer

```json
{
  "attachments": [
    {
      "text": {
        "content": "Based on the data, your top sales last month were from the West region, totaling $1.2M in revenue across 340 deals."
      }
    }
  ],
  "content": "Give me top sales for last month",
  "conversation_id": "6a64adad2e664ee58de08488f986af3e",
  "created_timestamp": 1719769718,
  "error": null,
  "last_updated_timestamp": 1719769718,
  "message_id": "e1ef34712a29169db030324fd0e1df5f",
  "space_id": "3c409c00b54a44c79f79da06b82460e2",
  "status": "COMPLETED",
  "user_id": 12345
}
```

### Message with an error

```json
{
  "attachments": null,
  "content": "Give me top sales for last month",
  "conversation_id": "6a64adad2e664ee58de08488f986af3e",
  "created_timestamp": 1719769718,
  "error": {
    "error": "Human readable error message",
    "type": "TABLES_MISSING_EXCEPTION"
  },
  "last_updated_timestamp": 1719769718,
  "message_id": "e1ef34712a29169db030324fd0e1df5f",
  "space_id": "3c409c00b54a44c79f79da06b82460e2",
  "status": "EXECUTING_QUERY",
  "user_id": 12345
}
```

