Files are the first resource you will interact with in the API. They are the files that you want to associate to a take and eventually generate animations from.

Creating a single file

To create a file type, you need to specify the type of file you want to create:

Sample: Creating an mp4 file.

mutation CreateFile {
    createFile(type: "mp4") {
        id
        presignedUrl
    }
}

This will return a presigned URL that you can use to upload your video file to our servers. See the sample response below:

{
	"data": {
		"createFile": {
			"id": "file-2be2463e-ffa3-419b-beb4-ea0f99c79592",
            "presignedUrl": "https://file-production-storage.s3.amazonaws.com/8b9ecfde-bfd1-4b7b-b134-d2d07455af8c.mp4?AWSAccessKeyId=ASIAZJHW76V2R6BKYGE4&Signature=5BSdYtrKRp6DnmpYtw2RKVd2YNI%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEGcaCWV1LXdlc3QtMSJHMEUCIQCoVMnKEgbyIkIZnSbR7a7wS6Y4DytfyRi6kTQqSiDYdQIgNyaT5O5ybmVIKTlo3564kahhLC%2Bjt0RxA7Eevjo3po8qjQMIwP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARABGgw2MzgzMjA2MzczMDEiDJtq%2FGKG1wp5%2FeWE6yrhAnfdmA0oDr%2Ftek9gDNh60eLXOVZz3f7s1AoY8oZClC5yUAX%2B6C392zSacNQVaDAj786g%2BJAc%2BMbXZ7RazgaWp9DMAZFj5V5VfivnXTHNHgorKvWKTAV4aTI8N%2B0qgcuueY7EDkuCKW9D249T2Lv4lgoKrIzYTV89lvnAWw2L1QCwAJH%2BgDKdj2KXPKH3mzpFk9%2BjwdUwlQwx8k8%2Faa%2BSb3HvR%2FYOvQn7w60wQbP%2B3RFCnZKtIVUAf6GOcvC6xzvLliNW7WspONEcb5PbdAIQ89sqJLcCdagI0Q%2FlgYKX%2BY2PpAmnZZpY8%2BelT5iy3Ci7Oolc3Y1zWmZQV%2FV7UJ0tD7OtcpNHsPm4185ER9lVjyghQ3zKlDga9oyb4ItQ8y0GXiCvqpiluiVHICu3SdHMmiP7tfy7LrkUZwfSGGlFOdHaV7J4kvPMoZCTTSq%2FIGWmH4i3kPxhLMSswTQLM1QcTzZPMPSTzKQGOp4BuIj5oAgvdk2YjGbZeshvnnorYL53swxJkuQr9ZL7HNwOf105rhv8vZ4ciUIP6rA3V4rNcBVoy2%2Bvtcuq7oGvlXdGqvk%2F0yhlDvURTHLTTkwWkTE8pc%2B6gr5clN7ipScD6d1y3%2F3seHMaMnCJdgvvUzm7i2ZLg0HiC8Ndn5NIrfBDxM5x%2FmrVt4UrZOfgXxM4SVn9rAASWXVML4tMOnE%3D&Expires=1687361581"
		}
	}
}

Creating multiple files

Multiple files can also be created in a single request using Graphql aliases:

Sample: Creating multiple mp4 files.

mutation CreateFile {
    videoFile: createFile(type: "mp4") {
        id
        presignedUrl
    }
    depthTrack: createFile(type: "mp4") {
        id
        presignedUrl
    }
}

Response:

{
	"data": {
		"videoFile": {
			"id": "file-2be2463e-ffa3-419b-beb4-ea0f99c79592",
            "presignedUrl": "https://file-production-storage.s3.amazonaws.com/8b9ecfde-bfd1-4b7b-b134-d2d07455af8c.mp4?AWSAccessKeyId=ASIAZJHW76V2R6BKYGE4&Signature=5BSdYtrKRp6DnmpYtw2RKVd2YNI%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEGcaCWV1LXdlc3QtMSJHMEUCIQCoVMnKEgbyIkIZnSbR7a7wS6Y4DytfyRi6kTQqSiDYdQIgNyaT5O5ybmVIKTlo3564kahhLC%2Bjt0RxA7Eevjo3po8qjQMIwP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARABGgw2MzgzMjA2MzczMDEiDJtq%2FGKG1wp5%2FeWE6yrhAnfdmA0oDr%2Ftek9gDNh60eLXOVZz3f7s1AoY8oZClC5yUAX%2B6C392zSacNQVaDAj786g%2BJAc%2BMbXZ7RazgaWp9DMAZFj5V5VfivnXTHNHgorKvWKTAV4aTI8N%2B0qgcuueY7EDkuCKW9D249T2Lv4lgoKrIzYTV89lvnAWw2L1QCwAJH%2BgDKdj2KXPKH3mzpFk9%2BjwdUwlQwx8k8%2Faa%2BSb3HvR%2FYOvQn7w60wQbP%2B3RFCnZKtIVUAf6GOcvC6xzvLliNW7WspONEcb5PbdAIQ89sqJLcCdagI0Q%2FlgYKX%2BY2PpAmnZZpY8%2BelT5iy3Ci7Oolc3Y1zWmZQV%2FV7UJ0tD7OtcpNHsPm4185ER9lVjyghQ3zKlDga9oyb4ItQ8y0GXiCvqpiluiVHICu3SdHMmiP7tfy7LrkUZwfSGGlFOdHaV7J4kvPMoZCTTSq%2FIGWmH4i3kPxhLMSswTQLM1QcTzZPMPSTzKQGOp4BuIj5oAgvdk2YjGbZeshvnnorYL53swxJkuQr9ZL7HNwOf105rhv8vZ4ciUIP6rA3V4rNcBVoy2%2Bvtcuq7oGvlXdGqvk%2F0yhlDvURTHLTTkwWkTE8pc%2B6gr5clN7ipScD6d1y3%2F3seHMaMnCJdgvvUzm7i2ZLg0HiC8Ndn5NIrfBDxM5x%2FmrVt4UrZOfgXxM4SVn9rAASWXVML4tMOnE%3D&Expires=1687361581"
		},
		"depthTrack": {
			"id": "file-2be2463e-ffa3-419b-beb4-ea0f99c79592",
            "presignedUrl": "https://file-production-storage.s3.amazonaws.com/8b9ecfde-bfd1-4b7b-b134-d2d07455af8c.mp4?AWSAccessKeyId=ASIAZJHW76V2R6BKYGE4&Signature=5BSdYtrKRp6DnmpYtw2RKVd2YNI%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEGcaCWV1LXdlc3QtMSJHMEUCIQCoVMnKEgbyIkIZnSbR7a7wS6Y4DytfyRi6kTQqSiDYdQIgNyaT5O5ybmVIKTlo3564kahhLC%2Bjt0RxA7Eevjo3po8qjQMIwP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARABGgw2MzgzMjA2MzczMDEiDJtq%2FGKG1wp5%2FeWE6yrhAnfdmA0oDr%2Ftek9gDNh60eLXOVZz3f7s1AoY8oZClC5yUAX%2B6C392zSacNQVaDAj786g%2BJAc%2BMbXZ7RazgaWp9DMAZFj5V5VfivnXTHNHgorKvWKTAV4aTI8N%2B0qgcuueY7EDkuCKW9D249T2Lv4lgoKrIzYTV89lvnAWw2L1QCwAJH%2BgDKdj2KXPKH3mzpFk9%2BjwdUwlQwx8k8%2Faa%2BSb3HvR%2FYOvQn7w60wQbP%2B3RFCnZKtIVUAf6GOcvC6xzvLliNW7WspONEcb5PbdAIQ89sqJLcCdagI0Q%2FlgYKX%2BY2PpAmnZZpY8%2BelT5iy3Ci7Oolc3Y1zWmZQV%2FV7UJ0tD7OtcpNHsPm4185ER9lVjyghQ3zKlDga9oyb4ItQ8y0GXiCvqpiluiVHICu3SdHMmiP7tfy7LrkUZwfSGGlFOdHaV7J4kvPMoZCTTSq%2FIGWmH4i3kPxhLMSswTQLM1QcTzZPMPSTzKQGOp4BuIj5oAgvdk2YjGbZeshvnnorYL53swxJkuQr9ZL7HNwOf105rhv8vZ4ciUIP6rA3V4rNcBVoy2%2Bvtcuq7oGvlXdGqvk%2F0yhlDvURTHLTTkwWkTE8pc%2B6gr5clN7ipScD6d1y3%2F3seHMaMnCJdgvvUzm7i2ZLg0HiC8Ndn5NIrfBDxM5x%2FmrVt4UrZOfgXxM4SVn9rAASWXVML4tMOnE%3D&Expires=1687361581"
		},
	}
}

Querying for a file

{
    getFile(fileId: "file-2be2463e-ffa3-419b-beb4-ea0f99c79592") {
        id
        presignedUrl
    }
}

This will return a presignedUrl for downloading the file:

{
	"data": {
		"getFile": {
			"id": "file-2be2463e-ffa3-419b-beb4-ea0f99c79592",
            "presignedUrl": "https://file-production-storage.s3.amazonaws.com/8b9ecfde-bfd1-4b7b-b134-d2d07455af8c.mp4?AWSAccessKeyId=ASIAZJHW76V2R6BKYGE4&Signature=5BSdYtrKRp6DnmpYtw2RKVd2YNI%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEGcaCWV1LXdlc3QtMSJHMEUCIQCoVMnKEgbyIkIZnSbR7a7wS6Y4DytfyRi6kTQqSiDYdQIgNyaT5O5ybmVIKTlo3564kahhLC%2Bjt0RxA7Eevjo3po8qjQMIwP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARABGgw2MzgzMjA2MzczMDEiDJtq%2FGKG1wp5%2FeWE6yrhAnfdmA0oDr%2Ftek9gDNh60eLXOVZz3f7s1AoY8oZClC5yUAX%2B6C392zSacNQVaDAj786g%2BJAc%2BMbXZ7RazgaWp9DMAZFj5V5VfivnXTHNHgorKvWKTAV4aTI8N%2B0qgcuueY7EDkuCKW9D249T2Lv4lgoKrIzYTV89lvnAWw2L1QCwAJH%2BgDKdj2KXPKH3mzpFk9%2BjwdUwlQwx8k8%2Faa%2BSb3HvR%2FYOvQn7w60wQbP%2B3RFCnZKtIVUAf6GOcvC6xzvLliNW7WspONEcb5PbdAIQ89sqJLcCdagI0Q%2FlgYKX%2BY2PpAmnZZpY8%2BelT5iy3Ci7Oolc3Y1zWmZQV%2FV7UJ0tD7OtcpNHsPm4185ER9lVjyghQ3zKlDga9oyb4ItQ8y0GXiCvqpiluiVHICu3SdHMmiP7tfy7LrkUZwfSGGlFOdHaV7J4kvPMoZCTTSq%2FIGWmH4i3kPxhLMSswTQLM1QcTzZPMPSTzKQGOp4BuIj5oAgvdk2YjGbZeshvnnorYL53swxJkuQr9ZL7HNwOf105rhv8vZ4ciUIP6rA3V4rNcBVoy2%2Bvtcuq7oGvlXdGqvk%2F0yhlDvURTHLTTkwWkTE8pc%2B6gr5clN7ipScD6d1y3%2F3seHMaMnCJdgvvUzm7i2ZLg0HiC8Ndn5NIrfBDxM5x%2FmrVt4UrZOfgXxM4SVn9rAASWXVML4tMOnE%3D&Expires=1687361581"
		}
	}
}

Uploading a file to presignedUrl

=== "Python"

```python
import requests
import boto3

presigned_url = "<presignedUrl>" # (1)

filename = "<path to file on disk>"
with open(filename, 'rb') as f:
    requests.put(presigned_url, data=f.read())
```
1. The presignedUrl is fetched from the response while [creating a file](/move-ugc-api/getting-started/usage/files/#creating-a-single-file)

=== "Javascript"

```javascript
const axios = require('axios');
const fs = require('fs');

const presignedUrl = "<presignedUrl>";
const filename = "<path to file on disk>";

fs.readFile(filename, (err, data) => {
    if (err) throw err;

    axios.put(presignedUrl, data)
    .then(response => {
        console.log('Upload successful');
    })
    .catch(error => {
        console.error('Upload failed:', error);
    });
});
```

=== "Curl"

```bash
curl -X PUT -T <path to file on disk> "<presignedUrl>"
```