Uploading With Accessible URL
When This Option Is Ideal
Use this when your video is already accessible via HTTPS (public, or via a time-limited URL you generate).
AntCDN will fetch the video server-side and start processing automatically.
This is often easier than direct upload if your video already lives in cloud storage.
The Single-Step Process
- Submit an accessible URL plus your processing options.
Upload Your Video
POST https://api.antcdn.net/v1/videos/upload
Required Parameters
| Field | Type | Description |
|---|---|---|
allowPublicAccess | boolean | Whether video can be accessed without authentication |
fileName | string | A filename for AntCDN to use (e.g. demo.mp4) |
videoURL | string | The URL AntCDN will fetch |
Optional Parameters
| Field | Type | Default | Description |
|---|---|---|---|
videoName | string | - | Display name for the video. Useful for finding the video in the dashboard or via API. |
videoQuality | string | standard | Quality preset: standard, high, ultra |
maxEdgeLength | integer | -1 | Max short-edge resolution (e.g. 1080). -1 means “auto”. |
maxFrameRate | integer | -1 | Max frame rate. -1 means “auto”. |
encodingMode | string | - | fast or slow |
audioCodec | string | aac | aac, aac-he, aac-he-v2, mp3, ac3, eac3 |
Response body
A successful response will include this:
{ "body": { "assetId": "vid_XXX" }}Code Examples
const APIKEY = "YOUR_API_KEY"; // Created in the AntCDN dashboard
async function uploadVideoFromURL( videoURL: string, fileName: string, allowPublicAccess: boolean, videoQuality: "standard" | "high" | "ultra" = "standard"): Promise<string> { // AntCDN fetches the URL server-side and begins processing automatically. const uploadResponse = await fetch( `https://api.antcdn.net/v1/videos/upload`, { method: "POST", headers: { "X-Api-Key": APIKEY, "Content-Type": "application/json" }, body: JSON.stringify({ fileName: fileName, allowPublicAccess: allowPublicAccess, videoQuality: videoQuality, videoURL: videoURL }) } );
if (!uploadResponse.ok) throw new Error(`upload failed: ${uploadResponse.status}`); const { body: uploadData } = await uploadResponse.json();
return uploadData.assetId;}
// Example usageconst assetId = await uploadVideoFromURL( "https://example.com/my-video.mp4", "my-video.mp4", true, "high");console.log("Video ID:", assetId);import requests
APIKEY = "YOUR_API_KEY" # Created in the AntCDN dashboard
def upload_video_from_url( video_url: str, file_name: str, allow_public_access: bool, video_quality: str = "standard") -> str: # AntCDN fetches the URL server-side and begins processing automatically. upload_response = requests.post( 'https://api.antcdn.net/v1/videos/upload', headers={ 'X-Api-Key': APIKEY, 'Content-Type': 'application/json' }, json={ 'fileName': file_name, 'allowPublicAccess': allow_public_access, 'videoQuality': video_quality, 'videoURL': video_url } )
upload_response.raise_for_status() upload_data = upload_response.json()['body']
return upload_data['assetId']
# Example usagevideo_id = upload_video_from_url( video_url="https://example.com/my-video.mp4", file_name="my-video.mp4", allow_public_access=True, video_quality="high")print(f"Video ID: {video_id}")package main
import ( "bytes" "encoding/json" "fmt" "net/http")
const APIKEY = "YOUR_API_KEY" // Created in the AntCDN dashboard
type UploadVideoRequest struct { FileName string `json:"fileName"` VideoQuality string `json:"videoQuality"` AllowPublicAccess bool `json:"allowPublicAccess"` VideoURL string `json:"videoURL"`}
type UploadVideoResponse struct { Body struct { AssetId string `json:"assetId"` } `json:"body"`}
func uploadVideoFromURL(videoURL, fileName, videoQuality string, allowPublicAccess bool) (string, error) { // Step 1: Submit the video config with accessible URL reqBody, _ := json.Marshal(UploadVideoRequest{ FileName: fileName, VideoQuality: videoQuality, AllowPublicAccess: allowPublicAccess, VideoURL: videoURL, })
req, _ := http.NewRequest("POST", "https://api.antcdn.net/v1/videos/upload", bytes.NewBuffer(reqBody)) req.Header.Set("X-Api-Key", APIKEY) req.Header.Set("Content-Type", "application/json")
client := &http.Client{} resp, err := client.Do(req) if err != nil { return "", err } defer resp.Body.Close()
var uploadResp UploadVideoResponse json.NewDecoder(resp.Body).Decode(&uploadResp)
return uploadResp.Body.AssetId, nil}
// Example usagefunc main() { assetId, _ := uploadVideoFromURL( "https://example.com/my-video.mp4", "my-video.mp4", "high", true, )
fmt.Println("Video ID:", assetId)}How To Play The Video You Just Uploaded
Once processing finishes, create (or use) an Edge Key and embed it:
<!-- Replace {edgeKey} with an Edge Key --><iframe src="https://player.antcdn.net/v1/{edgeKey}/master.m3u8?autoplay=true&muted=true" frameborder="0" allowfullscreen></iframe>Check out our “Video Player” docs for more information.