Upload
Upload Document
Upload a document to HITL.sh hosting (S3-backed) for use in file content type requests
POST
/
v1
/
upload
/
document
Upload Document
curl --request POST \
--url https://api.hitl.sh/v1/upload/document \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.hitl.sh/v1/upload/document"
payload = {}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.hitl.sh/v1/upload/document', 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.hitl.sh/v1/upload/document",
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([
]),
CURLOPT_HTTPHEADER => [
"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.hitl.sh/v1/upload/document"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
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.hitl.sh/v1/upload/document")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hitl.sh/v1/upload/document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"error": true,
"data": {
"url": "<string>",
"file_type": "<string>",
"file_name": "<string>",
"size_bytes": 123
}
}Upload Document
Upload a document file to HITL.sh hosting. The returned URL, file type, and filename can be used when creating requests withtype: "file".
Request
file
required
Document file to upload. Must be one of the supported formats.
Supported Formats
| Format | MIME Type |
|---|---|
application/pdf | |
| DOC | application/msword |
| DOCX | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| XLS | application/vnd.ms-excel |
| XLSX | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
| PPT | application/vnd.ms-powerpoint |
| PPTX | application/vnd.openxmlformats-officedocument.presentationml.presentation |
| CSV | text/csv |
| TXT | text/plain |
Limits
- Maximum file size: 50 MB
- Content-Type:
multipart/form-data
Response
boolean
Whether the request failed
object
Success Response
{
"error": false,
"data": {
"url": "https://cdn.hitl.sh/uploads/docs/xyz789.pdf",
"file_type": "application/pdf",
"file_name": "vendor-agreement-2026.pdf",
"size_bytes": 204800
}
}
Examples
import requests
with open("vendor-agreement-2026.pdf", "rb") as f:
response = requests.post(
"https://api.hitl.sh/v1/upload/document",
headers={"Authorization": f"Bearer {api_key}"},
files={"file": ("vendor-agreement-2026.pdf", f, "application/pdf")}
)
upload = response.json()["data"]
# Now create a request with the uploaded document
request_data = {
"processing_type": "deferred",
"type": "file",
"priority": "medium",
"request_text": "Review Section 3 and flag any clauses requiring legal approval.",
"file_url": upload["url"],
"file_type": upload["file_type"],
"file_name": upload["file_name"],
"response_type": "text",
"response_config": {
"placeholder": "Describe any clauses that need review...",
"min_length": 20,
"max_length": 1000,
"required": True
},
"default_response": "No issues found",
"platform": "api"
}
const FormData = require("form-data");
const fs = require("fs");
const form = new FormData();
form.append("file", fs.createReadStream("vendor-agreement-2026.pdf"));
const uploadResponse = await axios.post(
"https://api.hitl.sh/v1/upload/document",
form,
{
headers: {
Authorization: `Bearer ${apiKey}`,
...form.getHeaders()
}
}
);
const upload = uploadResponse.data.data;
// Now create a request with the uploaded document
const requestData = {
processing_type: "deferred",
type: "file",
priority: "medium",
request_text: "Review Section 3 and flag any clauses requiring legal approval.",
file_url: upload.url,
file_type: upload.file_type,
file_name: upload.file_name,
response_type: "text",
response_config: {
placeholder: "Describe any clauses that need review...",
min_length: 20,
max_length: 1000,
required: true
},
default_response: "No issues found",
platform: "api"
};
# Upload the document
curl -X POST https://api.hitl.sh/v1/upload/document \
-H "Authorization: Bearer your_api_key" \
-F "file=@vendor-agreement-2026.pdf"
# Response:
# {
# "error": false,
# "data": {
# "url": "https://cdn.hitl.sh/uploads/docs/xyz789.pdf",
# "file_type": "application/pdf",
# "file_name": "vendor-agreement-2026.pdf",
# "size_bytes": 204800
# }
# }
# Use the returned fields in a request
curl -X POST https://api.hitl.sh/v1/api/loops/{loop_id}/requests \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"type": "file",
"file_url": "https://cdn.hitl.sh/uploads/docs/xyz789.pdf",
"file_type": "application/pdf",
"file_name": "vendor-agreement-2026.pdf",
"request_text": "Review Section 3 and flag any clauses requiring legal approval.",
"response_type": "text",
"response_config": {
"placeholder": "Describe any clauses that need review...",
"min_length": 20,
"max_length": 1000,
"required": true
},
"default_response": "No issues found",
"platform": "api"
}'
⌘I
Upload Document
curl --request POST \
--url https://api.hitl.sh/v1/upload/document \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://api.hitl.sh/v1/upload/document"
payload = {}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.hitl.sh/v1/upload/document', 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.hitl.sh/v1/upload/document",
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([
]),
CURLOPT_HTTPHEADER => [
"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.hitl.sh/v1/upload/document"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
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.hitl.sh/v1/upload/document")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hitl.sh/v1/upload/document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"error": true,
"data": {
"url": "<string>",
"file_type": "<string>",
"file_name": "<string>",
"size_bytes": 123
}
}