# get\_\_v2\_stats\_private\_chat

`GET /v2/stats/private-chat`

*Get Private Chat Stats*

Time-series for private-chat metrics. Supports resource-level filters: `model` and `userId`.

#### Parameters <a href="#get__v2_stats_private_chat-parameters" id="get__v2_stats_private_chat-parameters"></a>

| Name           | In    | Type   | Required | Description                                    |
| -------------- | ----- | ------ | -------- | ---------------------------------------------- |
| scope          | query | string | true     | Scope level: `org`, `workspace`, or `repo`     |
| id             | query | string | false    | Required when `scope` is `workspace` or `repo` |
| window         | query | string | true     | Time window, e.g. `24h`, `7d`, `30d`           |
| timeBucketSize | query | string | false    | Time grouping size, e.g., `1h`, `1d`           |
| model          | query | string | false    | Filter by LLM model                            |
| userId         | query | string | false    | Filter by User ID                              |
| apiKeyId       | query | string | false    | Filter by Repo API Key ID                      |
| aiLlmId        | query | string | false    | Filter by AI configuration (LLM config) ID     |

#### TypeScript Client Library

```typescript
// Using the Flashback TypeScript client
import { FlashbackClient } from '@flashbacktech/flashbackclient';

const client = new FlashbackClient({
  accessToken: 'your-access-token'
});

try {
  const result = await client.getPrivateChatStats({
    scope: 'org',
    id: 'org-id',
    window: '24h'});
  console.log('Get Private Chat Stats:', result);
} catch (error) {
  console.error('Failed to retrieve get private chat stats:', error);
}
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X GET "https://backend.flashback.tech/v2/stats/private-chat?scope=org&id=org-id&window=24h" \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
GET /v2/stats/private-chat?scope=org&id=org-id&window=24h HTTP/1.1
Host: backend.flashback.tech
Accept: application/json
Authorization: Bearer {access-token}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

const queryParams = new URLSearchParams({
  scope: 'org',
  id: 'org-id',
  window: '24h'
});

fetch(`https://backend.flashback.tech/v2/stats/private-chat?${queryParams.toString()}`,
{
  method: 'GET',
  headers: headers
})
.then(function(res) {
    return res.json();
})
.then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

result = RestClient.get 'https://backend.flashback.tech/v2/stats/private-chat',
  params: {
    scope: 'org',
    id: 'org-id',
    window: '24h'
  }, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

params = {
  'scope': 'org',
  'id': 'org-id',
  'window': '24h'
}

r = requests.get('https://backend.flashback.tech/v2/stats/private-chat', headers=headers, params=params)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$client = new \GuzzleHttp\Client();

$queryParams = array(
    'scope' => 'org',
    'id' => 'org-id',
    'window' => '24h'
);

try {
    $response = $client->request('GET','https://backend.flashback.tech/v2/stats/private-chat', array(
        'headers' => $headers,
        'query' => $queryParams,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
```

{% endtab %}

{% tab title="Java" %}

```java
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;

String baseUrl = "https://backend.flashback.tech/v2/stats/private-chat";
String queryString = "scope=org&id=org-id&window=24h";
URL obj = new URL(baseUrl + "?" + queryString);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Authorization", "Bearer {access-token}");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "net/http"
       "net/url"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    params := url.Values{}
    params.Add("scope", "org")
    params.Add("id", "org-id")
    params.Add("window", "24h")

    req, err := http.NewRequest("GET", "https://backend.flashback.tech/v2/stats/private-chat?" + params.Encode(), nil)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

> Example responses 200 Response

```json
{
  "success": true,
  "meta": {
    "start": 1704067200,
    "end": 1704153600,
    "scope": "org",
    "window": "24h",
    "timeBucketSize": "1h"
  },
  "summary": {
    "total": 1500,
    "avg": 50,
    "stdDev": 10,
    "min": 0,
    "max": 100,
    "p10": 10,
    "p50": 50,
    "p90": 90
  },
  "series": [
    {
      "ts": 1704067200
      // domain specific metrics
    }
  ]
}
```

#### Responses <a href="#get__v2_stats_private_chat-responses" id="get__v2_stats_private_chat-responses"></a>

| Status | Meaning                                                                    | Description                | Schema |
| ------ | -------------------------------------------------------------------------- | -------------------------- | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Successful request         | Inline |
| 400    | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1)           | Invalid request parameters | Inline |
| 500    | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Internal server error      | Inline |

#### Response Schema <a href="#get__v2_stats_private_chat-responseschema" id="get__v2_stats_private_chat-responseschema"></a>

Status Code **200**

| Name         | Type      | Required | Restrictions | Description                             |
| ------------ | --------- | -------- | ------------ | --------------------------------------- |
| » success    | boolean   | true     | none         | Indicates if the request was successful |
| » meta       | object    | true     | none         | Metadata for the response               |
| » summary    | object    | true     | none         | Statistical summary                     |
| » series     | \[object] | true     | none         | Array of time-series points             |
| »» ts        | integer   | true     | none         | Unix timestamp                          |
| »» tokensIn  | integer   | true     | none         | Input tokens                            |
| »» tokensOut | integer   | true     | none         | Output tokens                           |
| »» requests  | integer   | true     | none         | Total requests                          |

Status Code **400**

| Name      | Type    | Required | Restrictions | Description                      |
| --------- | ------- | -------- | ------------ | -------------------------------- |
| » success | boolean | true     | none         | Always false for error responses |
| » message | string  | true     | none         | Error message                    |

Status Code **500**

| Name      | Type    | Required | Restrictions | Description                      |
| --------- | ------- | -------- | ------------ | -------------------------------- |
| » success | boolean | true     | none         | Always false for error responses |
| » message | string  | true     | none         | Error message                    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flashback.tech/support-reference/platform-api-reference/v2-unified-stats-api/get__v2_stats_private_chat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
