Upload a small file (≤ 10 MB)
curl --request POST \
--url https://api.usepatchwork.co/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.usepatchwork.co/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.usepatchwork.co/v1/files"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text){
"status": "success",
"data": {
"id": "<string>",
"state": "uploading",
"created_at": "2023-11-07T05:31:56Z",
"media_type": "<string>",
"filename": "<string>",
"size": 123,
"sha256": "<string>",
"segment_size": 123,
"received_segments": [
123
],
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}Files
Upload a small file (≤ 10 MB)
One-shot upload. Send multipart/form-data with a file part, or a JSON body with base64 content. Files larger than 10 MB must use the chunked flow (/v1/files/initialize). Uploads are synchronous and return a ready handle. Not billed.
POST
/
v1
/
files
Upload a small file (≤ 10 MB)
curl --request POST \
--url https://api.usepatchwork.co/v1/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.usepatchwork.co/v1/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.usepatchwork.co/v1/files"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text){
"status": "success",
"data": {
"id": "<string>",
"state": "uploading",
"created_at": "2023-11-07T05:31:56Z",
"media_type": "<string>",
"filename": "<string>",
"size": 123,
"sha256": "<string>",
"segment_size": 123,
"received_segments": [
123
],
"expires_at": "2023-11-07T05:31:56Z"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}{
"status": "error",
"error": {
"message": "<string>",
"code": "<string>",
"details": "<unknown>"
}
}Authorizations
Identify accepts a workspace API key (sk_…). Loom accepts either a short-lived session token (direct) or a workspace API key (relay).
Headers
Makes this POST safe to retry. The first call does the work and its response is stored; a retry with the same key returns that stored response with Idempotency-Replayed: true, without charging again. Same key with a different body is rejected. Keys expire after 24 hours.
Maximum string length:
255