Content Creation
Imported or uploaded content isn't immediately available as it requires processing. Although you can create tokens for serving, a 'content processing' message will be displayed until the content is ready. To receive notifications when your content is available, consider using Callbacks.
Overview
Before you can protect a multimedia asset with Fastevo Media Protection Platform (Fastevo MP2), you need to create it within the system. There are two methods to do this:
- Importing from an existing external URL
- Uploading the content (single-step upload or multipart upload)
The method you choose may depend on factors like your application flow, the size of the files, or whether you prefer letting end users upload these files directly.
Importing Content from an Existing URL
You can import media from an external source by providing its URL to Fastevo. To create content by importing it from an existing URL, perform a POST request to:
POST https://api.fastevo.net/api/v1/projects/mediaProtection/contents/import
Request Body Parameters:
url
(mandatory): The URL of the media content you wish to import.title
(optional): The title for the content.folderPath
(optional): The destination folder path within Fastevo.watermarkProfile
(optional): The name of the watermark profile to apply to the content.priority
(optional): A numeric value between 0 and 10 that determines the processing priority of the content.tags
(optional): An array of strings representing tags to associate with the content.
Example Request Body:
{
"url": "URL_OF_MEDIA_CONTENT",
"title": "My Media Content",
"folderPath": "/folder/subfolder/",
"watermarkProfile": "BasicWatermark",
"priority": 8,
"tags": ["tag1", "tag2"]
}
In this example:
URL_OF_MEDIA_CONTENT
should be replaced with the actual URL of the media content.title
is the user-friendly name for the content.folderPath
is where the content will be stored in Fastevo.watermarkProfile
specifies which watermark profile (e.g.,"BasicWatermark"
) to apply. If omitted, the default watermark profile (if any) is applied. To apply no profile, setwatermarkProfile
tonull
.priority
is set to 8, indicating a higher processing priority. Note that the actual processing speed depends on your service plan.tags
allows you to add custom labels to the content.
For more details on watermark profiles, see Watermark Profiles.
This process allows you to easily import and protect content from external sources.
API Response
A successful import returns a 201
status code along with a JSON response containing the contentId
of the imported item, for example:
{
"contentId": "65f7ae45d9cde38a23035c90"
}
You can use this contentId
in further operations, such as applying protection policies or generating playback tokens.
Uploading Content
You can also create content by uploading it directly. Fastevo supports both single-step (simple) uploads, recommended for files under 5MB, and multipart uploads, recommended for files over 5MB or when you do not know the file size in advance.
Single-Step Upload (Recommended for less than 5MB)
To upload a smaller file, you can use the regular single-step upload API. This process is straightforward and returns a presigned POST object you can use to upload the file in one go.
Endpoint:
POST https://api.fastevo.net/api/v1/projects/mediaProtection/contents/upload
Request Body Parameters:
title
(optional): The title for the content.folderPath
(optional): The destination folder path within Fastevo.watermarkProfile
(optional): The name of the watermark profile to apply.priority
(optional): A numeric value between 0 and 10 that determines the processing priority of the content.tags
(optional): An array of strings representing tags to associate with the content.multipartUpload
(optional): If set tofalse
or omitted, a single-step upload flow is used by default.
Example Request Body (Single-Step):
{
"title": "My Media Content",
"folderPath": "/folder/subfolder/",
"watermarkProfile": "BasicWatermark",
"priority": 8,
"tags": ["tag1", "tag2"]
}
Typical API Response (Single-Step):
{
"contentId": "65f7ae45d9cde38a23035c90",
"signedUploadObject": {
"url": "https://s3.amazonaws.com/your-bucket",
"postParams": {
"bucket": "your-bucket",
"X-Amz-Algorithm": "AWS4-HMAC-SHA256",
"X-Amz-Credential": "your-credential",
"X-Amz-Date": "20230315T000000Z",
"key": "your-key",
"Policy": "your-policy",
"X-Amz-Signature": "your-signature",
"X-Amz-Storage-Class": "STANDARD"
}
}
}
To upload the media file:
- Extract
signedUploadObject.url
andsignedUploadObject.postParams
. - Construct a form with
postParams
plus the file itself. - POST the form (multipart/form-data) to
url
.
The signed upload object is valid for 24 hours. If the upload object expires, you can create a new signed upload object for the same media content, which will also be valid for another 24 hours.
If the content is not uploaded within 24 hours from creation, it will be automatically deleted, triggering the appropriate callback if configured. For more information, see Callbacks.
Example Upload Flow (Node.js + Axios)
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const path = require('path');
async function uploadMediaContent() {
try {
// 1) Request creation of the content
const tokenCreationResponse = await axios.post(
'https://api.fastevo.net/api/v1/projects/mediaProtection/contents/upload',
{
folderPath: '/testFolder',
}
);
if (tokenCreationResponse.status === 201) {
const { contentId, signedUploadObject } = tokenCreationResponse.data;
const filePath = path.resolve(__dirname, 'path/to/your/file.mp4');
const fileStream = fs.createReadStream(filePath);
// 2) Build the form
const urlToPostTo = signedUploadObject.url;
const postParams = signedUploadObject.postParams;
const form = new FormData();
Object.keys(postParams).forEach((key) => {
form.append(key, postParams[key]);
});
form.append('file', fileStream);
// 3) Upload the file
const response = await axios.post(urlToPostTo, form, {
headers: {
...form.getHeaders(),
Authorization: undefined, // Remove any Authorization header
},
});
if (response.status === 204) {
console.log('File uploaded successfully');
}
}
} catch (err) {
console.error(err);
}
}
uploadMediaContent();
Multipart Upload for Larger Files
When handling large files or uncertain file sizes, you may wish to perform a multipart upload. This approach splits your file into smaller chunks (parts) and is more robust for large or unreliable network scenarios. You can also allow end users to upload directly with a special token, instead of requiring all uploads to go through your servers.
Key points:
- In your initial POST to
/contents/upload
, setmultipartUpload: true
. - The response will contain:
- The
contentId
- A
multipartUploadToken
that can be safely given to end users. The token only authorizes them to upload this specific piece of content.
- The
- If you call the
/upload/multipart/start
endpoint with the file size and it is < 5MB, the system will automatically return a single-stepsignedUploadObject
instead. Otherwise, you proceed with the multipart flow. - We recommend using the fastevo-mp2-uploader-lib (opens in a new tab) NPM package, which handles all these steps automatically.
Creating a Multipart Upload
Endpoint:
POST https://api.fastevo.net/api/v1/projects/mediaProtection/contents/upload
Example Request Body (Multipart):
{
"title": "My Large Media",
"folderPath": "/largeFiles/",
"tags": ["large", "upload"],
"multipartUpload": true
}
Typical API Response (Multipart Initiation):
{
"contentId": "65f7ae45d9cde38a23035c90",
"multipartUploadToken": "eyJhbGciOiJIUz..."
}
multipartUploadToken
can be passed directly to the end user. It only grants permission to upload the single content referenced bycontentId
—nothing else.
Starting the Multipart Upload
Once you have the multipartUploadToken
from the initial call above, you use a new set of multipart-specific endpoints. First, start the multipart upload process by providing the file size (in bytes). If the file size is under 5MB, the system will return a single-step signedUploadObject
; otherwise, it will proceed with a true multipart process.
Endpoint:
POST https://api.fastevo.net/api/v1/projects/mediaProtection/contents/upload/multipart/start
Headers:
Authorization: Bearer {multipartUploadToken}
Body:
{
"fileSize": 18000000
}
Typical Response (File ≥ 5MB):
{
"multipartUpload": true,
"uploadId": "abc123-xyz890..."
}
If fileSize
< 5MB, you will receive a response similar to a single-step upload:
{
"multipartUpload": false,
"signedUploadObject": {
"...": "..."
}
}
Requesting a Presigned URL for Each Chunk
If the file is large and multipartUpload
is true
, you will have uploadId
. For each chunk (part number), request a presigned URL:
POST https://api.fastevo.net/api/v1/projects/mediaProtection/contents/upload/multipart/presign
Headers:
Authorization: Bearer {multipartUploadToken}
Body:
{
"uploadId": "abc123-xyz890...",
"partNumber": 1
}
Response:
{
"presignedUrl": "https://s3.amazonaws.com/your-bucket/..."
}
You then upload that chunk with a PUT
request directly to the presignedUrl
.
Listing Parts (Optional)
You can check how many parts have been uploaded so far:
POST https://api.fastevo.net/api/v1/projects/mediaProtection/contents/upload/multipart/list
Headers:
Authorization: Bearer {multipartUploadToken}
Body:
{
"uploadId": "abc123-xyz890..."
}
Response:
[
{
"PartNumber": 1,
"ETag": "\"abc123...\""
},
...
]
Completing the Multipart Upload
After uploading all parts, finalize the upload by providing an array of part numbers and their returned ETags:
POST https://api.fastevo.net/api/v1/projects/mediaProtection/contents/upload/multipart/complete
Headers:
Authorization: Bearer {multipartUploadToken}
Body Example:
{
"uploadId": "abc123-xyz890...",
"parts": [
{
"PartNumber": 1,
"ETag": "\"etag-of-part1\""
},
{
"PartNumber": 2,
"ETag": "\"etag-of-part2\""
}
]
}
A successful response indicates your upload is complete. Fastevo will process and protect the content accordingly.
Aborting the Multipart Upload
If you need to cancel an ongoing multipart upload (e.g., user cancels in the UI):
POST https://api.fastevo.net/api/v1/projects/mediaProtection/contents/upload/multipart/abort
Headers:
Authorization: Bearer {multipartUploadToken}
Body:
{
"uploadId": "abc123-xyz890..."
}
A successful abort returns a response confirming that the multipart upload has been cancelled and any uploaded parts have been discarded.
Recommended: Use Our NPM Library
To avoid manually handling all these steps (especially for multipart uploads), we recommend using our official fastevo-mp2-uploader-lib (opens in a new tab). This library automatically detects if a file is under 5MB or above, retrieves presigned URLs, splits your file, uploads parts, and completes the upload behind the scenes—all you need is:
- The
multipartUploadToken
(safely shareable with your user or frontend), - A reference to the file you want to upload.
Adding Subtitles
To make your content more accessible, you can add subtitles. Subtitles can be appended or removed for each piece of content. For detailed instructions, see Subtitle Management.