> For the complete documentation index, see [llms.txt](https://docs.digitalsamba.com/reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalsamba.com/reference/rest-api/content-library/files/webapps.md).

# Webapps

To add a new embedded content (webapp) file, you need to execute a **POST** request against the **/libraries/:id/webapps** endpoint. This is useful for embedding external websites like Youtube, Miro, Google Docs, etc...

Three fields are available in the JSON body of the **POST** request:

* **url** - the url of the external site to embed
* **name** - the name of the file. Required.
* **parent\_id** - the id of the parent folder.\
  Omit this field if the webapp file is attached to the root of the library and not to a parent folder.

In the response you will find the unique **id** which identifies the file.

#### Request (file created in the root of the library)

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

```bash
curl --request POST \
  --header "Content-Type: application/json" \
  --url https://api.digitalsamba.com/api/v1/libraries/8606721f-d847-4721-a5dc-6537e822104c/webapps \
  --user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY \
  --data '{"url": "https://www.youtube.com/watch?v=hI9HQfCAw64", "name": "Starship 5th Flight Test"}'
```

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

//Put your library id here - this value is just an example
final String libraryId = "8606721f-d847-4721-a5dc-6537e822104c";
		
Map<String, String> data = Map.of(
       "url", "https://www.youtube.com/watch?v=hI9HQfCAw64",
       "name", "Starship 5th Flight Test"
);
String jsonData = new ObjectMapper().writeValueAsString(data);

HttpRequest request = HttpRequest.newBuilder()
  .POST(HttpRequest.BodyPublishers.ofString(jsonData))
  .uri(new URI("https://api.digitalsamba.com/api/v1/libraries/" + libraryId + "/webapps"))
  .header("Authorization", authorizationHeader)
  .header("Content-Type", "application/json")
  .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
{
    "id": "8b8febd1-d200-4120-b7a1-4f9a3e5c487b",
    "library_id": "8606721f-d847-4721-a5dc-6537e822104c",
    "name": "Starship 5th Flight Test",
    "type": "youtube",
    "url": "https:\/\/www.youtube.com\/watch?v=hI9HQfCAw64",
    "source": "api",
    "status": "completed",
    "created_at":"2025-01-22T09:56:54Z"
}

```
