AWS Presigned URL
curl --request POST \
--url https://api.prd.realitydefender.xyz/api/files/aws-presigned \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"fileName": "<string>"
}
'import requests
url = "https://api.prd.realitydefender.xyz/api/files/aws-presigned"
payload = { "fileName": "<string>" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileName: '<string>'})
};
fetch('https://api.prd.realitydefender.xyz/api/files/aws-presigned', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.prd.realitydefender.xyz/api/files/aws-presigned",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fileName' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.prd.realitydefender.xyz/api/files/aws-presigned"
payload := strings.NewReader("{\n \"fileName\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.prd.realitydefender.xyz/api/files/aws-presigned")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prd.realitydefender.xyz/api/files/aws-presigned")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyEndpoint Examples
AWS Presigned URL
POST
api
/
files
/
aws-presigned
AWS Presigned URL
curl --request POST \
--url https://api.prd.realitydefender.xyz/api/files/aws-presigned \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"fileName": "<string>"
}
'import requests
url = "https://api.prd.realitydefender.xyz/api/files/aws-presigned"
payload = { "fileName": "<string>" }
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileName: '<string>'})
};
fetch('https://api.prd.realitydefender.xyz/api/files/aws-presigned', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.prd.realitydefender.xyz/api/files/aws-presigned",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'fileName' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.prd.realitydefender.xyz/api/files/aws-presigned"
payload := strings.NewReader("{\n \"fileName\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.prd.realitydefender.xyz/api/files/aws-presigned")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prd.realitydefender.xyz/api/files/aws-presigned")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodystring
The file name of the file you would like to upload, including the file extension.
Authorization
To request a pre-signed URL, you must include thex-api-key in your request headers. This key is essential for authenticating your request and ensuring secure access to the API.
Supported File Types
- Images:
.jpg,.jpeg,.png,.gif,.webp - Audio:
.mp3,.wav,.m4a,.aac,.ogg,.flac,.alac - Video:
.mp4,.mov - Text:
.txt
Size Limits
- Text: up to 5MB
- Images: up to 50MB
- Audio: up to 20MB
- Video: up to 250MB
Filename Restrictions
- Maximum length: 200 characters
- Special characters will be converted to underscores
- Case insensitive
Sample Code Snippet
Here’s an example of how you can request a pre-signed URL and upload a file.# First request to get the presigned URL
curl -X POST \
'https://api.prd.realitydefender.xyz/api/files/aws-presigned' \
-H 'X-API-KEY: your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{"fileName": "your-file.mp4"}'
# Second request to upload the file using the presigned URL
# Important: The @ prefix is required before the filename when using --data-binary
# This tells curl to read the file content (works on all platforms: macOS, Linux, Windows)
# For filenames with spaces or special characters, wrap the entire @filename in quotes
curl -X PUT \
'presigned-url-from-previous-response' \
--data-binary '@your-file.mp4'
# Example with a filename containing spaces:
# curl -X PUT 'presigned-url-from-previous-response' \
# --data-binary '@filename with spaces.mp4'
import requests
file_path = "your-file.mp4"
url = "https://api.prd.realitydefender.xyz/api/files/aws-presigned"
payload = {
"fileName": file_path
}
headers = {
"X-API-KEY": "your-api-key-here",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
response_data = response.json()
signed_url = response_data.get("response", {}).get("signedUrl")
with open(file_path, 'rb') as file:
file_data = file.read()
response = requests.put(signed_url, data=file_data, timeout=20)
⌘I