# Upload A Remote Video

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

How to get started with the SpatialGen API

## 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.

* * *

**POST** `/videos/upload`

Upload a video which is hosted on a remote URL, such as in an AWS S3 bucket, DropBox, GCP, or Azure. Successful requests sync to your SpatialGen account.

Required API Key Role

`admin`

**Upload Request Parameters**

-   `name`: string
-   `description`: string
-   `layout`: “2D”, “MVHEVC”, “SBS”, “TB”, “Separate”, “AIV”
-   `perspective`: “Regular”, “180”, “360”
-   `videoUrl`: string = The URL to the video file. This URL needs to be accessible from within the SpatialGen newtork.
-   `secondaryVideoUrl`: (optional) string = Used for videos with separate left and right eye videos.
-   `folderName`: (optional) string = The folder to store the video in. Defaults to the ‘Home’ folder.

### Example request to upload a video

uploadCode.js

```js
const uploadData = {
    name: 'video.mp4',
    description: 'An example video',
    layout: '2D',
    perspective: 'Regular',
    videoUrl: 'https://example.com/video.mp4
}

fetch('https://spatialgen.com/api/videos/upload', {
method: 'POST',
headers: {
'X-SPATIALGEN-APPKEY': apiKey
},
body: JSON.stringify(uploadData)
})
```

### Example Response

response.json

```json
{
    "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
}
```
