# Retrieve Published Videos

> Part of the [SpatialGen API documentation](/index.md). [HTML version of this page](/api/01_published_videos/).

Fetch a list of your published videos from SpatialGen

## API context

-   API requests use `https://spatialgen.com` with the `/api` path prefix, included once.
-   Authenticate requests to SpatialGen API endpoints with the `X-SPATIALGEN-APPKEY` HTTP header.
-   Use a key from the workspace that owns the requested resources. Follow the roles and scopes specified for each endpoint below.
-   Keep `admin` and `upload` keys on a trusted backend. `readonly` keys may be used in client apps for permitted read operations.
-   Presigned upload URLs have their own authorization. Do not send your SpatialGen API key to those URLs.

See the [API key guide](/guides/get-started.md) for roles, key creation, expiration, revocation, and rotation.

* * *

**GET** `/videos/published`

Retrieves a list of published videos and streams associated with your SpatialGen account.

Allowed API Key Roles

`admin`, `readonly`

### Query Parameters

| Parameter | Type | Required | Description |
| :-- | :-- | :-- | :-- |
| `folderName` | `string` | No | Filters results by folder name. You can provide this parameter multiple times to include videos from several folders. If omitted, all published videos are returned. This parameter is case-sensitive. |
| `visibility` | `string` | No | Filter streams by visibility. Accepted values: `public` or `drm`. |

### Example request

getpublished.js

```js
fetch('https://spatialgen.com/api/videos/published', {
    method: 'GET',
    headers: {
        'X-SPATIALGEN-APPKEY': apiKey,
    }
})
```

### Example request filtered by visibility

getPublishedFiltered.js

```js
fetch('https://spatialgen.com/api/videos/published?visibility=drm', {
    method: 'GET',
    headers: {
        'X-SPATIALGEN-APPKEY': apiKey,
    }
})
```

### Example Response

The response returns a list sorted in descending order by the stream’s creation date.

response.json

```json
[
    {
        "stream": {
            "createdAt": string,              // Date in string format
            "status": string,                 // Stream status
            "streamName": string,             // Name of the stream
            "streamUrl": string,              // URL for the stream
            "visibility": string,             // Visibility of the stream
            "highestResolutionUrl": string,   // URL to the highest resolution converted video
            "highestResolutionBytes": number,  // The number of bytes in the highest resolution converted video
            "jobId": number                   // The job ID corresponding to the stream
        },
        "library": {
            "createdAt": string,            // Date in string format
            "description": string,          // Description of the video
            "fileFormat3D": string,         // Format of the 3D file
            "folderName": string,           // Name of the folder
            "id": number,                   // ID of the video
            "is3D": boolean,                // If the video is in 3D
            "isStreaming": boolean,         // If the video is streaming
            "perspective": number,          // Perspective
            "thumbnailUrl": string,         // Thumbnail URL
            "videoLength": number,          // Length of the video in seconds
            "videoHeight": number,          // Height of the video
            "videoName": string             // Name of the video
        }
    },
    ...

]
```
