# Download

To get a download link for a recording -> execute a **GET** request against the **/recordings/:id/download** endpoint. The **id** uniquely identifies the recording.

#### Download link expiration time

{% hint style="info" %}
Each download link has an expiration time for security reasons. \
By default the link is valid for **one day**.

If you want to use a different expiration time, then you need to specify the **valid\_for\_minutes** http param.\
\
For example to generate a link which will be valid for **one week**:\
\&#xNAN;**/recordings/:id/download?valid\_for\_minutes=10080**
{% endhint %}

#### Request

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

```bash
curl --request GET \
  --url https://api.digitalsamba.com/api/v1/recordings/6e4a5676-c2e8-4c14-90a2-4c6cd71640be/download \
  --user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY
```

{% 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());
//Put your recording id here - this value is just an example
String recordingId = "c39d7c40-7ff7-4faa-b06f-698a639a9523";

HttpRequest request = HttpRequest.newBuilder()
  .GET()
  .uri(new URI("https://api.digitalsamba.com/api/v1/recordings/" + recordingId + "/download"))
  .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
{    
    "link": "https://SambaCloudDomainHere/6e4a5676-c2e8-4c14-90a2-4c6cd71640be.mp4?h=sfYLkq8A9jPe7tTyddq9Sg&expires=1675767898",
    "valid_until": "2023-02-07T11:04:58Z"
} 
```
