curl --request POST \
--url https://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "sample-call.wav",
"contentType": "audio/wav",
"contentLength": 1048576,
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
'import requests
url = "https://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign"
payload = {
"fileName": "sample-call.wav",
"contentType": "audio/wav",
"contentLength": 1048576,
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fileName: 'sample-call.wav',
contentType: 'audio/wav',
contentLength: 1048576,
sha256: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
})
};
fetch('https://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign', 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://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign",
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' => 'sample-call.wav',
'contentType' => 'audio/wav',
'contentLength' => 1048576,
'sha256' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign"
payload := strings.NewReader("{\n \"fileName\": \"sample-call.wav\",\n \"contentType\": \"audio/wav\",\n \"contentLength\": 1048576,\n \"sha256\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"sample-call.wav\",\n \"contentType\": \"audio/wav\",\n \"contentLength\": 1048576,\n \"sha256\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"sample-call.wav\",\n \"contentType\": \"audio/wav\",\n \"contentLength\": 1048576,\n \"sha256\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n}"
response = http.request(request)
puts response.read_body{
"blobId": "2nYn7qqkM5678Ks99ykvmZAr7pz",
"uploadUrl": "https://storage.example.com/upload?..."
}{
"code": "BAD_REQUEST",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "UNAUTHORIZED",
"message": "Invalid or missing token",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "FORBIDDEN",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "UNPROCESSABLE_ENTITY",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "VALIDATION_ERROR",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}Request an upload URL
Returns a pre-signed upload URL bound to the file’s SHA-256. Upload the audio bytes with an HTTP PUT to that URL. The PUT must send the headers Content-Type (the declared contentType), Content-Length (the declared contentLength) and X-Amz-Content-Sha256 (the declared sha256), with the same values you sent here. Otherwise the storage service refuses the upload with 403, and the simulate call then returns 422. After the upload succeeds, call POST /api/v1/realcall/streams/simulate with the returned blobId. Returns 422 if the file name does not end in .mp3, .wav or .aiff, or if the file is larger than 20 MB.
curl --request POST \
--url https://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileName": "sample-call.wav",
"contentType": "audio/wav",
"contentLength": 1048576,
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
'import requests
url = "https://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign"
payload = {
"fileName": "sample-call.wav",
"contentType": "audio/wav",
"contentLength": 1048576,
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fileName: 'sample-call.wav',
contentType: 'audio/wav',
contentLength: 1048576,
sha256: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
})
};
fetch('https://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign', 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://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign",
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' => 'sample-call.wav',
'contentType' => 'audio/wav',
'contentLength' => 1048576,
'sha256' => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign"
payload := strings.NewReader("{\n \"fileName\": \"sample-call.wav\",\n \"contentType\": \"audio/wav\",\n \"contentLength\": 1048576,\n \"sha256\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileName\": \"sample-call.wav\",\n \"contentType\": \"audio/wav\",\n \"contentLength\": 1048576,\n \"sha256\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.api.os.realitydefender.xyz/api/v1/realcall/streams/presign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileName\": \"sample-call.wav\",\n \"contentType\": \"audio/wav\",\n \"contentLength\": 1048576,\n \"sha256\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\"\n}"
response = http.request(request)
puts response.read_body{
"blobId": "2nYn7qqkM5678Ks99ykvmZAr7pz",
"uploadUrl": "https://storage.example.com/upload?..."
}{
"code": "BAD_REQUEST",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "UNAUTHORIZED",
"message": "Invalid or missing token",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "FORBIDDEN",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "UNPROCESSABLE_ENTITY",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}{
"code": "VALIDATION_ERROR",
"message": "The request body contains invalid fields.",
"details": [
{
"field": "email",
"issue": "Must be a valid email address."
}
]
}Authorizations
Body
Describes the audio file you are about to upload, so a pre-signed upload URL bound to its SHA-256 can be issued. You upload the bytes directly to that URL.
Response
A presigned upload URL.