Skip to main content
POST
/
files
/
create
Create File
curl --request POST \
  --url https://api.duohub.ai/files/create \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "meeting_recording.mp3",
  "key": "raw/meeting_recording.mp3",
  "external_uri": "https://example.com/meeting_recording.mp3",
  "fileType": "audio"
}
'
import requests

url = "https://api.duohub.ai/files/create"

payload = {
"name": "meeting_recording.mp3",
"key": "raw/meeting_recording.mp3",
"external_uri": "https://example.com/meeting_recording.mp3",
"fileType": "audio"
}
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({
name: 'meeting_recording.mp3',
key: 'raw/meeting_recording.mp3',
external_uri: 'https://example.com/meeting_recording.mp3',
fileType: 'audio'
})
};

fetch('https://api.duohub.ai/files/create', 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.duohub.ai/files/create",
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([
'name' => 'meeting_recording.mp3',
'key' => 'raw/meeting_recording.mp3',
'external_uri' => 'https://example.com/meeting_recording.mp3',
'fileType' => 'audio'
]),
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.duohub.ai/files/create"

payload := strings.NewReader("{\n \"name\": \"meeting_recording.mp3\",\n \"key\": \"raw/meeting_recording.mp3\",\n \"external_uri\": \"https://example.com/meeting_recording.mp3\",\n \"fileType\": \"audio\"\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.duohub.ai/files/create")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"meeting_recording.mp3\",\n \"key\": \"raw/meeting_recording.mp3\",\n \"external_uri\": \"https://example.com/meeting_recording.mp3\",\n \"fileType\": \"audio\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.duohub.ai/files/create")

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 \"name\": \"meeting_recording.mp3\",\n \"key\": \"raw/meeting_recording.mp3\",\n \"external_uri\": \"https://example.com/meeting_recording.mp3\",\n \"fileType\": \"audio\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success",
  "data": {
    "id": "<string>",
    "name": "<string>",
    "extension": "<string>",
    "fileType": "<string>",
    "category": "<string>",
    "bronzeKey": "<string>",
    "organisationID": "<string>",
    "externalURI": "<string>",
    "numSpeakers": 123,
    "originRegion": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}
If you are not adding a web address, you must pass the key returned from the /files/upload endpoint to the key param in the /files/create endpoint or file processing will fail.

Authorizations

X-API-Key
string
header
required

Your duohub API key. Type: str

Body

application/json
name
string
required

Name of the file

id
string

Optional unique identifier for the file. If not provided, a UUID will be generated.

key
string

Storage key for the file

externalURI
string

External URI for the file

fileType
enum<string>

Type of the file

Available options:
website,
sitemap,
website_bulk,
document,
text,
image,
audio,
video,
other

Response

201 - application/json

File created successfully

status
enum<string>
required
Available options:
success
data
object
required