# Transcripts

If transcription was enabled in the session, you can retrieve a list of all transcripts through the **sessions/:id/transcripts** endpoint. This endpoint will return a standard JSON array as a response.

{% hint style="info" %}
If you want to receive an export as a txt or json file, then use the **/export** subendpoint: **sessions/:id/transcripts/export.**  Default is txt file.\
\
There is a **format** param with allowed values **txt** and **json**. \
**sessions/:id/transcripts/export?format=txt**\
**sessions/:id/transcripts/export?format=json**
{% endhint %}

{% hint style="info" %}
Since potentially there could be thousands of transcripts, pagination is supported with **limit** and **offset arguments.** Read about [pagination](/reference/rest-api/pagination.md) to learn the details of it. By default maximum 100 transcripts will be returned in the response.
{% endhint %}

#### Request (listing all transcripts)

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --request GET \
  --url https://api.digitalsamba.com/api/v1/sessions/edb7a1cb-0627-44ed-9ae4-62a344d6e8a9/transcripts \
  --user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}

```java
import com.fasterxml.jackson.databind.ObjectMapper;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.Base64;
import java.util.Map;

String TEAM_ID = "YOUR_TEAM_ID";
String DEVELOPER_KEY = "YOUR_DEVELOPER_KEY";
String authorizationHeader = "Bearer " + Base64.getEncoder().encodeToString((TEAM_ID + ":" + DEVELOPER_KEY).getBytes());

String sessionId = "edb7a1cb-0627-44ed-9ae4-62a344d6e8a9";

HttpRequest request = HttpRequest.newBuilder()
  .GET()
  .uri(new URI("https://api.digitalsamba.com/api/v1/sessions/" + sessionId + "/transcripts"))
  .header("Authorization", authorizationHeader)
  .build();

HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());

System.out.println("Status code: " + response.statusCode());
System.out.println("Body: " + response.body());
```

{% endtab %}
{% endtabs %}

#### Response (200 OK)

```json
{
    "total_count": 8096,
    "data": [
        {
            "participant_id": "f06e6600-9424-4dc0-8e7d-a968df2c983d",
            "participant_name": "John Smith",
            "transcript": "Morning. How are you?",
            "start_time": "2024-04-10T12:18:27Z",
            "end_time": "2024-04-10T12:33:27Z"
        },
        {
            "participant_id": "f06e6600-9424-4dc0-8e7d-a968df2c983d",
            "participant_name": "Jane Doe",
            "transcript": "I am fine, thanks! What about you?",
            "start_time": "2024-04-10T12:10:27Z",
            "end_time": "2024-04-10T12:31:27Z"
        },
        {
            "participant_id": "f06e6600-9424-4dc0-8e7d-a968df2c983d",
            "participant_name": "John Doe",
            "transcript": "Hi all!",
            "start_time": "2024-04-10T12:06:27Z",
            "end_time": "2024-04-10T12:33:27Z"
        },
        ...............97 more transcripts...............
    ]
} 
```

{% hint style="info" %}
The **total\_count** is the total amount of transcripts in the session. It is **NOT** the amount of transcripts in the current page returned in the **data** array. In the above example you have 8096 transcripts in total, but in the data array there will be maximum 100 transcripts (the default **limit** argument value). You can use the **offset** param to page through all transcripts.
{% endhint %}

#### Request (export all transcripts)

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```bash
curl --request GET \
  --url https://api.digitalsamba.com/api/v1/sessions/edb7a1cb-0627-44ed-9ae4-62a344d6e8a9/transcripts/export \
  --user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}

```java
import com.fasterxml.jackson.databind.ObjectMapper;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.util.Base64;
import java.util.Map;

String TEAM_ID = "YOUR_TEAM_ID";
String DEVELOPER_KEY = "YOUR_DEVELOPER_KEY";
String authorizationHeader = "Bearer " + Base64.getEncoder().encodeToString((TEAM_ID + ":" + DEVELOPER_KEY).getBytes());

String sessionId = "edb7a1cb-0627-44ed-9ae4-62a344d6e8a9";

HttpRequest request = HttpRequest.newBuilder()
  .GET()
  .uri(new URI("https://api.digitalsamba.com/api/v1/sessions/" + sessionId + "/transcripts/export"))
  .header("Authorization", authorizationHeader)
  .build();

HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());

System.out.println("Status code: " + response.statusCode());
System.out.println("Body: " + response.body());
```

{% endtab %}
{% endtabs %}

#### Response (200 OK)

```
John Smith: Morning. How are you?
Jane Doe: I am fine, thanks! What about you?
John Doe: Hi all!

...............97 more transcripts...............
```


---

# 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.digitalsamba.com/reference/rest-api/sessions/transcripts.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.
