> For a complete page index, fetch https://docs.synthflow.ai/llms.txt. For full documentation content, fetch https://docs.synthflow.ai/llms-full.txt.

# Get a chat

GET https://api.synthflow.ai/v2/chat/{chat_id}

Retrieve details of a specific chat session.

Reference: https://docs.synthflow.ai/api-reference/platform-api/chat/get-chat

## Authentication

- `Authorization` header (bearer token, required)

## Servers

- `https://api.synthflow.ai/v2` (Global, default)
- `https://api.us.synthflow.ai/v2` (United States)
- `https://api.eu.synthflow.ai/v2` (European Union)

## Request

### Path parameters

- `chat_id` (string, required)

## Response

### 200

200

- `status` (string, optional) — Whether the request was successful.
- `response` (object, optional) — Chat session details.
  - `chat_id` (string, required) — Unique identifier for the chat session.
  - `chat_status` (enum, required) — Current status of the chat session.
    - Allowed values: `ongoing`, `completed`, `cancelled`
  - `conversation_history` (list of object, required) — List of messages in the conversation.
    - `agent_id` (string, required) — ID of the agent (or 'user' for user messages).
    - `current_state` (string, required) — The current state of the agent when this message was sent.
    - `message` (string, required) — The message content.
    - `timestamp` (datetime, required) — ISO 8601 timestamp of when the message was sent.
    - `turn_number` (integer, required) — The turn number in the conversation.
  - `start_timestamp` (datetime, required) — ISO 8601 timestamp of when the chat session started.
  - `transcript` (string, required) — Full transcript of the conversation.
  - `initial_message` (object, optional, nullable) — The initial message sent by the agent when the chat was created.
    - `agent_message` (string, optional) — The message content from the agent.
    - `current_state` (string, optional) — The current state of the agent.
    - `timestamp` (datetime, optional) — ISO 8601 timestamp of when the message was sent.
    - `turn_number` (integer, optional) — The turn number in the conversation.
  - `fsm_log` (map from string to object, optional, nullable) — Finite State Machine (FSM) execution log for the chat session.
    - `current_state` (string, required) — The current state of the FSM.
    - `current_turn` (string, required) — Identifier for the current turn in the conversation.
    - `event_summary` (map from string to integer, required) — Summary of event counts by type.
    - `events` (list of object, required) — List of FSM events that occurred during execution.
      - `event_type` (enum, required) — Type of the event.
        - Allowed values: `fsm_started`, `state_executed`, `utterance_sent`, `state_transition`, `turn_changed`, `user_input`, `command_executed`, `command_received`, `command_failed`, `action_executed`, `action_failed`, `transition`, `error`
      - `state_id` (string, required) — ID of the state where the event occurred.
      - `timestamp` (integer, required) — Unix timestamp in milliseconds when the event occurred.
      - `details` (map from string to any, required) — Additional details specific to the event type.
    - `execution_stats` (object, required) — Statistics about FSM execution.
      - `commands_executed` (integer, optional) — Number of commands executed.
      - `state_transitions` (integer, optional) — Number of state transitions.
      - `total_events` (integer, optional) — Total number of events executed.
    - `fsm_metadata` (object, required) — Metadata about the FSM.
      - `name` (string, optional) — Name of the FSM.
    - `variables` (map from string to object, required) — Collected variables (slots) from the conversation flow. Contains variable names as keys with their values and collection status.
      - `value` (string or double or boolean or map from string to any, optional) — The collected value of the variable.
      - `collected` (boolean, optional) — Whether this variable was successfully collected during the conversation.
    - `state_path` (list of string, optional) — Path of states visited during FSM execution.

## Examples

**Response**

```json
{
  "status": "ok",
  "response": {
    "chat_id": "a830288c-88df-4611-8db2-6db87b4fbb41",
    "chat_status": "ongoing",
    "conversation_history": [
      {
        "agent_id": "893195c1-c640-438b-9761-2e5357b01cb8",
        "current_state": "greeting_state",
        "message": "Hi there!",
        "timestamp": {},
        "turn_number": 1
      },
      {
        "agent_id": "user",
        "current_state": "greeting_state",
        "message": "hello i want to visit new york city, please fetch information about this city",
        "timestamp": {},
        "turn_number": 2
      },
      {
        "agent_id": "893195c1-c640-438b-9761-2e5357b01cb8",
        "current_state": "main_state",
        "message": "New York City is an amazing place to visit—full of iconic sights, great food, and endless things to do. Are you looking for travel tips, must-see attractions, or something specific about the city? Let me pull up some details about New York City for you—hang tight!",
        "timestamp": {},
        "turn_number": 3
      }
    ],
    "start_timestamp": {},
    "transcript": "Agent: Hi there!\nUser: hello i want to visit new york city, please fetch information about this city\nAgent: New York City is an amazing place to visit—full of iconic sights, great food, and endless things to do. Are you looking for travel tips, must-see attractions, or something specific about the city? Let me pull up some details about New York City for you—hang tight!",
    "fsm_log": {
      "893195c1-c640-438b-9761-2e5357b01cb8": {
        "current_state": "main_state",
        "current_turn": "eca8b99f-74a6-409c-8597-b8fee9501f4b",
        "event_summary": {
          "action_executed": 1,
          "action_failed": 1,
          "command_executed": 2,
          "command_failed": 1,
          "command_received": 2,
          "fsm_started": 1,
          "state_executed": 2,
          "state_transition": 1,
          "turn_changed": 1,
          "user_input": 1,
          "utterance_sent": 3
        },
        "events": [
          {
            "event_type": "fsm_started",
            "state_id": "greeting_state",
            "timestamp": 1764337490663,
            "details": {
              "fsm_name": "Simple Prompt FSM",
              "initial_state": "greeting_state",
              "turn_id": "FirstMessage_13:44:50.663619418"
            }
          },
          {
            "event_type": "utterance_sent",
            "state_id": "greeting_state",
            "timestamp": 1764337490663,
            "details": {
              "utterance": "Hi there!"
            }
          },
          {
            "event_type": "state_executed",
            "state_id": "greeting_state",
            "timestamp": 1764337490663,
            "details": {
              "state_type": "utterance_state"
            }
          },
          {
            "event_type": "turn_changed",
            "state_id": "greeting_state",
            "timestamp": 1764337611392,
            "details": {
              "new_turn_id": "eca8b99f-74a6-409c-8597-b8fee9501f4b",
              "previous_turn_id": "",
              "turn_type": ""
            }
          },
          {
            "event_type": "user_input",
            "state_id": "greeting_state",
            "timestamp": 1764337611392,
            "details": {
              "is_first_message": false,
              "message": "hello i want to visit new york city, please fetch information about this city",
              "skip_llm": false,
              "turn_type": ""
            }
          },
          {
            "event_type": "state_transition",
            "state_id": "main_state",
            "timestamp": 1764337611392,
            "details": {
              "from_state": "greeting_state",
              "success": true,
              "to_state": "main_state",
              "trigger": "user_response"
            }
          },
          {
            "event_type": "utterance_sent",
            "state_id": "main_state",
            "timestamp": 1764337613202,
            "details": {
              "reason": "inform",
              "utterance": "New York City is an amazing place to visit—full of iconic sights, great food, and endless things to do. Are you looking for travel tips, must-see attractions, or something specific about the city?"
            }
          },
          {
            "event_type": "command_executed",
            "state_id": "main_state",
            "timestamp": 1764337613202,
            "details": {
              "command_type": "utter",
              "parameters": [
                "inform",
                "New York City is an amazing place to visit—full of iconic sights, great food, and endless things to do. Are you looking for travel tips, must-see attractions, or something specific about the city?"
              ],
              "raw_text": "utter inform New York City is an amazing place to visit—full of iconic sights, great food, and endless things to do. Are you looking for travel tips, must-see attractions, or something specific about the city?",
              "success": true
            }
          },
          {
            "event_type": "command_received",
            "state_id": "main_state",
            "timestamp": 1764337614241,
            "details": {
              "command_type": "execute_action",
              "parameters": [
                "post_city"
              ],
              "raw_text": "execute_action post_city"
            }
          },
          {
            "event_type": "command_received",
            "state_id": "main_state",
            "timestamp": 1764337614241,
            "details": {
              "command_type": "utter",
              "parameters": [
                "inform",
                "Let me pull up some details about New York City for you—hang tight!"
              ],
              "raw_text": "utter inform Let me pull up some details about New York City for you—hang tight!"
            }
          },
          {
            "event_type": "action_executed",
            "state_id": "main_state",
            "timestamp": 1764337614241,
            "details": {
              "action_name": "post_city",
              "args": "",
              "state": "main_state"
            }
          },
          {
            "event_type": "action_failed",
            "state_id": "main_state",
            "timestamp": 1764337614784,
            "details": {
              "action_name": "post_city"
            }
          },
          {
            "event_type": "command_failed",
            "state_id": "main_state",
            "timestamp": 1764337614784,
            "details": {
              "command_type": "execute_action",
              "parameters": [
                "post_city"
              ],
              "raw_text": "execute_action post_city",
              "success": false
            }
          },
          {
            "event_type": "utterance_sent",
            "state_id": "main_state",
            "timestamp": 1764337614784,
            "details": {
              "reason": "inform",
              "utterance": "Let me pull up some details about New York City for you—hang tight!"
            }
          },
          {
            "event_type": "command_executed",
            "state_id": "main_state",
            "timestamp": 1764337614784,
            "details": {
              "command_type": "utter",
              "parameters": [
                "inform",
                "Let me pull up some details about New York City for you—hang tight!"
              ],
              "raw_text": "utter inform Let me pull up some details about New York City for you—hang tight!",
              "success": true
            }
          }
        ],
        "execution_stats": {
          "commands_executed": 2,
          "state_transitions": 1,
          "total_events": 16
        },
        "fsm_metadata": {
          "name": "Simple Prompt FSM"
        },
        "state_path": [
          "main_state"
        ]
      }
    }
  }
}
```

**SDK Code**

```python Chat_get-chat_example
import requests

url = "https://api.synthflow.ai/v2/chat/fe90071d-fd73-4755-87a4-6aaa0f9bfb25"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```go Chat_get-chat_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.synthflow.ai/v2/chat/fe90071d-fd73-4755-87a4-6aaa0f9bfb25"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Chat_get-chat_example
require 'uri'
require 'net/http'

url = URI("https://api.synthflow.ai/v2/chat/fe90071d-fd73-4755-87a4-6aaa0f9bfb25")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Chat_get-chat_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.synthflow.ai/v2/chat/fe90071d-fd73-4755-87a4-6aaa0f9bfb25")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```csharp Chat_get-chat_example
using RestSharp;

var client = new RestClient("https://api.synthflow.ai/v2/chat/fe90071d-fd73-4755-87a4-6aaa0f9bfb25");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Chat_get-chat_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.synthflow.ai/v2/chat/fe90071d-fd73-4755-87a4-6aaa0f9bfb25")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```