cURL
curl --request POST \
--url https://api.tela.com/v2/fileimport requests
url = "https://api.tela.com/v2/file"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.tela.com/v2/file', 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.tela.com/v2/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tela.com/v2/file"
req, _ := http.NewRequest("POST", url, nil)
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.tela.com/v2/file")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/v2/file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"upload_url": "https://file-upload-temporary.9161f3bf787dfc457efb6c4fc312e229.r2.cloudflarestorage.com/3478889e-32fb-4267-9608-d83555b88261/fl_fghme5tu2jesklct5sf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=46f3b221e20b2c259a3f7259cc387d24%2F20241008%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20241008T145809Z&X-Amz-Expires=900&X-Amz-Signature=e63145dc80b75fa489318e23806cd484f8503c33c113cf08990fe2e3d9a3d12c&X-Amz-SignedHeaders=host&x-id=PutObject",
"download_url": "https://tmp.files.tela.com/3478483e-322b-1867-9608-d83555b81261/fl_fghme5tu2xeaklct5sf"
}File
Upload a File
Upload a file to the Tela API
POST
/
v2
/
file
cURL
curl --request POST \
--url https://api.tela.com/v2/fileimport requests
url = "https://api.tela.com/v2/file"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.tela.com/v2/file', 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.tela.com/v2/file",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tela.com/v2/file"
req, _ := http.NewRequest("POST", url, nil)
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.tela.com/v2/file")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/v2/file")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"upload_url": "https://file-upload-temporary.9161f3bf787dfc457efb6c4fc312e229.r2.cloudflarestorage.com/3478889e-32fb-4267-9608-d83555b88261/fl_fghme5tu2jesklct5sf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=46f3b221e20b2c259a3f7259cc387d24%2F20241008%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20241008T145809Z&X-Amz-Expires=900&X-Amz-Signature=e63145dc80b75fa489318e23806cd484f8503c33c113cf08990fe2e3d9a3d12c&X-Amz-SignedHeaders=host&x-id=PutObject",
"download_url": "https://tmp.files.tela.com/3478483e-322b-1867-9608-d83555b81261/fl_fghme5tu2xeaklct5sf"
}Uploading a File
Using this endpoint you can request a temporary URL to upload a file to Tela’s storage. Here’s an code example on how to do it:const { download_url, upload_url: uploadUrl } = await fetch(
'https://api.tela.com/v2/file',
{ method: 'POST' }
).then(res => res.json())
await fetch(uploadUrl, { method: 'PUT', body: file })
import requests
response = requests.post('https://api.tela.com/v2/file')
upload_url = response.json().upload_url
file = open('path/to/file', 'rb')
requests.put(upload_url, data=file)
⌘I