# get\_\_conversation

{% hint style="info" %}
This API endpoint is currently available only in the TEST environment. It is not yet available in production.
{% endhint %}

`GET /conversation`

*List Conversations*

Retrieve a list of AI conversations with optional filtering and pagination. This endpoint returns conversations based on user permissions and access controls.

**Key Features:**

* Filter by workspace, repository, user, or date range
* Pagination support with configurable page size
* Returns conversation metadata including token usage
* Respects workspace and organization access controls
* Includes creator information for each conversation

**Query Filtering:**

* `take` - Number of records to return (default: 50, max: 100)
* `skip` - Number of records to skip (default: 0)
* `from` - Start date for date range filter (ISO 8601 format)
* `to` - End date for date range filter (ISO 8601 format)
* `userId` - Filter by user who created the conversation
* `workspaceId` - Filter by workspace
* `repoId` - Filter by repository

**Access Control:**

* Organization administrators see all conversations in their organization
* Workspace administrators see all conversations in their managed workspaces
* Regular users see only their own conversations
* Users can filter conversations from workspaces they have access to

**Important Notes:**

* Results are sorted by creation date (newest first)
* Maximum `take` value is 100 to prevent excessive data transfer
* Deleted conversations are excluded from results
* Token counts are returned as strings to support large numbers

#### TypeScript Client Library

```typescript
public getConversations = async (query: GetConversationsRequest): Promise<GetConversationsResponse> => {
  const queryParams = new URLSearchParams();
  if (query.take !== undefined) {
    queryParams.append('take', query.take.toString());
  }
  if (query.skip !== undefined) {
    queryParams.append('skip', query.skip.toString());
  }
  if (query.from) {
    queryParams.append('from', query.from);
  }
  if (query.to) {
    queryParams.append('to', query.to);
  }
  if (query.userId) {
    queryParams.append('userId', query.userId);
  }
  if (query.workspaceId) {
    queryParams.append('workspaceId', query.workspaceId);
  }
  if (query.repoId) {
    queryParams.append('repoId', query.repoId);
  }
  return this.makeRequest<GetConversationsResponse>(
    `conversation?${queryParams.toString()}`,
    'GET',
    null
  );
};
```

#### Code Samples

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

```shell
# You can also use wget
curl -X GET "https://backend.flashback.tech/conversation?workspaceId=workspace-123&take=50&skip=0" \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
GET https://backend.flashback.tech/conversation?workspaceId=workspace-123&take=50 HTTP/1.1
Host: backend.flashback.tech
Accept: application/json
```

{% endtab %}

{% tab title="JavaScript" %}

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

fetch('https://backend.flashback.tech/conversation?workspaceId=workspace-123&take=50',
{
  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/conversation',
  params: {
  'take' => 'integer',
  'skip' => 'integer',
  'from' => 'string',
  'to' => 'string',
  'userId' => 'string',
  'workspaceId' => 'string',
  'repoId' => 'string'
}, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

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

r = requests.get('https://backend.flashback.tech/conversation', params={
  'workspaceId': 'workspace-123',
  'take': 50,
  'skip': 0
}, headers = headers)

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

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

 // ...
```

{% endtab %}

{% tab title="Java" %}

```java
URL obj = new URL("https://backend.flashback.tech/conversation?workspaceId=workspace-123&take=50");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
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 (
       "bytes"
       "net/http"
)

func main() {

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

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://backend.flashback.tech/conversation", data)
    req.Header = headers

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

{% endtab %}
{% endtabs %}

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

| Name        | In    | Type    | Required | Description                                         |
| ----------- | ----- | ------- | -------- | --------------------------------------------------- |
| take        | query | integer | false    | Number of records to return (default: 50, max: 100) |
| skip        | query | integer | false    | Number of records to skip (default: 0)              |
| from        | query | string  | false    | Start date for date range filter (ISO 8601)         |
| to          | query | string  | false    | End date for date range filter (ISO 8601)           |
| userId      | query | string  | false    | Filter by user who created the conversation         |
| workspaceId | query | string  | false    | Filter by workspace ID                              |
| repoId      | query | string  | false    | Filter by repository ID                             |

> Example responses

> 200 Response

```json
{
  "success": true,
  "conversations": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "orgId": "org-123",
      "createdBy": "user-456",
      "createdAt": "2024-01-15T10:30:00.000Z",
      "lastUpdatedAt": "2024-01-15T11:45:00.000Z",
      "workspaceId": "workspace-789",
      "repoId": "repo-101",
      "tokensIn": "1523",
      "tokensOut": "2847",
      "creator": {
        "id": "user-456",
        "name": "John",
        "lastName": "Doe",
        "email": "john.doe@example.com"
      }
    }
  ],
  "total": 1
}
```

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

| Status | Meaning                                                                    | Description                          | Schema |
| ------ | -------------------------------------------------------------------------- | ------------------------------------ | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                    | Successfully retrieved conversations | 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) | Failed to retrieve conversations     | Inline |

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

Status Code **200**

| Name             | Type      | Required | Restrictions | Description                                      |
| ---------------- | --------- | -------- | ------------ | ------------------------------------------------ |
| » success        | boolean   | false    | none         | Operation success status                         |
| » conversations  | \[object] | false    | none         | Array of conversation objects                    |
| »» id            | string    | false    | none         | Unique identifier for the conversation           |
| »» orgId         | string    | false    | none         | Organization ID                                  |
| »» createdBy     | string    | false    | none         | User ID who created the conversation             |
| »» createdAt     | string    | false    | none         | ISO 8601 timestamp                               |
| »» lastUpdatedAt | string    | false    | none         | ISO 8601 timestamp                               |
| »» workspaceId   | string    | false    | none         | Workspace ID                                     |
| »» repoId        | string    | false    | none         | Repository ID                                    |
| »» tokensIn      | string    | false    | none         | Total input tokens consumed (as string)          |
| »» tokensOut     | string    | false    | none         | Total output tokens generated (as string)        |
| »» creator       | object    | false    | none         | Creator user information                         |
| »»» id           | string    | false    | none         | User ID                                          |
| »»» name         | string    | false    | none         | User first name                                  |
| »»» lastName     | string    | false    | none         | User last name                                   |
| »»» email        | string    | false    | none         | User email                                       |
| » total          | integer   | false    | none         | Total number of conversations matching the query |

Status Code **400**

| Name            | Type    | Required | Restrictions | Description   |
| --------------- | ------- | -------- | ------------ | ------------- |
| » success       | boolean | false    | none         | none          |
| » conversations | array   | false    | none         | none          |
| » total         | integer | false    | none         | none          |
| » message       | string  | false    | none         | Error message |

Status Code **500**

| Name            | Type    | Required | Restrictions | Description   |
| --------------- | ------- | -------- | ------------ | ------------- |
| » success       | boolean | false    | none         | none          |
| » conversations | array   | false    | none         | none          |
| » total         | integer | false    | none         | none          |
| » message       | string  | false    | none         | Error message |

To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth


---

# 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/conversation-api/get__conversation.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.
