> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.privategpt.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.privategpt.dev/_mcp/server.

# Get Async Chat Stream Status

GET /v1/messages/async/{message_id}/status

Get the current status and metadata of an asynchronous chat stream.

This endpoint returns comprehensive information about a chat stream's
current state, including processing status, timestamps, error information,
and additional metadata collected during processing.

Status Values:
* pending: Stream created but processing not yet started
* processing: Active processing with events being generated
* completed: Stream finished successfully
* cancelled: Stream was cancelled by user request
* error: Stream encountered an error and stopped

Use Cases:
* Monitor stream progress without consuming events
* Check completion status before attempting to observe
* Debugging failed streams via error messages
* Performance monitoring through metadata

Reference: https://docs.privategpt.dev/api-reference/async-messages/get-stream-status-v-1-messages-async-message-id-status-get

## Request

### Path parameters

- `message_id` (string, required) — Message ID of the asynchronous chat stream to check status for.

## Response

### 200

Stream status and metadata information

- `message_id` (string, required) — Unique identifier for the stream
- `status` (enum, required) — Current status of the stream
  - Allowed values: `pending`, `processing`, `completed`, `failed`, `cancelled`, `error`
- `created_at` (datetime, required) — Timestamp when the stream was created
- `updated_at` (datetime, required) — Timestamp when the stream was last updated
- `completed_at` (datetime, optional, nullable) — Timestamp when the stream was completed, if applicable
- `error_message` (string, optional, nullable) — Error message if the stream encountered an error
- `stream_type` (string, optional, default: default) — Type of the stream, used for categorization
- `metadata` (map from string to any, optional) — Additional metadata associated with the stream

## Errors

### 401 Unauthorized Error

Unauthorized

- `any`

### 404 Not Found Error

Stream not found

- `detail` (OpenApiValidationErrorResponseDetail, required) — Error detail — a string message or a list of validation error objects.

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional) — detail field.

## Types

### OpenApiValidationErrorResponseDetail

Error detail — a string message or a list of validation error objects.

### ValidationError

ValidationError schema.

- `loc` (list of ValidationErrorLocItems, required) — loc field.
- `msg` (string, required) — msg field.
- `type` (string, required) — type field.
- `input` (any, optional) — input field.
- `ctx` (ValidationErrorCtx, optional) — ctx field.

### ValidationErrorLocItems

### ValidationErrorCtx

ctx field.

## Examples

### Stream in pending state

**Response**

```json
{
  "message_id": "msg_async_12345",
  "status": "pending",
  "created_at": "2025-07-10T09:11:16.003615Z",
  "updated_at": "2025-07-10T09:11:16.003615Z",
  "stream_type": "default",
  "metadata": {}
}
```

**SDK Code**

```python Stream in pending state
import requests

url = "https://api.example.com/v1/messages/async/message_id/status"

response = requests.get(url)

print(response.json())
```

```javascript Stream in pending state
const url = 'https://api.example.com/v1/messages/async/message_id/status';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Stream in pending state
package main

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

func main() {

	url := "https://api.example.com/v1/messages/async/message_id/status"

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

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

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

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

}
```

```ruby Stream in pending state
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/messages/async/message_id/status")

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

request = Net::HTTP::Get.new(url)

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

```java Stream in pending state
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.example.com/v1/messages/async/message_id/status")
  .asString();
```

```php Stream in pending state
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/v1/messages/async/message_id/status');

echo $response->getBody();
```

```csharp Stream in pending state
using RestSharp;

var client = new RestClient("https://api.example.com/v1/messages/async/message_id/status");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Stream in pending state
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/messages/async/message_id/status")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
```

### Stream currently processing

**Response**

```json
{
  "message_id": "msg_async_67890",
  "status": "processing",
  "created_at": "2025-07-10T09:11:16.003615Z",
  "updated_at": "2025-07-10T09:11:20.123456Z",
  "stream_type": "default",
  "metadata": {
    "tokens_processed": 156,
    "tools_used": [
      "security_scanner"
    ]
  }
}
```

**SDK Code**

```python Stream currently processing
import requests

url = "https://api.example.com/v1/messages/async/message_id/status"

response = requests.get(url)

print(response.json())
```

```javascript Stream currently processing
const url = 'https://api.example.com/v1/messages/async/message_id/status';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Stream currently processing
package main

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

func main() {

	url := "https://api.example.com/v1/messages/async/message_id/status"

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

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

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

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

}
```

```ruby Stream currently processing
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/messages/async/message_id/status")

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

request = Net::HTTP::Get.new(url)

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

```java Stream currently processing
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.example.com/v1/messages/async/message_id/status")
  .asString();
```

```php Stream currently processing
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/v1/messages/async/message_id/status');

echo $response->getBody();
```

```csharp Stream currently processing
using RestSharp;

var client = new RestClient("https://api.example.com/v1/messages/async/message_id/status");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Stream currently processing
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/messages/async/message_id/status")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
```

### Successfully completed stream

**Response**

```json
{
  "message_id": "msg_async_99999",
  "status": "completed",
  "created_at": "2025-07-10T09:11:16.003615Z",
  "updated_at": "2025-07-10T09:11:28.987654Z",
  "completed_at": "2025-07-10T09:11:28.987654Z",
  "stream_type": "default",
  "metadata": {
    "completion_time_ms": 12984,
    "total_tokens": 521
  }
}
```

**SDK Code**

```python Successfully completed stream
import requests

url = "https://api.example.com/v1/messages/async/message_id/status"

response = requests.get(url)

print(response.json())
```

```javascript Successfully completed stream
const url = 'https://api.example.com/v1/messages/async/message_id/status';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Successfully completed stream
package main

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

func main() {

	url := "https://api.example.com/v1/messages/async/message_id/status"

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

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

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

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

}
```

```ruby Successfully completed stream
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/messages/async/message_id/status")

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

request = Net::HTTP::Get.new(url)

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

```java Successfully completed stream
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.example.com/v1/messages/async/message_id/status")
  .asString();
```

```php Successfully completed stream
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/v1/messages/async/message_id/status');

echo $response->getBody();
```

```csharp Successfully completed stream
using RestSharp;

var client = new RestClient("https://api.example.com/v1/messages/async/message_id/status");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Successfully completed stream
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/messages/async/message_id/status")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
```

### Stream encountered an error

**Response**

```json
{
  "message_id": "msg_async_error",
  "status": "error",
  "created_at": "2025-07-10T09:11:16.003615Z",
  "updated_at": "2025-07-10T09:11:18.555555Z",
  "error_message": "Tool execution timeout after 30 seconds",
  "stream_type": "default",
  "metadata": {
    "error_code": "TOOL_TIMEOUT",
    "failed_tool": "security_scanner"
  }
}
```

**SDK Code**

```python Stream encountered an error
import requests

url = "https://api.example.com/v1/messages/async/message_id/status"

response = requests.get(url)

print(response.json())
```

```javascript Stream encountered an error
const url = 'https://api.example.com/v1/messages/async/message_id/status';
const options = {method: 'GET'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Stream encountered an error
package main

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

func main() {

	url := "https://api.example.com/v1/messages/async/message_id/status"

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

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

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

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

}
```

```ruby Stream encountered an error
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/messages/async/message_id/status")

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

request = Net::HTTP::Get.new(url)

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

```java Stream encountered an error
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.example.com/v1/messages/async/message_id/status")
  .asString();
```

```php Stream encountered an error
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.example.com/v1/messages/async/message_id/status');

echo $response->getBody();
```

```csharp Stream encountered an error
using RestSharp;

var client = new RestClient("https://api.example.com/v1/messages/async/message_id/status");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Stream encountered an error
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/messages/async/message_id/status")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
```