Create a presigned upload
curl --request POST \
--url https://api.trycarhub.com/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endpoint": "vehicle.pose",
"content_type": "image/jpeg",
"filename": "vehicle-front-left.jpg"
}
'import requests
url = "https://api.trycarhub.com/v1/uploads"
payload = {
"endpoint": "vehicle.pose",
"content_type": "image/jpeg",
"filename": "vehicle-front-left.jpg"
}
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({
endpoint: 'vehicle.pose',
content_type: 'image/jpeg',
filename: 'vehicle-front-left.jpg'
})
};
fetch('https://api.trycarhub.com/v1/uploads', 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.trycarhub.com/v1/uploads",
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([
'endpoint' => 'vehicle.pose',
'content_type' => 'image/jpeg',
'filename' => 'vehicle-front-left.jpg'
]),
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://api.trycarhub.com/v1/uploads"
payload := strings.NewReader("{\n \"endpoint\": \"vehicle.pose\",\n \"content_type\": \"image/jpeg\",\n \"filename\": \"vehicle-front-left.jpg\"\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://api.trycarhub.com/v1/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"vehicle.pose\",\n \"content_type\": \"image/jpeg\",\n \"filename\": \"vehicle-front-left.jpg\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trycarhub.com/v1/uploads")
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 \"endpoint\": \"vehicle.pose\",\n \"content_type\": \"image/jpeg\",\n \"filename\": \"vehicle-front-left.jpg\"\n}"
response = http.request(request)
puts response.read_body{
"object": "upload",
"upload_ref": "upl_7Qm2hV9tXbLd",
"url": "<string>",
"expires_at": 1755300000,
"max_bytes": 524288000,
"method": "PUT",
"headers": {},
"fields": {}
}
Uploads
Create a presigned upload
Prepare a reusable media upload for an inference endpoint. Requires upload permission and access to that endpoint. Follow the returned upload method, then submit upload_ref in inputs[].ref. See uploads.
With size_bytes, upload exactly that byte count using PUT. Without it, use the returned POST form fields. Preserve all signed headers or fields. Do not send your CarHub API key to the upload URL.
POST
/
v1
/
uploads
Create a presigned upload
curl --request POST \
--url https://api.trycarhub.com/v1/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endpoint": "vehicle.pose",
"content_type": "image/jpeg",
"filename": "vehicle-front-left.jpg"
}
'import requests
url = "https://api.trycarhub.com/v1/uploads"
payload = {
"endpoint": "vehicle.pose",
"content_type": "image/jpeg",
"filename": "vehicle-front-left.jpg"
}
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({
endpoint: 'vehicle.pose',
content_type: 'image/jpeg',
filename: 'vehicle-front-left.jpg'
})
};
fetch('https://api.trycarhub.com/v1/uploads', 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.trycarhub.com/v1/uploads",
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([
'endpoint' => 'vehicle.pose',
'content_type' => 'image/jpeg',
'filename' => 'vehicle-front-left.jpg'
]),
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://api.trycarhub.com/v1/uploads"
payload := strings.NewReader("{\n \"endpoint\": \"vehicle.pose\",\n \"content_type\": \"image/jpeg\",\n \"filename\": \"vehicle-front-left.jpg\"\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://api.trycarhub.com/v1/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endpoint\": \"vehicle.pose\",\n \"content_type\": \"image/jpeg\",\n \"filename\": \"vehicle-front-left.jpg\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trycarhub.com/v1/uploads")
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 \"endpoint\": \"vehicle.pose\",\n \"content_type\": \"image/jpeg\",\n \"filename\": \"vehicle-front-left.jpg\"\n}"
response = http.request(request)
puts response.read_body{
"object": "upload",
"upload_ref": "upl_7Qm2hV9tXbLd",
"url": "<string>",
"expires_at": 1755300000,
"max_bytes": 524288000,
"method": "PUT",
"headers": {},
"fields": {}
}
Authorizations
Headers
Body
application/json
Required target endpoint. Determines the presigned URL's upload size limit.
Available options:
vehicle.pose, vehicle.segment, vehicle.identify, vin.read, driver_license.read, plate.read, document.read, dashboard.read, engine.detect, damage.detect, damage.severity, tire.read, tire.detect, parts.recognize, parts.segment, parts.decompose, pricing.vehicle, pricing.repair, carhub.background, render.background, render.customize, render.enhance, render.plate, render.360, render.video, render.hotspots Response
Upload slot created.