The Sorcerer API allows you to programmatically initiate uploads to your preferred cloud storage provider. Additionally, you can use this tool to view progress and cancel uploads. If parameters are necessary for a request, the body of request must be JSON encoded. To utilize the REST API, cURL or a HTTP library is needed for your corresponding programming language. For Python, the most utilized library is requests. For Node.js, Node Fetch is a suitable library. To create an API key, go to your account and click the "API Keys" tab.
Create an upload process
POST/upload
$ curl https://api.sorcerer.io/upload \
-H "client_id: YOUR_CLIENT_ID" \
-H "client_secret: YOUR_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{"url":"https://wikipedia.org/fake.archive.tar.gz", "connection_id": "2022-07-15T02:28:22.047ZiyceBEGgjO"}'
RESPONSE
{
"process_id"
:
"2022-07-16T16:06:35.560ZbySbGCJ0vT"
,
"url"
:
"https://dumps.wikimedia.org/wikidatawiki/20211120/wikidatawiki-20211120-stub-meta-current27.xml.gz"
,
"step"
:
1
,
"size"
:
1235162647
,
"connection_id"
:
"2022-07-15T02:28:22.047ZiyceBEGgjO"
,
"connection_type"
:
"S3"
,
"connection_name"
:
"sorcerer_bucket"
,
"file_key"
:
"new-wikipedia-file-name.gz"
,
"folder_path"
:
null
,
"og_file_name"
:
"wikidatawiki-20211120-stub-meta-current27.xml.gz"
,
"mime_type"
:
"application/x-gzip"
,
"upload_id"
:
null
,
"completed_chunks"
:
0
,
"chunk_count"
:
200
,
"creation_date"
:
1639959367
,
"start_date"
:
null
,
"completion_date"
:
null
,
"error_message"
:
null
,
"stream"
:
{}
}
Parameters
urlREQUIRED
The url to upload.
connection_idREQUIRED
The connection ID used to define the location where the file will be uploaded.
file_keyoptional
The new name for the requested file that will overwrite the original name.
folder_pathoptional
The folder path that the file should be downloaded into. Only valid with Google Drive, Dropbox, Box, and Microsoft Onedrive connections.
random_keyoptional
Defines whether the uploaded file will keep the original filename or recieve a unique key filename. By default, this parameter is "false". This parameter is ignored if a new name is provided through the "file_key" parameter.
max_sizeoptional
The maximum size of the file that will be downloaded. If the file's size exceeds the provided figure, the process will not be submitted. Note that for stream manifest, this is compared against the estimated size since streams do not provide a file size.
min_sizeoptional
The minimum size of the file that will be downloaded. If the file's size is lower than the provided figure, the process will not be submitted. Note that for stream manifest, this is compared against the estimated size since streams do not provide a file size.
if_modified_byoptional
The latest modification date for a file submitted as a timestamp. If the provided date is less than the file's actual last modification date, the process will not be submitted.
adjust_extensionoptional
If this parameter is set to "true", the file's extension will modified to match its content type. For instance, if a file has a "text/html" mime but the extension is not ".html", Sorcerer will change the extension. The default value for this parameter is "false".
video_qualityoptional
The preferred resolution stream to download for DASH and HLS streams. If the provided resolution is not available, the next best option is downloaded. Available options include: "worst","240","360","540","720","1080", "1440", "2160", "best". By default, the 720p stream is downloaded if the resolution parameter is not provided. This parameter is ignored if the requested stream manifest only contains audio components.
video_idoptional
The preferred video format ID to download. This is only accessible using the "sniff" endpoint and this supersedes the "video_quality" parameter if both are submitted.
audio_idoptional
The preferred audio format id to download. This ID is only accessible using the "sniff" endpoint and this parameter is ignored if the requested stream manifest only contains video components. The formats "worst" and "best" are also applicable with this parameter.
subtitle_languagesoptional
An array of subtitle languages submitted in the ISO 3166-2 international standard (EX: en, pt, ru). A maximum of 10 languages can submitted to be included in the stream download process.
Returns
Returns an upload process object.
Preview a URL
The sniff endpoint allows for a URL's metadata to be previewed before starting a process. If possible, this is recommended for stream downloads for the best experience when choosing the specifc formats to pull. If the URL is not compatible with Sorcerer or is unavailable, an error message will be returned stating the specific reason.
POST/sniff
$ curl https://api.sorcerer.io/sniff \
-H "client_id: YOUR_CLIENT_ID" \
-H "client_secret: YOUR_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{"url":"https://wikipedia.org/fake.archive.tar.gz"}'
RESPONSE FOR FILES
{
"file_name"
:
"fake.archive.tar.gz"
,
"mime_type"
:
"application/x-gzip"
,
"size"
:
347489780
"url"
:
"https://wikipedia.org/fake.archive.tar.gz"
}
RESPONSE FOR STREAM MANIFESTS
{
"audio_tracks"
:
1
,
"file_name"
:
"fake.stream.manifest.m3u8"
,
"formats"
:
[
{
"audio_channels"
:
null
,
"audio_codec"
:
null
,
"audio_sampling_rate"
:
null
,
"audio_tracks"
:
[
"2"
]
"bandwidth"
:
5759626
,
"content_type"
:
"video"
,
"drm_protected"
:
true
,
"drm_providers"
:
[
"Widevine", "Microsoft PlayReady"
]
"duration"
:
418
,
"estimated_size"
:
598158758
,
"frame_rate"
:
29.97
,
"has_audio"
:
true
,
"height"
:
1080
,
"id"
:
"105"
,
"language"
:
"en"
,
"mime_type"
:
"video/mp4"
,
"subtitle_tracks"
:
[
"15"
]
"video_codec"
:
"avc1.640028"
,
"video_tracks"
:
[
]
"width"
:
1920
},
{...},
{...}
]
,
"subtitle_tracks"
:
1
,
"url"
:
"https://wikipedia.org/fake.stream.manifest.m3u8"
,
"video_tracks"
:
1
}
Parameters
urlREQUIRED
Returns
For files, the sniff endpoint returns the file size in bytes and MIME type of the requested URL. For streams, the below is returned.
audio_tracksinteger
The number of audio streams in the manifest.
file_namestring
The name of the file.
formatsarray
An array of stream objects.
subtitle_tracksinteger
The number of subtitle streams in the manifest.
urlstring
The requested URL.
video_tracksinteger
The number of video streams in the manifest.